-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
412 lines (387 loc) · 16.7 KB
/
index.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<html>
<head>
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<link rel="stylesheet" href="./lib/mdui/mdui.min.css" />
<link rel="icon" href="https://exlg.cc/img/logo.png" />
<script src="./lib/mdui/mdui.min.js"></script>
<script src="./lib/jquery/jquery.min.js"></script>
</head>
<body>
<style>
body {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
user-select: none;
background: rgba(0, 0, 0, 0);
}
#list {
width: 100%;
}
.card {
box-shadow: 0 0 20px rgb(0 0 0 / 15%);
transform: scale(0.6);
transition: all 0.6s;
opacity: 0;
border-radius: 10px;
position: absolute;
width: 80%;
height: 80%;
top: 10%;
left: 10%;
}
#logo {
display: inline-block;
width: calc(100% - 31px);
font-size: 20px;
font-weight: 400;
padding: 30px 10px 15px 30px;
margin: -8px;
background: rgb(245, 245, 245);
}
.l2 {
margin-left: -15px;
}
#mts {
transition: all 0.35s;
}
#ms {
height: 100%;
transition: all 0.3s;
display: none;
opacity: 0;
margin-top: 8px;
}
#description {
color: #8b8b8b;
font-size: 14px;
font-weight: 400;
margin-right: 20px;
display: inline-block;
margin-top: 5px;
float: right;
}
#mss {
margin-top: 8px;
transition: all 0.3s;
opacity: 0;
display: none;
width: 50%;
height: calc(100% - 68px);
background: #fdfdfd;
}
#ms {
overflow-y: scroll;
overflow-x: hidden;
}
.l1 {
background: #f9f9f9;
height: 100%;
margin-top: 8px;
}
label.mdui-checkbox {
float: right;
margin-right: 20px;
}
.mdui-slider {
position: relative;
display: inline-block;
float: right;
width: 55%;
margin-right: 20px;
height: 36px;
}
#mss {
padding-right: 0;
margin-right: 10px;
width: calc(66.6667% - 80px);
display: block;
}
.lss {
transition: all 0.3s;
opacity: 0;
margin-right: -20px;
}
.lla {
transition: all 0.3s;
}
</style>
<div class="mdui-card card">
<div id="list">
<p id="logo">Extend Luogu
<a id="description"></a>
</p>
<div class="mdui-row">
<div class="mdui-col-xs-4" id="mts">
<ul class="mdui-list l1">
</ul>
</div>
<div class="mdui-col-xs-4" id="ms" style="padding-bottom: 60px;">
<div class="mdui-list l2">
</div>
</div>
<div class="mdui-col-xs-1" id="mss"><br>
<div class="mdui-list l3">
</div>
</div>
</div>
</div>
</div>
<script>
var openCategory = -1;
var openModule = -1;
const extensible = '<i class="mdui-list-item-icon mdui-icon material-icons extensible-icon">more_horiz</i>';
function startOPED(sss, a) {
$("#mss").css("background", "rgba(0,0,0,0)");
setTimeout(function() {
$(sss).css("margin-right", "-50px");
$(sss).css("opacity", "0");
$(sss).css("heidth", "0");
setTimeout(function() {
$(sss).css("display", "none");
}, 290);
}, ((a + 1) * 100) - ((a / 4) * 100) * Math.abs((a / 10) - 1));
}
function guiStart(modules) {
window.modules = modules;
sto = window.exlg.sto ?? window.exlg.TM_dat.sto;
console.log(sto)
const lang = sto["@dash-board"].lang;
modules.forEach(function(cate) {
if (lang === "zh") {
[cate.name, cate.description] = [cate.description, cate.name];
}
cate.children.forEach(function(mod) {
if (lang === "zh") {
[mod.name, mod.description] = [mod.description, mod.name];
}
mod.enable = sto[mod.rawName].on;
mod.settings.forEach(function(set) {
if (set.description) {
let langId = ["en", "zh"].indexOf(lang);
[set.displayName, set.description[langId]] = [set.description[langId], set.displayName];
}
let msto = sto[mod.rawName], nm = set.name;
if (Array.isArray(set.name)) {
set.name.slice(0, -1).forEach(e => msto = msto[e]);
nm = set.name.at(-1);
}
set.Val = msto[nm];
if (set.type === "SELECTBOX") {
let datRoot = (window.exlg.scm ?? window.exlg.mod.data)[mod.rawName].lvs, nm = set.name;
if (Array.isArray(set.name)) {
nm = set.name.at(-1);
set.name.slice(0, -1).forEach(e => datRoot = datRoot[e].lvs);
}
if (datRoot[nm]?.get === "id")
set.Val = set.acceptableValues[set.Val];
}
})
})
})
$(".l1").mousedown(function(e) {
if (3 == e.which) {
openCategory = -1
openModule = -1
$("#mts .mdui-list-item-content").css("transform", "scale(1)");
setTimeout(function() {
$("#mts .mdui-list-item-content").css("display", "inline");
}, 200);
$("#mts .mdui-list-item-content").css("font-size", "16px");
$("#mts").css("width", "");
$("#ms").css("opacity", "0");
$("#ms").css("overflow-y", "none");
$("#ms").css("width", "0");
setTimeout(function() {
$("#ms").css("display", "none");
}, 230);
$(".lla").each(function(a) {
startOPED(this, a);
});
}
});
for (var i = 0; i < modules.length; i++) {
$('.l1').append('<li class="mdui-list-item mdui-ripple" MTtype="' + i + '" onclick="clickModuleT(-1,this)"><i class="mdui-list-item-icon mdui-icon material-icons">' + modules[i].icon + '</i><div class="mdui-list-item-content">' + modules[i].name + '</div></li>');
}
//渐显
setTimeout(function() {
$(".card").css("opacity", "1");
}, 100);
setTimeout(function() {
$(".card").css("transform", "scale(1)");
}, 100);
}
// guiStart(modules);
function add(a) {
$(document.body).append('<script>' + a + "<\/script>");
}
function rc(mt, i) {
mod = modules[mt].children[i];
if (mod.rawName[0] === '@' || mod.unclosable) return;
sto[mod.rawName].on = mod.enable = !mod.enable;
if (mod.enable) {
$('#M-' + modules[mt].name + "-" + mod.Name + ' div input').removeAttr("checked");
} else {
$('#M-' + modules[mt].name + "-" + mod.Name + ' div input').attr("checked", "true");
}
}
function opSettings(root, pth, val) {
if (typeof pth === "string") {
root[pth] = val;
} else {
pth.slice(0, -1).forEach(e => root = root[e]);
root[pth.at(-1)] = val;
}
}
function mssChange(a, mt, i, is) {
mod = modules[mt].children[i];
opSettings(sto[mod.rawName], mod.settings[is].name, String(a));
mod.settings[is].Val = a;
refresh(mt, i)
}
function mssBChange(a, mt, i, is) {
mod = modules[mt].children[i];
opSettings(sto[mod.rawName], mod.settings[is].name, Boolean(a.checked));
mod.settings[is].Val = a.checked;
refresh(mt, i)
}
function mssIChange(a, mt, i, is) {
mod = modules[mt].children[i];
var value = ~~a.value; // 浮点数去死吧
opSettings(sto[mod.rawName], mod.settings[is].name, value);
mod.settings[is].Val = a.value;
refresh(mt, i)
}
function mssTChange(value, mt, i, is) {
mod = modules[mt].children[i];
opSettings(sto[mod.rawName], mod.settings[is].name, String(value));
mod.settings[is].Val = value;
}
// 当模块Category被点击
function clickModuleT(mt, a) {
if (mt == -1 && a != undefined) {
mt = $(a).attr("MTtype")
}
openCategory = Number(mt)
$("#ms").css("opacity", "0");
const loadspeed = ("load_speed" in sto["@dash-board"]) ? sto["@dash-board"].load_speed : 10;
setTimeout(function() {
$('.l2').html("");
for (var i = 0; i < modules[mt].children.length; i++) {
const mod = modules[mt].children[i];
if (mod.Hide || mod.Hide == null) {
const isE = mod.enable ? "checked" : "";
const isC = (mod.rawName[0] === '@' || mod.unclosable) ? "disabled" : "";
const isEx = mod.settings.length > 0 ? extensible : "";
$('.l2').append('<label id="M-' + modules[mt].name + "-" + mod.name + '" class="lss mdui-list-item mdui-ripple" Mname="' + mod.name + '" Mtype="' + modules[mt].name + '"><div class="mdui-list-item-content">' + mod.name.replace(/_/g," ") + '</div>' + isEx + '<div class="mdui-checkbox"><input type="checkbox" ' + isE + " " + isC + '/><i class="mdui-checkbox-icon"></i></div></label>');
add('setTimeout(function(){$(\'#M-\'+modules[' + mt + '].name+"-"+modules[' + mt + '].children[' + i + '].name).css("opacity","1");$(\'#M-\'+modules[' + mt + '].name+"-"+modules[' + mt + '].children[' + i + '].name).css("margin-right","0");},' + ((i + 1) * 10 * loadspeed) + ');$(\'#M-\'+modules[' + mt + '].name+"-"+modules[' + mt + '].children[' + i + '].name).mouseenter(function(){mouseEventHandle(' + mt + ',' + i + ',true);}).mouseleave(function(){mouseEventHandle(' + mt + ',' + i + ',false);}).mousedown(function(e){if(3 == e.which){clickModule(' + mt + ',' + i + ');}else if(1 == e.which){rc(' + mt + ',' + i + ');}});');
}
}
$("#ms").css("width", "");
$("#mss").css("background", "#fdfdfd");
$("#ms").css("overflow-y", "scroll");
$("#mts .mdui-list-item-content").css("transform", "scale(0)");
$("#mts .mdui-list-item-content").css("font-size", "10");
setTimeout(function() {
$("#mts .mdui-list-item-content").css("display", "none");
}, 100);
$("#mts").css("width", "70px");
$("#ms").css("display", "block");
setTimeout(function() {
$("#ms").css("opacity", "1");
}, 23 * loadspeed);
}, 25 * loadspeed);
}
var overCount = 0
function mouseEventHandle(mt, i, isOver) {
if (isOver) {
overCount++
} else {
overCount--
}
if (overCount == 0) {
$("#description").html("")
} else {
$("#description").html(modules[mt].children[i].description)
}
}
function clickModule(mt, i) {
openModule = Number(i)
$("#mss").css("opacity", "0");
$("#mss").css("width", "calc(66.66% - 80px)");
$("#mss").css("display", "block");
setTimeout(function() {
$('.l3').html("");
for (var is = 0; is < modules[mt].children[i].settings.length; is++) {
if (modules[mt].children[i].settings[is].type == "SELECTBOX") {
var ops = '<option value="1">' + modules[mt].children[i].settings[is].Val + '</option>';
for (var aa = 0; aa < modules[mt].children[i].settings[is].acceptableValues.length; aa++) {
if (modules[mt].children[i].settings[is].Val != modules[mt].children[i].settings[is].acceptableValues[aa])
ops = ops + '<option value="' + (aa + 2) + '">' + modules[mt].children[i].settings[is].acceptableValues[aa] + '</option>';
}
$('.l3').append('<li class="lla"><div style="margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><select style="float: right;margin-right: 20px;display: inline-block;" class="mdui-select" onchange="mssChange(this.options[this.options.selectedIndex].text,' + mt + ',' + i + ',' + is + ')" mdui-select="{position: \'bottom\'}">' + ops + '</select></li>');
}
if (modules[mt].children[i].settings[is].type == "TEXTBOX") {
$('.l3').append('<li class="lla"><div style="position: relative;margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><div class="mdui-textfield" style="float: right;margin: 6px 20px 6px 15px;padding: 0;width: 50%;display: inline-block;"><input class="mdui-textfield-input" value="' + modules[mt].children[i].settings[is].Val + '" type="text" oninput="mssTChange($(this).val(),' + mt + ',' + i + ',' + is + ')"/></div></li>');
}
if (modules[mt].children[i].settings[is].type == "CHECKBOX") {
var isE = modules[mt].children[i].settings[is].Val ? 'checked' : "";
$('.l3').append('<li class="lla"><div style="margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><label class="mdui-checkbox"><input type="checkbox" onclick="mssBChange(this,' + mt + ',' + i + ',' + is + ')" ' + isE + '/><i class="mdui-checkbox-icon"></i></label></li>');
}
if (modules[mt].children[i].settings[is].type == "SLIDER") {
$('.l3').append('<li class="lla"><div style="margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><label class="mdui-slider mdui-slider-discrete"><input id="Int-' + mt + '-' + i + '-' + is + '" type="range" step="' + modules[mt].children[i].settings[is].increment + '" min="' + modules[mt].children[i].settings[is].minValue + '" max="' + modules[mt].children[i].settings[is].maxValue + '" onchange="mssIChange(this,' + mt + ',' + i + ',' + is + ')"/></label></li>');
$('#Int-' + mt + '-' + i + '-' + is)[0].value = modules[mt].children[i].settings[is].Val;
}
mdui.mutation();
}
$("#mss").css("opacity", "1");
}, 250);
}
function refresh(mt, i) {
openModule = Number(i)
modules[mt].children[i] = getDataJson(getModule(modules[mt].children[i].name))
$("#mss").css("width", "calc(66.66% - 80px)");
$("#mss").css("display", "block");
$('.l3').html("");
for (var is = 0; is < modules[mt].children[i].settings.length; is++) {
if (modules[mt].children[i].settings[is].isVisable()) {
if (modules[mt].children[i].settings[is].type == "SELECTBOX") {
var ops = '<option value="1">' + modules[mt].children[i].settings[is].Val + '</option>';
for (var aa = 0; aa < modules[mt].children[i].settings[is].acceptableValues.length; aa++) {
if (modules[mt].children[i].settings[is].Val != modules[mt].children[i].settings[is].acceptableValues[aa])
ops = ops + '<option value="' + (aa + 2) + '">' + modules[mt].children[i].settings[is].acceptableValues[aa] + '</option>';
}
$('.l3').append('<li class="lla"><div style="margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><select style="float: right;margin-right: 20px;display: inline-block;" class="mdui-select" onchange="mssChange(this.options[this.options.selectedIndex].text,' + mt + ',' + i + ',' + is + ')" mdui-select="{position: \'bottom\'}">' + ops + '</select></li>');
}
if (modules[mt].children[i].settings[is].type == "TEXTBOX") {
$('.l3').append('<li class="lla"><div style="position: relative;margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><div class="mdui-textfield" style="float: right;margin: 6px 20px 6px 15px;padding: 0;width: 50%;display: inline-block;"><input class="mdui-textfield-input" value="' + modules[mt].children[i].settings[is].Val + '" type="text"/></div></li>');
}
if (modules[mt].children[i].settings[is].type == "CHECKBOX") {
var isE = modules[mt].children[i].settings[is].Val ? 'checked' : "";
$('.l3').append('<li class="lla"><div style="margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><label class="mdui-checkbox"><input type="checkbox" onclick="mssBChange(this,' + mt + ',' + i + ',' + is + ')" ' + isE + '/><i class="mdui-checkbox-icon"></i></label></li>');
}
if (modules[mt].children[i].settings[is].type == "SLIDER") {
$('.l3').append('<li class="lla"><div style="margin-left: 15px;display: inline-block;" class="mdui-list-item-content">' + modules[mt].children[i].settings[is].displayName + '</div><label class="mdui-slider mdui-slider-discrete"><input id="Int-' + mt + '-' + i + '-' + is + '" type="range" step="' + modules[mt].children[i].settings[is].increment + '" min="' + modules[mt].children[i].settings[is].minValue + '" max="' + modules[mt].children[i].settings[is].maxValue + '" onchange="mssIChange(this,' + mt + ',' + i + ',' + is + ')"/></label></li>');
$('#Int-' + mt + '-' + i + '-' + is)[0].value = modules[mt].children[i].settings[is].Val;
}
mdui.mutation();
}
}
$("#mss").css("opacity", "1");
}
document.oncontextmenu = function(e) {
return false;
}
if (openCategory != -1) {
clickModuleT(openCategory)
if (openModule != -1) {
clickModule(openCategory, openModule)
}
}
</script>
<!--务必保留本段版权信息,FDP原创设计UI! Be sure to keep the copyright information of this paragraph, FDP original design UI!-->
</body>
</html>