forked from joshua66553/Studio-Bot-Maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuUI.html
167 lines (159 loc) · 7.71 KB
/
MenuUI.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<html>
<link rel="stylesheet" href="main.css">
<meta charset="utf8">
<div style="width: 100vw; overflow: auto; height: 100vh; margin-top: -8px; margin-left: -8px; filter: blur(22px); border-radius: 14px; transition: scale 0.3s ease, filter 0.5s ease; scale: 0.1;" id="everything_container">
<div id="editorContent" style="height: 90vh; width: 100vw; background-color: #FFFFFF10; overflow: auto;">
<div class="ring"></div>
</div>
<div id="selectorMenu" class="flexbox" style="height: 10vh; justify-content: left; width: 100vw; background-color: #FFFFFF08;">
<div class="barbuttontexta" id="action-name"></div>
<div class="barbuttonshift flexbox" style="margin-right: 1vw; width: 13vw; margin-left: auto;" onclick="closeWindow()">
<div class="image checkmark" style="width: 30% !important; height: 30px !important; margin: auto !important;"></div>
<div style="margin: auto;">
<div class="barbuttontexta">Done</div>
<div class="smalltext" style="opacity: 50%; font-size: 8px;">CTRL+Q</div>
</div>
</div>
</div>
</div>
<script src="./AppData/Kits/Loader.js"></script>
<script src="./AppData/Kits/settings.js"></script>
<script>
var datjson = JSON.parse(fs.readFileSync('./AppData/data.json'))
let themeColor = datjson.color
document.getElementById('everything_container').style.background = `linear-gradient(45deg, ${themeColor} 0%, #121212 ${editorSettings.smoothness})`
document.body.style.padding = '0px !important';
document.body.style.paddingTop = '0px !important';
document.body.style.paddingBottom = '0px !important';
document.body.style.paddingLeft = '0px !important';
document.body.style.paddingRight = '0px !important';
document.body.style.borderRadius = '12px'
document.onkeydown=function(event) {
if (event.key.toLowerCase() == 's' && event.ctrlKey == true) {
closeWindow()
}
if (event.key == 'Tab' && event.ctrlKey == true) {
closeWindow()
}
if (event.key.toLowerCase() == 'q' && event.ctrlKey == true) {
closeWindow()
}
if (event.key.toLowerCase() == 'v' && event.ctrlKey == true) {
if (lastActionContainer && copiedAction) {
let targetField = document.getElementById(actionUI[lastActionContainer])
if (targetField.style.height == '10vh') return;
event.preventDefault()
document.activeElement.blur()
action.data[actionUI[lastActionContainer]].push(copiedAction)
refreshActions(actionUI[lastActionContainer])
} else if (copiedAction) {
event.preventDefault()
document.activeElement.blur()
for (let UIelement in actionUI) {
if (UIelement.startsWith('actions')) {
let targetField = document.getElementById(actionUI[UIelement])
if (targetField.style.height == '10vh') return;
let targetAdd = document.getElementById(actionUI[UIelement] + 'AddButton')
targetAdd.style.scale = '0';
targetField.style.filter = 'blur(22px)'
targetField.style.height = '10vh'
setTimeout(() => {
targetField.innerHTML = `
<div class="flexbox" style="width: 100%; height: 100%;">
<div class="barbuttontexta" style="width: 100%;">Pasting <span style="opacity: 50%;">${copiedAction.name}</span></div>
<div class="barbuttonshift borderright" onclick="action.data[actionUI[lastActionContainer]].push(copiedAction); restoreActions()" style="margin: auto; margin-right: 0.3vw;">
<div class="barbuttontexta">Paste Here</div>
</div>
<div class="barbuttonshift borderleft" onclick="restoreActions()" style="margin: auto; margin-left: 0vw;">
<div class="barbuttontexta">Nevermind</div>
</div>
</div>
`
}, 150)
setTimeout(() => {
targetField.style.filter = ''
}, 200)
}
}
}
}
}
const { ipcRenderer } = require('electron');
let action;
let time;
let actions;
let actionType;
let actionUI;
let awaitingStoreFrom;
let variables;
let copiedAction;
let isActionMenu = true;
ipcRenderer.on('data', (event, data, windowTime, script) => {
document.getElementById('everything_container').style.transition = `all 0.${editorSettings.commonAnimation}s ease`
actionType = data.actionType;
variables = data.variables;
copiedAction = data.copiedAction;
console.log(data)
time = windowTime;
document.getElementById('everything_container').style.scale = '1'
document.getElementById('everything_container').style.filter = 'blur(0px)'
actions = data;
action = data;
actionFile = data;
for (let dataElement in actionFile.data) {
if (action.data[dataElement] == undefined) {
action.data[dataElement] = actionData[dataElement]
}
}
actionUI = actionFile.UI;
actionUI.script = script;
document.getElementById('action-name').innerHTML = 'Editing <span style="opacity:50%">' + data.name + '</span>';
document.getElementById('editorContent').innerHTML = `<br>` + getUIelements(actionUI, action)
})
function closeWindow() {
document.getElementById('everything_container').style.scale = '0'
document.body.style.transition = 'all 0.2s ease'
document.body.style.backgroundColor = '#FFFFFF00'
document.getElementById('everything_container').style.filter = 'blur(40px)'
let savedData = save()
setTimeout(() => {
ipcRenderer.send(`${time}`, {
event: 'customReceived',
data: savedData,
copiedAction: copiedAction
});
}, 450)
}
function save() {
for (let i in actionUI) {
let element = actionUI[i]
if (element != 'preview' || element != 'previewName' || !element.StartsWith('invisible')) {
if (i == 'ButtonBar') {
if (action.data.button.endsWith('*')) {
action.data.ExtraData = document.getElementById('ExtraData').innerText
}
} else {
if (i.startsWith('text') || i == 'script' || i.startsWith('toggle') || i.startsWith('menuBar') || i == 'preview' || i.startsWith('actions') || i.startsWith('customMenu') ||i == 'previewName' || i.startsWith('sepbar') || i.startsWith('btext') || i.startsWith('invisible')) {} else {
try {
if (i.split(' ').includes('custom')) {
action.data[element] = document.getElementById(element).value;
} else {
if (i.startsWith('largeInput')) {
action.data[element] = document.getElementById(element).value;
} else {
action.data[element] = document.getElementById(element).innerText;
}
}
} catch(err) {}
}
}
}
}
return action.data
}
</script>
<script src="./AppData/Kits/EditorComponents.js"></script>
<script src="./AppData/Kits/EditorScripts.js"></script>
<script src="./AppData/Kits/flex.js"></script>
<script src="./AppData/Kits/variableInsertion.js"></script>
</html>