im playing around with deepsource
This commit is contained in:
parent
f70128f4fc
commit
a12300efe2
1 changed files with 28 additions and 23 deletions
|
@ -138,7 +138,7 @@ function popup(type, action, text) {
|
|||
function changeSwitcher(li, b) {
|
||||
if (b) {
|
||||
sSet(li, b);
|
||||
for (i in switchers[li]) {
|
||||
for (let i in switchers[li]) {
|
||||
(switchers[li][i] == b) ? enable(`${li}-${b}`) : disable(`${li}-${switchers[li][i]}`)
|
||||
}
|
||||
if (li == "theme") detectColorScheme();
|
||||
|
@ -146,7 +146,7 @@ function changeSwitcher(li, b) {
|
|||
let pref = switchers[li][0];
|
||||
if (isIOS && exceptions[li]) pref = exceptions[li];
|
||||
sSet(li, pref);
|
||||
for (i in switchers[li]) {
|
||||
for (let i in switchers[li]) {
|
||||
(switchers[li][i] == pref) ? enable(`${li}-${pref}`) : disable(`${li}-${switchers[li][i]}`)
|
||||
}
|
||||
}
|
||||
|
@ -165,6 +165,26 @@ function checkbox(action) {
|
|||
if (action == "alwaysVisibleButton") button();
|
||||
}
|
||||
}
|
||||
function updateToggle(toggle, state) {
|
||||
switch(state) {
|
||||
case "true":
|
||||
eid(toggle).innerHTML = loc.toggleAudio;
|
||||
break;
|
||||
case "false":
|
||||
eid(toggle).innerHTML = sGet(`${toggle}ToggledOnce`) == "true" ? loc.toggleDefault : loc.pressToChange + loc.toggleDefault;
|
||||
break;
|
||||
}
|
||||
}
|
||||
function toggle(toggle) {
|
||||
let state = sGet(toggle);
|
||||
if (state) {
|
||||
sSet(toggle, opposite(state))
|
||||
if (opposite(state) == "true") sSet(`${toggle}ToggledOnce`, "true");
|
||||
} else {
|
||||
sSet(toggle, "false")
|
||||
}
|
||||
updateToggle(toggle, sGet(toggle))
|
||||
}
|
||||
function loadSettings() {
|
||||
if (sGet("alwaysVisibleButton") == "true") {
|
||||
eid("alwaysVisibleButton").checked = true;
|
||||
|
@ -185,26 +205,6 @@ function loadSettings() {
|
|||
changeSwitcher(i, sGet(i))
|
||||
}
|
||||
}
|
||||
function toggle(toggle) {
|
||||
let state = sGet(toggle);
|
||||
if (state) {
|
||||
sSet(toggle, opposite(state))
|
||||
if (opposite(state) == "true") sSet(`${toggle}ToggledOnce`, "true");
|
||||
} else {
|
||||
sSet(toggle, "false")
|
||||
}
|
||||
updateToggle(toggle, sGet(toggle))
|
||||
}
|
||||
function updateToggle(toggle, state) {
|
||||
switch(state) {
|
||||
case "true":
|
||||
eid(toggle).innerHTML = loc.toggleAudio;
|
||||
break;
|
||||
case "false":
|
||||
eid(toggle).innerHTML = sGet(`${toggle}ToggledOnce`) == "true" ? loc.toggleDefault : loc.pressToChange + loc.toggleDefault;
|
||||
break;
|
||||
}
|
||||
}
|
||||
async function download(url) {
|
||||
changeDownloadButton(2, '...');
|
||||
eid("url-input-area").disabled = true;
|
||||
|
@ -256,6 +256,11 @@ async function download(url) {
|
|||
}
|
||||
}).catch((error) => internetError());
|
||||
break;
|
||||
default:
|
||||
eid("url-input-area").disabled = false
|
||||
changeDownloadButton(2, '!!')
|
||||
popup("error", 1, loc.noURLReturned);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
eid("url-input-area").disabled = false
|
||||
|
@ -283,7 +288,7 @@ window.onload = () => {
|
|||
}
|
||||
if (isIOS) sSet("downloadPopup", "true");
|
||||
let urlQuery = new URLSearchParams(window.location.search).get("u");
|
||||
if (urlQuery != null) {
|
||||
if (urlQuery !== null) {
|
||||
eid("url-input-area").value = urlQuery;
|
||||
button();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue