-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings-display.html
370 lines (364 loc) · 15.3 KB
/
settings-display.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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link rel="shortcut icon" href="images/Settings.png" type="image/x-icon">
<link rel="stylesheet" href="mdui-v1.0.1/css/mdui.min.css">
<script src="mdui-v1.0.1/js/mdui.min.js"></script>
<title>显示</title>
<style>
html {
transition-property: opacity, transform;
transition: .3s;
animation-name: slideIn;
animation-duration: .3s;
}
@keyframes slideIn {
from {
transform: translateX(50%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
</style>
</head>
<body class="mdui-theme-primary-blue-grey mdui-theme-accent-blue mdui-appbar-with-toolbar">
<div class="mdui-appbar mdui-appbar-fixed">
<div class="mdui-toolbar mdui-color-theme">
<a class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" onclick="javascript:openPage('settings.html');">
<i class="mdui-icon material-icons">arrow_back</i>
</a>
<a class="mdui-typo-title">显示</a>
</div>
</div>
<ul class="mdui-list mdui-center" style="max-width: 640px;">
<li class="mdui-list-item mdui-ripple" mdui-dialog="{target: '#brightness'}">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title">亮度</div>
</div>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple" mdui-dialog="{target: '#wallpaper'}">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title">壁纸</div>
</div>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content">深色主题</div>
<label class="mdui-switch">
<input type="checkbox" onclick="javascript:darkTheme();" id="darkTheme" />
<i class="mdui-switch-icon mdui-text-color-theme"></i>
</label>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title">颜色反转</div>
<div class="mdui-list-item-text">可能会影响性能</div>
</div>
<label class="mdui-switch">
<input type="checkbox" onclick="javascript:invert();" id="invert" />
<i class="mdui-switch-icon mdui-text-color-theme"></i>
</label>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title">灰度</div>
<div class="mdui-list-item-text">可能会影响性能</div>
</div>
<label class="mdui-switch">
<input type="checkbox" onclick="javascript:grayscale();" id="grayscale" />
<i class="mdui-switch-icon mdui-text-color-theme"></i>
</label>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content">状态栏时间显示秒</div>
<label class="mdui-switch">
<input type="checkbox" onclick="javascript:displaySeconds();" id="displaySeconds" />
<i class="mdui-switch-icon mdui-text-color-theme"></i>
</label>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content">状态栏显示电池电量</div>
<label class="mdui-switch">
<input type="checkbox" onclick="javascript:displayBatteryLevel();" id="displayBatteryLevel" />
<i class="mdui-switch-icon mdui-text-color-theme"></i>
</label>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content">Dock 栏背景透明</div>
<label class="mdui-switch">
<input type="checkbox" onclick="javascript:transparentDockBar();" id="transparentDockBar" />
<i class="mdui-switch-icon mdui-text-color-theme"></i>
</label>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple" onclick="javascript:rfs();">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title">全屏显示</div>
</div>
</li>
<li class="mdui-divider mdui-m-y-0"></li>
<li class="mdui-list-item mdui-ripple" onclick="javascript:ef();">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title">退出全屏</div>
</div>
</li>
</ul>
<div class="mdui-dialog" id="brightness">
<div class="mdui-dialog-title">亮度</div>
<div class="mdui-dialog-content">
<label class="mdui-slider">
<input type="range" step="0.1" min="10" max="100" id="brightnessValue" value="100" />
</label>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-close>完成</button>
</div>
</div>
<div class="mdui-dialog" id="wallpaper">
<div class="mdui-dialog-title">壁纸</div>
<div class="mdui-dialog-content">
<ul class="mdui-list">
<li class="mdui-list-item mdui-ripple" onclick="javascript:setWallpaper('images/wallpaper.jpg');">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title" mdui-dialog-close>默认</div>
</div>
</li>
<li class="mdui-list-item mdui-ripple" onclick="javascript:setWallpaper('http://饭太硬.top/深色壁纸/api.php');">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title" mdui-dialog-close>随机壁纸 API</div>
</div>
</li>
<li class="mdui-list-item mdui-ripple" onclick="javascript:setWallpaper('https://t.mwm.moe/pc/');">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title" mdui-dialog-close>二次元 API</div>
</div>
</li>
<li class="mdui-list-item mdui-ripple" mdui-dialog="{target: '#customWallpaper'}">
<div class="mdui-list-item-content">
<div class="mdui-list-item-title" mdui-dialog-close>自定义</div>
</div>
</li>
</ul>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-close>取消</button>
</div>
</div>
<div class="mdui-dialog" id="customWallpaper">
<div class="mdui-dialog-title">自定义壁纸</div>
<div class="mdui-dialog-content">
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">URL</label>
<input class="mdui-textfield-input" type="url" id="wallpaperInput" />
<div class="mdui-textfield-error">URL 格式错误</div>
</div>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" onclick="javascript:setWallpaper(document.getElementById('wallpaperInput').value);" id="setCustomWallpaper" mdui-dialog-close>完成</button>
</div>
</div>
<script>
//函数:页面跳转
function openPage(url) {
document.documentElement.style.transform = "translateX(-50%)";
document.documentElement.style.opacity = 0;
window.setTimeout(function() {
location.href = url;
}, 300);
}
//获取深色主题设置
if (localStorage.getItem("darkTheme") == "true") {
document.body.classList.add("mdui-theme-layout-dark");
document.getElementById("darkTheme").checked = true;
postScript(function() {
gebi("statusBar").style.background = "#212121";
});
} else {
postScript(function() {
gebi("statusBar").style.background = "#455A64";
});
}
//函数:设置深色主题
function darkTheme() {
if (localStorage.getItem("darkTheme") == "true") {
localStorage.setItem("darkTheme", "false");
document.body.classList.remove("mdui-theme-layout-dark");
postScript(function() {
gebi("statusBar").style.background = "#455A64";
});
} else {
localStorage.setItem("darkTheme", "true");
document.body.classList.add("mdui-theme-layout-dark");
document.body.classList.add("mdui-theme-layout-dark");
postScript(function() {
gebi("statusBar").style.background = "#212121";
});
}
}
//颜色反转设置
if (localStorage.getItem("invert") == 1) {
document.getElementById("invert").checked = true;
}
//函数:设置颜色反转
function invert() {
if (localStorage.getItem("invert") == 1) {
localStorage.setItem("invert", 0);
postScript(function() {
getInvert();
});
} else {
localStorage.setItem("invert", 1);
postScript(function() {
getInvert();
});
}
}
//灰度设置
if (localStorage.getItem("grayscale") == 1) {
document.getElementById("grayscale").checked = true;
}
//函数:设置灰度
function grayscale() {
if (localStorage.getItem("grayscale") == 1) {
localStorage.setItem("grayscale", 0);
postScript(function() {
getGrayscale();
});
} else {
localStorage.setItem("grayscale", 1);
postScript(function() {
getGrayscale();
});
}
}
//获取状态栏时间显示设置
if (localStorage.getItem("displaySeconds") == 1) {
document.getElementById("displaySeconds").checked = true;
}
//函数:设置状态栏时间是否显示秒
function displaySeconds() {
if (localStorage.getItem("displaySeconds") == 1) {
localStorage.setItem("displaySeconds", 0);
} else {
localStorage.setItem("displaySeconds", 1);
}
}
//获取电池电量显示设置
if (localStorage.getItem("displayBatteryLevel") == 1) {
document.getElementById("displayBatteryLevel").checked = true;
}
//函数:设置状态栏是否显示电池电量
function displayBatteryLevel() {
if (localStorage.getItem("displayBatteryLevel") == 1) {
localStorage.setItem("displayBatteryLevel", 0);
postScript(function() {
getBatteryInfo();
});
} else {
localStorage.setItem("displayBatteryLevel", 1);
postScript(function() {
getBatteryInfo();
});
}
}
//事件:亮度滑块值改变
document.getElementById("brightnessValue").addEventListener("input", function() {
localStorage.setItem("brightness", (this.value / 100));
postScript(function() {
getBrightness();
});
});
//获取屏幕亮度设置
document.getElementById("brightnessValue").value = localStorage.getItem("brightness") * 100;
//接入 API:执行 JavaScript 脚本
function postScript(script) {
var scriptStr = script.toString();
var postData = {
"type": "JavaScript",
"script": scriptStr
};
window.parent.postMessage(JSON.stringify(postData), "/");
}
//接入 API:发送 Toast
function postToast(message) {
var postData = {
"type": "toast",
"message": message
};
window.parent.postMessage(JSON.stringify(postData), "/");
}
//接入 API:发送通知
function postNotification(icon, title, content, clickFunc) {
var clickFuncStr = clickFunc.toString();
var postData = {
"type": "notification",
"icon": icon,
"title": title,
"content": content,
"clickFunc": clickFuncStr
};
window.parent.postMessage(JSON.stringify(postData), "/");
}
//函数:设置壁纸
function setWallpaper(url) {
localStorage.setItem("wallpaper", url);
postScript(function() {
getWallpaper();
});
postToast("壁纸已设置");
}
//事件:对话框打开完成
document.getElementById("customWallpaper").addEventListener("opened.mdui.dialog", function() {
document.getElementById("wallpaperInput").value = "https://";
document.getElementById("wallpaperInput").focus();
});
//获取 Dock 栏设置
if (localStorage.getItem("transparentDockBar") == 1) {
document.getElementById("transparentDockBar").checked = true;
}
//函数:设置 Dock 栏是否透明
function transparentDockBar() {
if (localStorage.getItem("transparentDockBar") == 1) {
localStorage.setItem("transparentDockBar", 0);
postScript(function() {
getDockBarInfo();
});
} else {
localStorage.setItem("transparentDockBar", 1);
postScript(function() {
getDockBarInfo();
});
}
}
//函数:全屏显示与退出全屏
function rfs() {
postNotification(`<i class="mdui-list-item-avatar mdui-icon material-icons mdui-color-blue-grey mdui-text-color-white">fullscreen</i>`, "全屏显示", "点按此通知以请求全屏显示", function() {
requestFullScreen(document.documentElement);
})
}
function ef() {
postScript(function() {
exitFull();
});
}
//事件:在文本框中按下回车键
document.getElementById("wallpaperInput").addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
document.getElementById("setCustomWallpaper").click();
}
});
</script>
</body>
</html>