forked from quandz24-ui/OriginWEB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloading.js
More file actions
372 lines (344 loc) · 15.4 KB
/
Copy pathloading.js
File metadata and controls
372 lines (344 loc) · 15.4 KB
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
window.addEventListener("DOMContentLoaded", async () => {
{
const now = new Date();
const day = now.getDate();
const month = now.getMonth();
//if (month === 0 && day >= 1 && day <= 3) {
// addNotification(
// "https://quandz24-ui.github.io/OriginWEB/originData/iconPacks/origin_icon/calendar.png",
// "calendar",
// "Happy New Year " + now.getFullYear() + "! 🎉🎉🎉",
// "app_none4"
// );
// }
}
// === hình nền đã lưu ===
const wallpaperLock = localStorage.getItem("wallpaperLock");
if (wallpaperLock) {
document.documentElement.style.setProperty("--bg-wallpaperLock", wallpaperLock);
}
const wallpaperHome = localStorage.getItem("wallpaperHome");
if (wallpaperHome) {
document.documentElement.style.setProperty("--bg-wallpaperHome", wallpaperHome);
}
// === tên thiết bị đã lưu ===
document.getElementById("rightBigTextNameDeviceInAbout").textContent =
localStorage.getItem("rightBigTextNameDeviceInAbout") || "Click to rename";
document.getElementById("phoneName").textContent = localStorage.getItem("phoneName") || "Click to rename";
// === lấy các thông tin trong phần giới thiệu (ứng dụng cài đặt) ===
let totalUsed = 0;
for (let key in localStorage) {
if (localStorage.hasOwnProperty(key)) {
let value = localStorage.getItem(key);
totalUsed += key.length + (value ? value.length : 0);
}
}
let totalBytes = 5 * 1024 * 1024;
let usedBytes = totalUsed;
if (!isNaN(totalBytes) && !isNaN(usedBytes)) {
document.getElementById("storage").textContent = formatSize(totalBytes);
document.getElementById("storageUsed").textContent = formatSize(usedBytes);
}
if ("hardwareConcurrency" in navigator) {
const cores = navigator.hardwareConcurrency;
document.getElementById("CPUCore").textContent = cores + " cores";
} else {
document.getElementById("CPUCore").textContent = "Not supported";
}
// === Lấy thông tin GPU qua WebGL ===
function getGPUInfo() {
const canvas = document.createElement("canvas");
const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
if (!gl) {
return "WebGL not supported";
}
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
if (debugInfo) {
const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
return renderer;
} else {
return "Unavailable";
}
}
const gpu = getGPUInfo();
document.getElementById("GPU").textContent = gpu;
document.getElementById("nameBrowser").textContent = navigator.userAgent;
// === màn hình chào mừng khi lần đầu vào OriginWEB hoặc phiên bản mới ===
if (localStorage.getItem("version") !== "2000") {
if (localStorage.getItem("version") == null) {
addNotification(
"https://quandz24-ui.github.io/OriginWEB/originData/iconPacks/origin_icon/system_settings.png",
"OriginWEB",
"Welcome to OriginWEB V2.0.00 for the first time",
"app_settings"
);
} else
addNotification(
"https://quandz24-ui.github.io/OriginWEB/originData/iconPacks/origin_icon/system_settings.png",
"OriginWEB",
"Welcome to OriginWEB V2.0.00",
"app_settings"
);
localStorage.setItem("version", "2000");
}
// load clock app
loadHTMLInto("#app_clock .appDisplay", "https://quandz24-ui.github.io/OriginWEB/appData/app_clock/html/html.html");
loadHTMLInto("#app_calculator .appDisplay", ".https://quandz24-ui.github.io/OriginWEB/appData/app_calculator/html/html.html");
// === các function cần khi mở web ===
loadAppLayout();
cleanupEmptyScreens();
buildDots();
updateAppPositions(() => {
setTimeout(() => {
const loadingScreen = document.querySelector(".loadingScreen");
loadingScreen.animate([{opacity: 1}, {opacity: 0}], {
duration: 800,
easing: "ease",
fill: "forwards",
}).onfinish = () => {
loadingScreen.remove();
};
}, 1500);
});
// openEditorHomeScreen();
//showLockScreen();
if (doubleTapOnOff) {
lockScreen.addEventListener("click", powerOff2TapLockScreen);
//scrollAppScreen.addEventListener("click", powerOff2TapHomeScreen);
}
scrollAppScreen.scrollBy({left: -10, behavior: "smooth"});
//openApp(document.querySelector('[data-app="app_settings"]'));
setTimeout(() => {
unlockAnimWA();
}, 500);
// load from localstorage
{
// load dark mode
if (localStorage.getItem("darkMode") == "1") {
const element = document.getElementById("toggleDarkMode");
element.classList.add("active");
document.documentElement.style.setProperty("--bg-itemBackground", "#171717");
document.documentElement.style.setProperty("--bg-appbackground", "#000");
document.documentElement.style.setProperty("--bg-color", "white");
} else {
const element = document.getElementById("toggleDarkMode");
element.classList.remove("active");
document.documentElement.style.setProperty("--bg-itemBackground", "#fff");
document.documentElement.style.setProperty("--bg-appbackground", "#eaeaea");
document.documentElement.style.setProperty("--bg-color", "#000");
}
}
{
// load doubleTapOnOff
if (localStorage.getItem("doubleTapOnOff") == "0") {
const element = document.getElementById("toggle_doubleTapOnOff");
element.classList.remove("active");
doubleTapOnOff = 0;
}
}
{
// load hide icon text
if (localStorage.getItem("hideIconText") == "1") {
const element = document.getElementById("toggle_hideIconText");
element.classList.add("active");
phone.classList.add("hideIconText");
}
}
{
// load lock clock editor css variable
const lockClockTranslate = localStorage.getItem("lockClockPosition");
document.documentElement.style.setProperty("--bg-lockClockTranslate", lockClockTranslate);
const el = document.querySelector(".lockContent.preview");
if (lockClockTranslate) {
let [x, y] = lockClockTranslate.split(" ");
x = parseFloat(x);
y = parseFloat(y);
el._currentX = x;
el._currentY = y;
el.style.translate = `${x}px ${y}px`;
document.documentElement.style.setProperty("--bg-lockClockTranslate", `${x}px ${y}px`);
} else {
el._currentX = 0;
el._currentY = 0;
}
// load scale lock clock content
const scaleLockContent = localStorage.getItem("scaleLockContent");
document.documentElement.style.setProperty("--bg-scaleLockContent", scaleLockContent);
const scaleLockClockValue = document.getElementById("scaleLockClockValue");
const scaleLockClockSlider = document.getElementById("scaleLockClockSlider");
if (scaleLockClockSlider) {
scaleLockClockSlider.value = scaleLockContent;
}
if (scaleLockClockValue) {
scaleLockClockValue.textContent = parseFloat(scaleLockContent).toFixed(2);
}
}
{
// load font weight lock clock
const fontWeightLockClock = localStorage.getItem("fontWeightLockClock");
document.documentElement.style.setProperty("--bg-fontWeightLockClock", fontWeightLockClock);
const fontClockWeightValue = document.getElementById("fontClockWeightValue");
const fontClockWeightSlider = document.getElementById("fontClockWeightSlider");
if (fontClockWeightSlider) {
fontClockWeightSlider.value = fontWeightLockClock;
}
if (fontClockWeightValue) {
fontClockWeightValue.textContent = fontWeightLockClock;
}
}
{
// load color button medium wallpaper
const urlImg = getComputedStyle(document.documentElement)
.getPropertyValue("--bg-wallpaperLock")
.trim()
.replace(/url\(["']?(.*?)["']?\)/, "$1");
colorMediumImg(urlImg).then((color) => {
const finalColor = darkerOrBrighterColor(color, 0.5);
document.getElementById("colorMediumWallpaperButton").style.backgroundColor = color;
originColorWallpaperLock = color;
darkerColorWallpaperLock = finalColor;
wallpaperLockColorPre.style.cssText = `background: linear-gradient( ${darkerColorWallpaperLock}, ${originColorWallpaperLock});`;
wallpaperOnStyle();
});
}
{
// load color lock clock
const colorLockClock = localStorage.getItem("colorLockClock");
document.documentElement.style.setProperty("--bg-colorLockClock", colorLockClock);
const colorCircles = document.querySelectorAll("#app_SettingsAppLockEditor .colorCircle");
colorCircles.forEach((colorCircle) => {
if (colorCircle.style.backgroundColor === colorLockClock) {
colorCircle.classList.add("active");
}
});
}
{
// load font lock clock
const fontLockClock = localStorage.getItem("fontLockClock");
document.documentElement.style.setProperty("--bg-fontLockClock", fontLockClock);
const allFontCircle = document.querySelectorAll("#app_SettingsAppLockEditor .fontCircle");
allFontCircle.forEach((fontCircle) => {
if (fontCircle.style.fontFamily === fontLockClock) {
fontCircle.classList.add("active");
}
});
}
{
// load opacity lock clock
const opacityLockClock = localStorage.getItem("opacityLockClock");
document.documentElement.style.setProperty("--bg-opacityLockClock", opacityLockClock);
const opacityLockClockValue = document.getElementById("opacityLockClockValue");
const opacityLockClockSlider = document.getElementById("opacityLockClockSlider");
if (opacityLockClockSlider) opacityLockClockSlider.value = parseFloat(opacityLockClock);
if (opacityLockClockValue) opacityLockClockValue.textContent = Math.round(parseFloat(opacityLockClock)) + "%";
}
{
// load opacity lock clock
const liquidOpacity = localStorage.getItem("liquidOpacity");
document.documentElement.style.setProperty("--bg-liquidOpacity", liquidOpacity);
const opacityLockClockSlider = document.getElementById("inputRangeLiquidOpacity");
if (opacityLockClockSlider) opacityLockClockSlider.value = parseFloat(liquidOpacity);
}
{
// camera btn saved
const item = localStorage.getItem("appcamerabtn");
if (item) {
cameraBtn.dataset.appcamerabtn = item;
const activeItem = document.querySelector(`[data-appforcamerabtn='${item}']`);
if (activeItem) activeItem.classList.add("active");
document
.querySelector("#app_SettingsAppActionBtn .box .borderPhonePre .buttonPreview svg path")
.setAttribute("d", activeItem.dataset.path);
}
}
{
// phone color
document.documentElement.style.setProperty(
"--bg-phoneColor",
localStorage.getItem("colorPhone") ? localStorage.getItem("colorPhone") : "rgb(221, 221, 221)"
);
}
{
// turn blur off
if (localStorage.getItem("turnBlurOff") == "1") {
document.getElementById("blurAllApp").classList.add("displayN");
document.getElementById("toggle_turnBlurOff").classList.remove("active");
}
}
{
// phone shadow saved
if (localStorage.getItem("togglePhoneShadow") == "1") {
phone.classList.add("phoneShadow");
document.getElementById("togglePhoneShadow").classList.add("active");
}
}
{
// aod style saved
const aodStyle = localStorage.getItem("aodStyle");
if (aodStyle) {
const activeItem = document.querySelector(`[data-style='${aodStyle}']`);
if (activeItem) activeItem.classList.add("active");
currentWallpaperOffStyle = allWallpaperOffStyle[aodStyle];
}
}
{
// turn off aod
if (localStorage.getItem("turnAodOff") == "1") {
{
// toggle AOD on/off
const el = document.getElementById("toggle_turnAodOff");
el.classList.remove("active");
phone.classList.add("aodOff");
if (currentWallpaperOnStyle === allWallpaperOnStyle[1]) {
currentWallpaperOffStyle = allWallpaperOffStyle[1];
} else {
currentWallpaperOffStyle = allWallpaperOffStyle[2];
}
document.querySelector("#app_SettingsAppAOD .horizontalScroll").classList.add("notWork");
}
}
}
{
// load unlock animation
const unlockAnimation = localStorage.getItem("unlockAnimation");
if (unlockAnimation) {
changeUnlockAnimStyle(unlockAnimation);
const selectUnlockAnimation = document.querySelector(
"#app_SettingsAppAnimation .select[name='unlockAnimation']"
);
const selectBoxs = selectUnlockAnimation.querySelector(".selectBoxs");
selectBoxs.querySelector(".itemChild.active").classList.remove("active");
selectBoxs.querySelectorAll(".itemChild").forEach((item) => {
if (item.dataset.value === unlockAnimation) {
item.classList.add("active");
return;
}
});
}
}
{
// load liquid glass effect
if (localStorage.getItem("turnLiquidOff") == "1") {
const el = document.getElementById("toggle_turnLiquidOff");
el.classList.remove("active");
phone.classList.add("noLiquid");
document.querySelector(".settingsItem[notWorkBy='toggle_turnLiquidOff']").classList.add("notWork");
}
}
{
// fingerprint toggle
if (localStorage.getItem("fingerprint") == "1") {
const el = document.getElementById("toggle_fingerprint");
el.classList.add("active");
fingerBtn.classList.remove("displayN");
document.getElementById("fingerBtn2").classList.remove("displayN");
document.getElementById("ani_fingerprint").classList.remove("displayN");
}
}
document.getElementById("passwordIn4").textContent =
"password: " + (correctPassword !== "" ? correctPassword : "not set");
});
function formatSize(bytes) {
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + " KB";
return (bytes / 1024 / 1024).toFixed(2) + " MB";
}