corrade-nucleus-nucleons – Diff between revs 27 and 28
?pathlinks?
Rev 27 | Rev 28 | |||
---|---|---|---|---|
Line 1... | Line -... | |||
1 | <!DOCTYPE html> |
- | ||
2 | |
- | ||
3 | <html lang="en"> |
- | ||
4 | <head> |
- | ||
5 | <meta charset="utf-8"> |
1 | <div id="script-kiddie"> |
|
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
- | ||
7 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
- | ||
8 | <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
- | ||
9 | <meta name="description" content="Corrade Nucleon"> |
- | ||
10 | <meta name="author" content="Wizardry and Steamworks"> |
- | ||
11 | <link rel="icon" href="favicon.ico"> |
- | ||
12 | |
- | ||
13 | <title>Corrade Nucleus - LSL Scripting Environment</title> |
- | ||
14 | |
- | ||
15 | <!-- Bootstrap core CSS --> |
- | ||
16 | <link href="/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css"> |
- | ||
17 | <!-- Corrade Nucleus Fonts --> |
- | ||
18 | <link href="/css/nucleus/fonts.css" rel="stylesheet" type="text/css"> |
- | ||
19 | <!-- Customized bootstrap style. --> |
- | ||
20 | <link href="/css/nucleus/nucleus.css" rel="stylesheet" type="text/css"> |
- | ||
21 | <!-- Manager for Windows. --> |
- | ||
22 | <link href="/css/wm/wm.css" rel="stylesheet" type="text/css"> |
- | ||
23 | <!-- Script Kiddie style. --> |
2 | <!-- Script Kiddie style. --> |
|
24 | <link href="/script-kiddie/css/style.css" rel="stylesheet" type="text/css"> |
3 | <link href="/script-kiddie/css/style.css" rel="stylesheet" type="text/css"> |
|
Line 25... | Line 4... | |||
25 | |
4 | |
|
26 | <!-- Bootstrap Toggle --> |
5 | <!-- Bootstrap Toggle --> |
|
Line 27... | Line -... | |||
27 | <link href="/script-kiddie/node_modules/bootstrap-toggle/css/bootstrap-toggle.min.css" rel="stylesheet" type="text/css"> |
- | ||
28 | |
- | ||
29 | </script> |
- | ||
30 | </head> |
- | ||
31 | |
6 | <link href="/script-kiddie/node_modules/bootstrap-toggle/css/bootstrap-toggle.min.css" rel="stylesheet" type="text/css"> |
|
32 | <body> |
7 | |
|
33 | <!-- Dialog Modal --> |
8 | <!-- Dialog Modal --> |
|
34 | <div id="avatar-select" class="modal fade bs-example-modal-lg" role="dialog"> |
9 | <div id="script-kiddie-avatar-select" class="modal fade bs-example-modal-lg" role="dialog"> |
|
Line 35... | Line 10... | |||
35 | <div class="modal-dialog modal-lg"> |
10 | <div class="modal-dialog modal-lg"> |
|
36 | <!-- Modal content--> |
11 | <!-- Modal content--> |
|
37 | |
12 | |
|
Line 38... | Line 13... | |||
38 | <div class="modal-content"> |
13 | <div class="modal-content"> |
|
39 | <div class="modal-header"> |
14 | <div class="modal-header"> |
|
Line 40... | Line 15... | |||
40 | <button type="button" class="close" data-dismiss="modal">×</button> |
15 | <button type="button" class="close" data-dismiss="modal">×</button> |
|
41 | |
16 | |
|
42 | <h1 id="title" class="modal-title">Avatar Selection</h1> |
17 | <h1 class="modal-title">Avatar Selection</h1> |
|
43 | </div> |
18 | </div> |
|
44 | |
19 | |
|
45 | <form id="avatar-select-form" class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();"> |
20 | <form class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();"> |
|
46 | <div id="content" class="modal-body"> |
21 | <div class="modal-body"> |
|
47 | <p>Please enter the avatar firstname and lastname to send the script to.</p> |
22 | <p>Please enter the avatar firstname and lastname to send the script to.</p> |
|
48 | <div class="form-group has-feedback"> |
23 | <div class="form-group has-feedback"> |
|
49 | <label for="avatar-firstname">First Name</label> |
24 | <label for="script-kiddie-avatar-firstname">First Name</label> |
|
50 | <input id="avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
25 | <input id="script-kiddie-avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
|
51 | <label for="avatar-lastname">Last Name</label> |
26 | <label for="script-kiddie-avatar-lastname">Last Name</label> |
|
52 | <input id="avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
27 | <input id="script-kiddie-avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
|
53 | </div> |
28 | </div> |
|
54 | </div> |
29 | </div> |
|
55 | <div class="modal-footer"> |
30 | <div class="modal-footer"> |
|
56 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
31 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|
57 | <button id="send-script" type="submit" class="btn btn-primary">Confirm</button> |
32 | <button id="script-kiddie-send-script" type="submit" class="btn btn-primary">Confirm</button> |
|
58 | </div> |
- | ||
59 | </form> |
- | ||
60 | </div> |
- | ||
61 | </div> |
- | ||
62 | </div> |
- | ||
63 | |
- | ||
64 | <div class="container"> |
- | ||
65 | <div class="jumbotron"> |
- | ||
66 | <h1>Corrade Script Kiddie</h1> |
- | ||
67 | <p class="lead">Script Kiddie is an LSL editor using Corrade as a backend for developing scripts.</p> |
- | ||
Line 68... | Line 33... | |||
68 | <img src="script-kiddie/img/script-kiddie.png"></div> |
33 | </div> |
|
69 | |
34 | </form> |
|
- | 35 | </div> |
||
70 | <!-- <div id="drag-1" class="draggable"> |
36 | </div> |
|
71 | <p> You can drag one element </p> |
37 | </div> |
|
72 | </div> --> |
38 | |
|
73 | |
39 | <div class="panel panel-default draggable movable"> |
|
Line 74... | Line 40... | |||
74 | <div id="editor-panel" class="panel panel-default draggable movable"> |
40 | <div class="panel-heading"> |
|
75 | <div class="panel-heading"> |
41 | <button type="button" class="close" data-target="#script-kiddie" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> |
|
76 | <form id="script-tools" data-toggle="validator" onSubmit="event.preventDefault();"> |
42 | <form id="script-kiddie-script-tools" data-toggle="validator" onSubmit="event.preventDefault();"> |
|
77 | <div class="form-group"> |
43 | <div class="form-group"> |
|
78 | <button id="compile-script" class="btn btn-default check-image checkButton" type="button" title="Compile script.">Compile</button> |
44 | <button id="script-kiddie-compile-script" class="btn btn-default check-image checkButton" type="button" title="Compile script.">Compile</button> |
|
79 | <button id="tidy-script" class="btn btn-default" type="button" title="Tidy source-code.">Cleanup</button> |
45 | <button id="script-kiddie-tidy-script" class="btn btn-default" type="button" title="Tidy source-code.">Cleanup</button> |
|
80 | |
46 | |
|
81 | </div> |
47 | </div> |
|
82 | <div class="form-group has-feedback"> |
48 | <div class="form-group has-feedback"> |
|
83 | <div class="input-group"> |
49 | <div class="input-group"> |
|
84 | <span class="input-group-btn"> |
50 | <span class="input-group-btn"> |
|
85 | <input id="store-script" type="checkbox" data-toggle="toggle" data-on="Store" data-off="No Store" data-onstyle="success" disabled="disabled"> |
51 | <input id="script-kiddie-store-script" type="checkbox" data-toggle="toggle" data-on="Store" data-off="No Store" data-onstyle="success" disabled="disabled"> |
|
86 | </span> |
52 | </span> |
|
87 | <input id="script-name" type="text" class="form-control" placeholder="Script Name" aria-describedby="basic-addon1" required> |
53 | <input id="script-kiddie-script-name" type="text" class="form-control" placeholder="Script Name" aria-describedby="basic-addon1" required> |
|
88 | <span class="input-group-addon">-</span> |
54 | <span class="input-group-addon">-</span> |
|
89 | <input id="script-UUID" type="text" class="form-control" aria-describedby="basic-addon2" size="36"> |
55 | <input id="script-kiddie-script-UUID" type="text" class="form-control" aria-describedby="basic-addon2" size="36"> |
|
90 | <span class="input-group-btn"> |
56 | <span class="input-group-btn"> |
|
91 | <button id="give-script" class="btn btn-default" type="button" title="Give script." disabled="disabled">Give</button> |
57 | <button id="script-kiddie-give-script" class="btn btn-default" type="button" title="Give script." disabled="disabled">Give</button> |
|
92 | </span> |
58 | </span> |
|
93 | </div> |
59 | </div> |
|
94 | </div> |
60 | </div> |
|
95 | </form> |
61 | </form> |
|
96 | </div> |
62 | </div> |
|
Line 106... | Line 72... | |||
106 | { |
72 | { |
|
107 | llSay(0, "Touched."); |
73 | llSay(0, "Touched."); |
|
108 | } |
74 | } |
|
109 | } |
75 | } |
|
110 | </div> |
76 | </div> |
|
111 | </div> |
77 | <div> |
|
112 | </div> |
- | ||
113 | |
- | ||
114 | <div id="error-panel" class="panel panel-default draggable movable"> |
- | ||
115 | <div class="panel-heading"> |
- | ||
116 | <p>Compilation Errors</p> |
- | ||
117 | </div> |
- | ||
118 | <div class="panel-body" id="errorpanel"> |
- | ||
119 | <div id="errors"> |
- | ||
120 | <textarea id="message" class="form-control" rows="5" style="min-width: 100%; max-width: 100%; font-family: monospace; display: none;" readonly></textarea> |
78 | <textarea id="script-kiddie-message" class="form-control" rows="5" style="min-width: 100%; max-width: 100%; font-family: monospace; display: none;" readonly></textarea> |
|
121 | </div> |
79 | </div> |
|
122 | </div> |
80 | </div> |
|
123 | </div> |
81 | </div> |
|
Line 124... | Line -... | |||
124 | |
- | ||
125 | <!-- Nucleons --> |
- | ||
126 | <div class="panel panel-default draggable movable"> |
- | ||
127 | <div class="panel-heading"> |
- | ||
128 | <h3 class="panel-title">Nucleons</h3> |
- | ||
129 | </div> |
- | ||
130 | <div class="panel-body"> |
- | ||
131 | <div id="nucleons" class="row"></div> |
- | ||
132 | </div> |
- | ||
133 | </div> |
- | ||
134 | |
- | ||
135 | </div> <!-- /container --> |
- | ||
136 | |
- | ||
137 | <footer class="footer"> |
- | ||
138 | <p>© 2017 Wizardry and Steamworks</p> |
- | ||
139 | </footer> |
- | ||
140 | |
- | ||
141 | <!-- jQuery --> |
- | ||
142 | <script src="/node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script> |
- | ||
143 | <!-- Wizardry and Steamworks JavaScript Includes --> |
- | ||
144 | <script src="/node_modules/was/dist/was.min.js" type="text/javascript"></script> |
82 | |
|
145 | <!-- Bootstrap Javascript --> |
83 | <!-- Bootstrap Javascript --> |
|
146 | <script src="/node_modules/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script> |
84 | <script src="/node_modules/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script> |
|
147 | <!-- Bootstrap Validator --> |
85 | <!-- Bootstrap Validator --> |
|
148 | <script src="/node_modules/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script> |
86 | <script src="/node_modules/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script> |
|
Line 153... | Line 91... | |||
153 | <script src="/script-kiddie/node_modules/ace-builds/src-min-noconflict/ext-language_tools.js" type="text/javascript"></script> |
91 | <script src="/script-kiddie/node_modules/ace-builds/src-min-noconflict/ext-language_tools.js" type="text/javascript"></script> |
|
154 | <!-- Beautify.JS --> |
92 | <!-- Beautify.JS --> |
|
155 | <script src="/script-kiddie/node_modules/js-beautify/js/lib/beautify.js" type="text/javascript"></script> |
93 | <script src="/script-kiddie/node_modules/js-beautify/js/lib/beautify.js" type="text/javascript"></script> |
|
156 | <!-- Velocity --> |
94 | <!-- Velocity --> |
|
157 | <script src="/script-kiddie/node_modules/velocity-animate/velocity.min.js" type="text/javascript"></script> |
95 | <script src="/script-kiddie/node_modules/velocity-animate/velocity.min.js" type="text/javascript"></script> |
|
158 | <!-- Interact JS --> |
- | ||
159 | <script src="/node_modules/interactjs/dist/interact.min.js" type="text/javascript"></script> |
- | ||
160 | <!-- Manager for Windows. --> |
- | ||
161 | <script src="/js/wm/wm.js" type="text/javascript"></script> |
- | ||
162 | <!-- Nucleons Loader --> |
- | ||
163 | <script src="/js/nucleus/load-nucleons.js" type="text/javascript"></script> |
- | ||
164 | <script> |
96 | <script> |
|
165 | $(document).ready(() => { |
97 | $(document).ready(() => { |
|
166 | // Auto-complete. |
98 | // Auto-complete. |
|
167 | ace.require("ace/ext/language_tools"); |
99 | ace.require("ace/ext/language_tools"); |
|
Line 168... | Line 100... | |||
168 | |
100 | |
|
169 | // Create the editor. |
101 | // Create the editor. |
|
170 | var editor = ace.edit("editor"); |
102 | var editor = ace.edit("script-kiddie-editor"); |
|
171 | editor.setTheme("ace/theme/twilight"); |
103 | editor.setTheme("ace/theme/twilight"); |
|
172 | editor.getSession().setMode("ace/mode/lsl"); |
104 | editor.getSession().setMode("ace/mode/lsl"); |
|
173 | editor.setOptions({ |
105 | editor.setOptions({ |
|
174 | enableBasicAutocompletion: true, |
106 | enableBasicAutocompletion: true, |
|
Line 184... | Line 116... | |||
184 | function compile(lsl, callback) { |
116 | function compile(lsl, callback) { |
|
185 | // Set the editor to read-only. |
117 | // Set the editor to read-only. |
|
186 | editor.setReadOnly(true); |
118 | editor.setReadOnly(true); |
|
Line 187... | Line 119... | |||
187 | |
119 | |
|
188 | // Set the button image. |
120 | // Set the button image. |
|
189 | $('#compile-script').removeClass("check-image"); |
121 | $('#script-kiddie-compile-script').removeClass("check-image"); |
|
Line 190... | Line 122... | |||
190 | $('#compile-script').removeClass("checkButton"); |
122 | $('#script-kiddie-compile-script').removeClass("checkButton"); |
|
191 | |
123 | |
|
Line 192... | Line 124... | |||
192 | $('#compile-script').removeClass("cross-image"); |
124 | $('#script-kiddie-compile-script').removeClass("cross-image"); |
|
193 | $('#compile-script').removeClass("crossButton"); |
125 | $('#script-kiddie-compile-script').removeClass("crossButton"); |
|
Line 194... | Line 126... | |||
194 | |
126 | |
|
195 | $('#compile-script').addClass("activity-image"); |
127 | $('#script-kiddie-compile-script').addClass("activity-image"); |
|
196 | $('#compile-script').addClass("activityButton"); |
128 | $('#script-kiddie-compile-script').addClass("activityButton"); |
|
197 | |
129 | |
|
Line 208... | Line 140... | |||
208 | // Set the editor to read-enabled. |
140 | // Set the editor to read-enabled. |
|
209 | editor.setReadOnly(false); |
141 | editor.setReadOnly(false); |
|
Line 210... | Line 142... | |||
210 | |
142 | |
|
211 | if(success) { |
143 | if(success) { |
|
212 | // Set the button image. |
144 | // Set the button image. |
|
213 | $('#compile-script').removeClass("activity-image"); |
145 | $('#script-kiddie-compile-script').removeClass("activity-image"); |
|
Line 214... | Line 146... | |||
214 | $('#compile-script').removeClass("activityButton"); |
146 | $('#script-kiddie-compile-script').removeClass("activityButton"); |
|
215 | |
147 | |
|
Line 216... | Line 148... | |||
216 | $('#compile-script').addClass("check-image"); |
148 | $('#script-kiddie-compile-script').addClass("check-image"); |
|
217 | $('#compile-script').addClass("checkButton"); |
149 | $('#script-kiddie-compile-script').addClass("checkButton"); |
|
218 | |
150 | |
|
219 | $("#message").velocity("slideUp", { |
151 | $("#script-kiddie-message").velocity("slideUp", { |
|
220 | duration: 1000 |
152 | duration: 1000 |
|
221 | }); |
153 | }); |
|
Line 222... | Line 154... | |||
222 | callback(success); |
154 | callback(success); |
|
223 | return; |
155 | return; |
|
224 | } |
156 | } |
|
Line 225... | Line 157... | |||
225 | |
157 | |
|
226 | // Move panel to top. |
158 | // Move panel to top. |
|
227 | $('#error-panel').css('z-index', getTopWindowIndex() + 1); |
159 | $('#script-kiddie-error-panel').css('z-index', getTopWindowIndex() + 1); |
|
Line 228... | Line 160... | |||
228 | $('#error-panel').css('position', 'relative'); |
160 | $('#script-kiddie-error-panel').css('position', 'relative'); |
|
229 | |
161 | |
|
Line 230... | Line 162... | |||
230 | // Set the button image. |
162 | // Set the button image. |
|
231 | $('#compile-script').removeClass("activity-image"); |
163 | $('#script-kiddie-compile-script').removeClass("activity-image"); |
|
232 | $('#compile-script').removeClass("activityButton"); |
164 | $('#script-kiddie-compile-script').removeClass("activityButton"); |
|
Line 233... | Line 165... | |||
233 | |
165 | |
|
234 | $('#compile-script').addClass("cross-image"); |
166 | $('#script-kiddie-compile-script').addClass("cross-image"); |
|
235 | $('#compile-script').addClass("crossButton"); |
167 | $('#script-kiddie-compile-script').addClass("crossButton"); |
|
236 | |
168 | |
|
Line 237... | Line 169... | |||
237 | $("#message").velocity("slideDown", { |
169 | $("#script-kiddie-message").velocity("slideDown", { |
|
Line 250... | Line 182... | |||
250 | data: { |
182 | data: { |
|
251 | command: 'updatescript', |
183 | command: 'updatescript', |
|
252 | create: true, |
184 | create: true, |
|
253 | type: 'agent', |
185 | type: 'agent', |
|
254 | entity: 'text', |
186 | entity: 'text', |
|
255 | item: $('#script-UUID').val(), |
187 | item: $('#script-kiddie-script-UUID').val(), |
|
256 | target: $('#script-name').val(), |
188 | target: $('#script-kiddie-script-name').val(), |
|
257 | data: lsl |
189 | data: lsl |
|
258 | }, |
190 | }, |
|
259 | dataType: 'json' |
191 | dataType: 'json' |
|
260 | }).done(function(response) { |
192 | }).done(function(response) { |
|
261 | var success = response.success === "True"; |
193 | var success = response.success === "True"; |
|
Line 263... | Line 195... | |||
263 | // Get the response data and item UUID. |
195 | // Get the response data and item UUID. |
|
264 | var data = wasCSVToArray(response.data); |
196 | var data = wasCSVToArray(response.data); |
|
265 | var UUID = data[data.indexOf('item') + 1]; |
197 | var UUID = data[data.indexOf('item') + 1]; |
|
Line 266... | Line 198... | |||
266 | |
198 | |
|
267 | // Set the inventory UUID of the saved script. |
199 | // Set the inventory UUID of the saved script. |
|
Line 268... | Line 200... | |||
268 | $('#script-UUID').val(UUID); |
200 | $('#script-kiddie-script-UUID').val(UUID); |
|
269 | |
201 | |
|
270 | localStorage.setItem('nucleus-script-kiddie-script-UUID', UUID); |
202 | localStorage.setItem('nucleus-script-kiddie-script-UUID', UUID); |
|
271 | } |
203 | } |
|
Line 289... | Line 221... | |||
289 | // Script did not compile so do not store. |
221 | // Script did not compile so do not store. |
|
290 | if(!success) |
222 | if(!success) |
|
291 | return; |
223 | return; |
|
Line 292... | Line 224... | |||
292 | |
224 | |
|
293 | // Storing is not enabled so return. |
225 | // Storing is not enabled so return. |
|
294 | if($('#store-script').prop('checked') !== true) |
226 | if($('#script-kiddie-store-script').prop('checked') !== true) |
|
Line 295... | Line 227... | |||
295 | return; |
227 | return; |
|
296 | |
228 | |
|
297 | store(data, (success) => { |
229 | store(data, (success) => { |
|
Line 303... | Line 235... | |||
303 | }, |
235 | }, |
|
304 | readOnly: false // false if this command should not apply in readOnly mode |
236 | readOnly: false // false if this command should not apply in readOnly mode |
|
305 | }); |
237 | }); |
|
Line 306... | Line 238... | |||
306 | |
238 | |
|
307 | // Add click listener for compile button. |
239 | // Add click listener for compile button. |
|
308 | $('#compile-script').on('click', function (e) { |
240 | $('#script-kiddie-compile-script').on('click', function (e) { |
|
309 | if($('#compile-script').hasClass("activity-image")) |
241 | if($('#script-kiddie-compile-script').hasClass("activity-image")) |
|
Line 310... | Line 242... | |||
310 | return; |
242 | return; |
|
311 | |
243 | |
|
312 | var data = editor.getSession().getValue(); |
244 | var data = editor.getSession().getValue(); |
|
313 | compile(data, (success) => {}); |
245 | compile(data, (success) => {}); |
|
314 | if($('#store-script').prop('checked') === true) |
246 | if($('#script-kiddie-store-script').prop('checked') === true) |
|
Line 315... | Line 247... | |||
315 | store(data); |
247 | store(data); |
|
316 | }); |
248 | }); |
|
317 | |
249 | |
|
318 | // Add click listener for tidy button. |
250 | // Add click listener for tidy button. |
|
Line 319... | Line 251... | |||
319 | $('#tidy-script').on('click', function (e) { |
251 | $('#script-kiddie-tidy-script').on('click', function (e) { |
|
320 | if($('#compile-script').hasClass("activity-image")) |
252 | if($('#script-kiddie-compile-script').hasClass("activity-image")) |
|
321 | return; |
253 | return; |
|
Line 355... | Line 287... | |||
355 | type: 'POST', |
287 | type: 'POST', |
|
356 | url: '/', |
288 | url: '/', |
|
357 | data: { |
289 | data: { |
|
358 | command: 'give', |
290 | command: 'give', |
|
359 | entity: 'avatar', |
291 | entity: 'avatar', |
|
360 | item: $('#script-UUID').val(), |
292 | item: $('#script-kiddie-script-UUID').val(), |
|
361 | firstname: firstname, |
293 | firstname: firstname, |
|
362 | lastname: lastname, |
294 | lastname: lastname, |
|
363 | permissions: 'c--mvt------------c--mvtc--mvt' |
295 | permissions: 'c--mvt------------c--mvtc--mvt' |
|
364 | }, |
296 | }, |
|
365 | dataType: 'json' |
297 | dataType: 'json' |
|
Line 367... | Line 299... | |||
367 | callback(response); |
299 | callback(response); |
|
368 | }); |
300 | }); |
|
369 | } |
301 | } |
|
Line 370... | Line 302... | |||
370 | |
302 | |
|
371 | // Add click listener for give button. |
303 | // Add click listener for give button. |
|
372 | $('#give-script').on('click', function (e) { |
304 | $('#script-kiddie-give-script').on('click', function (e) { |
|
373 | if($('#compile-script').hasClass("activity-image")) |
305 | if($('#script-kiddie-compile-script').hasClass("activity-image")) |
|
Line 374... | Line 306... | |||
374 | return; |
306 | return; |
|
375 | |
307 | |
|
376 | // Show the popup. |
308 | // Show the popup. |
|
Line 377... | Line 309... | |||
377 | $('#avatar-select').modal('show'); |
309 | $('#script-kiddie-avatar-select').modal('show'); |
|
378 | }); |
310 | }); |
|
379 | |
311 | |
|
380 | // Add click listener to modal confirmation. |
312 | // Add click listener to modal confirmation. |
|
Line 381... | Line 313... | |||
381 | $('#send-script').on('click', function(e) { |
313 | $('#script-kiddie-send-script').on('click', function(e) { |
|
382 | // Hide the popup. |
314 | // Hide the popup. |
|
383 | $('#avatar-select').modal('hide'); |
315 | $('#script-kiddie-avatar-select').modal('hide'); |
|
384 | |
316 | |
|
385 | // Disable give button. |
317 | // Disable give button. |
|
386 | $('#give-script').attr('disabled', true); |
318 | $('#script-kiddie-give-script').attr('disabled', true); |
|
387 | give($('#avatar-firstname').val(), $('#avatar-lastname').val(), (response) => { |
319 | give($('#script-kiddie-avatar-firstname').val(), $('#script-kiddie-avatar-lastname').val(), (response) => { |
|
Line 388... | Line 320... | |||
388 | // Enable give button. |
320 | // Enable give button. |
|
389 | $('#give-script').attr('disabled', false); |
321 | $('#script-kiddie-give-script').attr('disabled', false); |
|
Line 396... | Line 328... | |||
396 | }); |
328 | }); |
|
Line 397... | Line 329... | |||
397 | |
329 | |
|
398 | // Get the item name from the storage. |
330 | // Get the item name from the storage. |
|
399 | var storeScriptUUID = localStorage.getItem('nucleus-script-kiddie-script-UUID'); |
331 | var storeScriptUUID = localStorage.getItem('nucleus-script-kiddie-script-UUID'); |
|
400 | if (typeof storeScriptUUID == "string") |
332 | if (typeof storeScriptUUID == "string") |
|
Line 401... | Line 333... | |||
401 | $('#script-UUID').val(storeScriptUUID); |
333 | $('#script-kiddie-script-UUID').val(storeScriptUUID); |
|
402 | |
334 | |
|
403 | // Get the item name from the storage. |
335 | // Get the item name from the storage. |
|
404 | var storeScriptName = localStorage.getItem('nucleus-script-kiddie-script-name'); |
336 | var storeScriptName = localStorage.getItem('nucleus-script-kiddie-script-name'); |
|
Line 405... | Line 337... | |||
405 | if (typeof storeScriptName == "string") |
337 | if (typeof storeScriptName == "string") |
|
406 | $('#script-name').val(storeScriptName); |
338 | $('#script-kiddie-script-name').val(storeScriptName); |
|
407 | |
339 | |
|
408 | // Store script name on modification. |
340 | // Store script name on modification. |
|
409 | var scriptNameTimerID; |
341 | var scriptNameTimerID; |
|
Line 410... | Line 342... | |||
410 | $('#script-name').on('input',function(e){ |
342 | $('#script-kiddie-script-name').on('input',function(e){ |
|
411 | var value = $(this).val(); |
343 | var value = $(this).val(); |
|
Line 419... | Line 351... | |||
419 | },500); |
351 | },500); |
|
420 | }; |
352 | }; |
|
421 | }); |
353 | }); |
|
Line 422... | Line 354... | |||
422 | |
354 | |
|
423 | // Enable storing of script only if the form validates. |
355 | // Enable storing of script only if the form validates. |
|
424 | $('#script-tools').on('validated.bs.validator', function (e) { |
356 | $('#script-kiddie-script-tools').on('validated.bs.validator', function (e) { |
|
425 | if($('#script-tools').has('.has-error').length !== 0) { |
357 | if($('#script-kiddie-script-tools').has('.has-error').length !== 0) { |
|
426 | $('#store-script').bootstrapToggle('off'); |
358 | $('#script-kiddie-store-script').bootstrapToggle('off'); |
|
427 | $('#store-script').bootstrapToggle('disable'); |
359 | $('#script-kiddie-store-script').bootstrapToggle('disable'); |
|
428 | return; |
360 | return; |
|
429 | } |
361 | } |
|
430 | $('#store-script').bootstrapToggle('enable'); |
362 | $('#script-kiddie-store-script').bootstrapToggle('enable'); |
|
Line 431... | Line 363... | |||
431 | }); |
363 | }); |
|
432 | |
364 | |
|
433 | $('#store-script').change(function() { |
365 | $('#script-kiddie-store-script').change(function() { |
|
434 | switch($('#store-script').prop('checked')) |
366 | switch($('#script-kiddie-store-script').prop('checked')) |
|
435 | { |
367 | { |
|
436 | case true: |
368 | case true: |
|
437 | // Disable script name and UUID. |
369 | // Disable script name and UUID. |
|
Line 438... | Line 370... | |||
438 | $('#script-name').attr('disabled', true); |
370 | $('#script-kiddie-script-name').attr('disabled', true); |
|
439 | $('#script-UUID').attr('disabled', true); |
371 | $('#script-kiddie-script-UUID').attr('disabled', true); |
|
440 | |
372 | |
|
Line 441... | Line 373... | |||
441 | var data = editor.getSession().getValue(); |
373 | var data = editor.getSession().getValue(); |
|
442 | // Store locally on save. |
374 | // Store locally on save. |
|
443 | localStorage.setItem('nucleus-script-kiddie-script-body', data); |
375 | localStorage.setItem('nucleus-script-kiddie-script-body', data); |
|
444 | |
376 | |
|
445 | $('#give-script').attr('disabled', true); |
377 | $('#script-kiddie-give-script').attr('disabled', true); |
|
446 | compile(data, (success) => { |
378 | compile(data, (success) => { |
|
447 | store(data, (success) => { |
379 | store(data, (success) => { |
|
448 | // Script was stored successfully. |
380 | // Script was stored successfully. |
|
449 | // Enable the give button. |
381 | // Enable the give button. |
|
450 | $('#give-script').attr('disabled', false); |
382 | $('#script-kiddie-give-script').attr('disabled', false); |
|
451 | }); |
383 | }); |
|
452 | }); |
384 | }); |
|
453 | break; |
385 | break; |
|
Line 454... | Line 386... | |||
454 | default: |
386 | default: |
|
455 | // Enable script name and UUID. |
387 | // Enable script name and UUID. |
|
456 | $('#script-name').attr('disabled', false); |
388 | $('#script-kiddie-script-name').attr('disabled', false); |
|
457 | $('#script-UUID').attr('disabled', false); |
389 | $('#script-kiddie-script-UUID').attr('disabled', false); |
|
458 | |
390 | |
|
Line 459... | Line 391... | |||
459 | // Disable the give button. |
391 | // Disable the give button. |
|
460 | $('#give-script').attr('disabled', true); |
392 | $('#script-kiddie-give-script').attr('disabled', true); |
|
461 | break; |
- | ||
462 | } |
393 | break; |