You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
improve: JS code by matching with the standard
This commit improves the JS code by making compliant to the standard of PerformanC.
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
const button = document.getElementById('expand_clicker')
|
||||
const icon = document.getElementById('expand_clicker_icon')
|
||||
const card = document.getElementById('module_card')
|
||||
|
||||
let sys_module_mode = localStorage.getItem('system-module-mode')
|
||||
if (!sys_module_mode) sys_module_mode = setData('closed')
|
||||
|
||||
button.addEventListener("click", () => {
|
||||
if (sys_module_mode == "closed") {
|
||||
sys_module_mode = setData('opend')
|
||||
icon.style.transform = "rotate(180deg)"
|
||||
card.style.maxHeight = card.scrollHeight + "px";
|
||||
return
|
||||
icon.style.transform = 'rotate(180deg)'
|
||||
card.style.maxHeight = `${card.scrollHeight}px`
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sys_module_mode = setData('closed')
|
||||
icon.style.transform = "rotate(0deg)"
|
||||
card.style.maxHeight = null;
|
||||
return
|
||||
icon.style.transform = 'rotate(0deg)'
|
||||
card.style.maxHeight = null
|
||||
})
|
||||
|
||||
function setData(mode) {
|
||||
|
||||
@@ -2,10 +2,6 @@ import { fullScreen, exec, toast } from './kernelsu.js';
|
||||
|
||||
(async () => {
|
||||
const loading_screen = document.getElementsByClassName('loading_screen')[0]
|
||||
// Testing enviroment
|
||||
// setTimeout(() => {
|
||||
// loading_screen.style.display = 'none';
|
||||
// }, 3000)
|
||||
|
||||
fullScreen(true)
|
||||
|
||||
@@ -50,21 +46,21 @@ import { fullScreen, exec, toast } from './kernelsu.js';
|
||||
rezygisk_state.innerHTML = 'ReZygisk is fully functioning!'
|
||||
|
||||
rezygisk_settings.removeAttribute('style')
|
||||
rootCss.style.setProperty('--bright', '#3a4857');
|
||||
rootCss.style.setProperty('--bright', '#3a4857')
|
||||
rezygisk_icon_state.innerHTML = '<img class="brightc" src="assets/tick.svg">'
|
||||
} else {
|
||||
rezygisk_state.innerHTML = 'ReZygisk is partially functioning!'
|
||||
|
||||
rezygisk_settings.removeAttribute('style')
|
||||
rootCss.style.setProperty('--bright', '#ffd000');
|
||||
rootCss.style.setProperty('--bright', '#ffd000')
|
||||
rezygisk_icon_state.innerHTML = '<img class="brightc" src="assets/warn.svg">'
|
||||
}
|
||||
|
||||
const modules_card = document.getElementById('modules_card')
|
||||
const modules_list = document.getElementById('modules_list')
|
||||
|
||||
// For hiding loading screen
|
||||
loading_screen.style.display = 'none';
|
||||
/* INFO: This hides the throbber screen */
|
||||
loading_screen.style.display = 'none'
|
||||
|
||||
const findModulesCmd = await exec('find /data/adb/modules -type d -name zygisk -exec dirname {} \\;')
|
||||
|
||||
@@ -78,9 +74,11 @@ import { fullScreen, exec, toast } from './kernelsu.js';
|
||||
let index = 0
|
||||
for (const module of modules) {
|
||||
index += 1
|
||||
|
||||
const lsZygiskCmd = await exec(`ls ${module}/zygisk`)
|
||||
if (lsZygiskCmd.errno !== 0) {
|
||||
toast(`ls ${module}/zygisk error (${lsZygiskCmd.errno}): ${lsZygiskCmd.stderr}`)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -97,7 +95,7 @@ import { fullScreen, exec, toast } from './kernelsu.js';
|
||||
const name = lines.find(line => line.includes('name=')).split('=')[1]
|
||||
|
||||
modules_list.innerHTML +=
|
||||
`<div class="dimc ${index !== modules.length ? "spliter" : ""}" style="padding-top: 13px; padding-bottom: 13px;">
|
||||
`<div class="dimc ${index !== modules.length ? 'spliter' : ''}" style="padding-top: 13px; padding-bottom: 13px;">
|
||||
<div class="dimc" style="font-size: 1.1em;">${name}</div>
|
||||
<div class="dimc" style="font-size: 0.9em;">Arch: ${bitsUsed.join(' / ')}</div>
|
||||
</div>`
|
||||
|
||||
@@ -18,9 +18,11 @@ const light_settings_icon = `
|
||||
<path d="m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"/>
|
||||
</svg>
|
||||
`
|
||||
|
||||
const rootCss = document.querySelector(':root')
|
||||
const button = document.getElementById('theme-switcher')
|
||||
// Icon have to change color
|
||||
|
||||
/* INFO: Changes the icons to match the theme */
|
||||
const module_list_icon = document.getElementById('modules_list_icon')
|
||||
const expand_clicker = document.getElementById('expand_clicker_icon')
|
||||
const settings_icon = document.getElementById('setting_icon')
|
||||
@@ -35,7 +37,7 @@ button.addEventListener('click', () => {
|
||||
case 'dark': setLight(); break;
|
||||
case 'light': setDark(); break;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
function setDark() {
|
||||
rootCss.style.setProperty('--background', '#181c20')
|
||||
@@ -46,12 +48,13 @@ function setDark() {
|
||||
rootCss.style.setProperty('--icon', '#48565e')
|
||||
rootCss.style.setProperty('--icon-bc', '#313a3f')
|
||||
rootCss.style.setProperty('--button', 'var(--background)')
|
||||
|
||||
sys_theme = setData('dark')
|
||||
|
||||
settings_icon.innerHTML = '<img class="dimc" src="assets/settings.svg">'
|
||||
expand_clicker.innerHTML = '<img class="dimc" src="assets/expand.svg">'
|
||||
button.innerHTML = '<img src="assets/dark.svg">'
|
||||
module_list_icon.innerHTML = '<img class="dimc" src="assets/module.svg">'
|
||||
return
|
||||
}
|
||||
|
||||
function setLight() {
|
||||
@@ -63,15 +66,17 @@ function setLight() {
|
||||
rootCss.style.setProperty('--icon', '#acacac')
|
||||
rootCss.style.setProperty('--icon-bc', '#c9c9c9')
|
||||
rootCss.style.setProperty('--button', '#b3b3b3')
|
||||
|
||||
sys_theme = setData('light')
|
||||
|
||||
settings_icon.innerHTML = light_settings_icon
|
||||
expand_clicker.innerHTML = light_expand_icon
|
||||
button.innerHTML = light_icon
|
||||
module_list_icon.innerHTML = light_module_icon
|
||||
return
|
||||
}
|
||||
|
||||
function setData(mode) {
|
||||
localStorage.setItem('system-theme', mode)
|
||||
|
||||
return localStorage.getItem('system-theme')
|
||||
}
|
||||
Reference in New Issue
Block a user