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) {
|
function setImage(url) {
|
||||||
if (url) {
|
if (url) {
|
||||||
console.log("Setting background: " + 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
|
//Switch-based monkey patching router bullshit
|
||||||
let lastPath = null;
|
let lastPath = null;
|
||||||
function updateRot() {
|
function updateRot() {
|
||||||
let newPath = window.location.pathname;
|
try {
|
||||||
if (lastPath == newPath)
|
let newPath = window.location.pathname;
|
||||||
return;
|
if (lastPath == newPath)
|
||||||
lastPath = newPath;
|
return;
|
||||||
|
lastPath = newPath;
|
||||||
|
|
||||||
let pathSpl = newPath.split("/");
|
let pathSpl = newPath.split("/");
|
||||||
switch (pathSpl.length) {
|
switch (pathSpl.length) {
|
||||||
case 1:
|
case 1:
|
||||||
applyMainTheme(); //Root
|
applyMainTheme(); //Root
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
switch (pathSpl[1]) {
|
switch (pathSpl[1]) {
|
||||||
case "about":
|
case "about":
|
||||||
case "announcements":
|
case "announcements":
|
||||||
case "lists":
|
case "lists":
|
||||||
case "bookmarks":
|
case "bookmarks":
|
||||||
applyMainTheme();
|
applyMainTheme();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
applyUserTheme();
|
applyUserTheme();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
switch (pathSpl[1]) {
|
switch (pathSpl[1]) {
|
||||||
case "main":
|
case "main":
|
||||||
applyMainTheme(); //Main timelines
|
applyMainTheme(); //Main timelines
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "users":
|
case "users":
|
||||||
applyUserTheme();
|
applyUserTheme();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "notice":
|
case "notice":
|
||||||
//Continue playing
|
//Continue playing
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
applyMainTheme();
|
applyMainTheme();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
applyMainTheme();
|
applyMainTheme();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue