fix pleroma FE crash cycling
This commit is contained in:
parent
1b37598723
commit
7184f11baa
1 changed files with 50 additions and 42 deletions
92
rot.js
92
rot.js
|
@ -71,7 +71,11 @@
|
|||
function setImage(url) {
|
||||
if (url) {
|
||||
console.log("Setting background: " + url);
|
||||
document.getElementById("app-loaded").style.setProperty("--body-background-image", "url(" + url + ")");
|
||||
let apploaded = document.getElementById("app-loaded");
|
||||
if (apploaded)
|
||||
apploaded.style.setProperty("--body-background-image", "url(" + url + ")");
|
||||
else
|
||||
console.log("Couldn't set background, app not yet loaded");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,55 +196,59 @@
|
|||
//Switch-based monkey patching router bullshit
|
||||
let lastPath = null;
|
||||
function updateRot() {
|
||||
let newPath = window.location.pathname;
|
||||
if (lastPath == newPath)
|
||||
return;
|
||||
lastPath = newPath;
|
||||
try {
|
||||
let newPath = window.location.pathname;
|
||||
if (lastPath == newPath)
|
||||
return;
|
||||
lastPath = newPath;
|
||||
|
||||
let pathSpl = newPath.split("/");
|
||||
switch (pathSpl.length) {
|
||||
case 1:
|
||||
applyMainTheme(); //Root
|
||||
break;
|
||||
let pathSpl = newPath.split("/");
|
||||
switch (pathSpl.length) {
|
||||
case 1:
|
||||
applyMainTheme(); //Root
|
||||
break;
|
||||
|
||||
case 2:
|
||||
switch (pathSpl[1]) {
|
||||
case "about":
|
||||
case "announcements":
|
||||
case "lists":
|
||||
case "bookmarks":
|
||||
applyMainTheme();
|
||||
break;
|
||||
case 2:
|
||||
switch (pathSpl[1]) {
|
||||
case "about":
|
||||
case "announcements":
|
||||
case "lists":
|
||||
case "bookmarks":
|
||||
applyMainTheme();
|
||||
break;
|
||||
|
||||
default:
|
||||
applyUserTheme();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
applyUserTheme();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
switch (pathSpl[1]) {
|
||||
case "main":
|
||||
applyMainTheme(); //Main timelines
|
||||
break;
|
||||
case 3:
|
||||
switch (pathSpl[1]) {
|
||||
case "main":
|
||||
applyMainTheme(); //Main timelines
|
||||
break;
|
||||
|
||||
case "users":
|
||||
applyUserTheme();
|
||||
break;
|
||||
case "users":
|
||||
applyUserTheme();
|
||||
break;
|
||||
|
||||
case "notice":
|
||||
//Continue playing
|
||||
break;
|
||||
case "notice":
|
||||
//Continue playing
|
||||
break;
|
||||
|
||||
default:
|
||||
applyMainTheme();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
applyMainTheme();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
applyMainTheme();
|
||||
break;
|
||||
default:
|
||||
applyMainTheme();
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue