More overall improvements

This commit is contained in:
Daniel
2023-01-16 00:22:31 +01:00
parent 6e6cf39e35
commit 6da6035e0a
6 changed files with 35 additions and 18 deletions
+10 -1
View File
@@ -63,7 +63,7 @@ function get_bool(key) {
}
function load_config(conf) {
CONFIG = JSON.parse(conf);
if (conf) CONFIG = JSON.parse(conf);
let ui = CONFIG.ui;
set("app-name", ui.name);
set("app-desc", ui.desc);
@@ -71,4 +71,13 @@ function load_config(conf) {
if (ui.hosted_by) set("app-hostedby", ui.hosted_by);
else get("app-hostedby").parentNode.style.display = "none";
load_apps();
switch_theme(get_bool("dark_mode"));
new_tab_toggle(get_bool("open_new_tab"));
}
function is_secure(uri) {
if (uri.includes("tp://")) return false;
if (!uri.startsWith("https://")) {
uri = location.href;
}
}
+9 -4
View File
@@ -6,7 +6,6 @@ function onload() {
for_all("back", (btn) => {
btn.onclick = show;
});
switch_theme(config("dark_mode") == "true");
setTimeout(() => {
show();
document.body.classList.remove("init");
@@ -59,14 +58,20 @@ function load_apps() {
get("applist").innerHTML = final;
}
function new_tab_toggle(setting) {
let v = !get_bool("open_new_tab");
function new_tab_toggle(value) {
let v = get_bool("open_new_tab");
if (value === undefined) v = !v;
config("open_new_tab", v);
setting = setting.classList;
setting = get("setting-newtab").classList;
v ? setting.add("checked") : setting.remove("checked");
load_apps();
}
function reset_all_settings() {
localStorage.clear();
load_config();
}
let S_TAP_LOCK;
function open_screen(button) {
if (S_TAP_LOCK) return;