2023-01-29 16:51:58 +00:00
|
|
|
// Disable things that get in the way of smooth admin'ing
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
document.querySelectorAll("input[type='date']").forEach(e => e.setAttribute('type', 'text'));
|
|
|
|
});
|
2020-07-06 18:01:02 +00:00
|
|
|
|
2023-01-29 16:51:58 +00:00
|
|
|
// Navbar controls
|
2020-07-06 18:01:02 +00:00
|
|
|
var navHidden = false;
|
|
|
|
function toggleNav() {
|
|
|
|
if(navHidden) {
|
2023-12-30 13:47:33 +00:00
|
|
|
document.body.classList.remove('navHidden');
|
2023-12-26 02:36:51 +00:00
|
|
|
shm_cookie_set("ui-shownav", "true");
|
2020-07-06 18:01:02 +00:00
|
|
|
}
|
|
|
|
else {
|
2023-12-30 13:47:33 +00:00
|
|
|
document.body.classList.add('navHidden');
|
2023-12-26 02:36:51 +00:00
|
|
|
shm_cookie_set("ui-shownav", "false");
|
2020-07-06 18:01:02 +00:00
|
|
|
}
|
|
|
|
navHidden = !navHidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
2023-12-26 02:36:51 +00:00
|
|
|
if(shm_cookie_get("ui-shownav") === "false") {
|
2020-07-06 18:01:02 +00:00
|
|
|
toggleNav();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-01-29 16:51:58 +00:00
|
|
|
// Desktop mode toggle
|
2020-07-06 18:01:02 +00:00
|
|
|
var forceDesktop = false;
|
|
|
|
function toggleDesktop() {
|
|
|
|
if(forceDesktop) {
|
|
|
|
let viewport = document.querySelector("meta[name=viewport]");
|
|
|
|
viewport.setAttribute('content', 'width=512');
|
2023-12-26 02:36:51 +00:00
|
|
|
shm_cookie_set("ui-desktop", "false");
|
2020-07-06 18:01:02 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
let viewport = document.querySelector("meta[name=viewport]");
|
|
|
|
viewport.setAttribute('content', 'width=1024, initial-scale=0.4');
|
2023-12-26 02:36:51 +00:00
|
|
|
shm_cookie_set("ui-desktop", "true");
|
2020-07-06 18:01:02 +00:00
|
|
|
navHidden = true;
|
|
|
|
toggleNav();
|
|
|
|
}
|
|
|
|
forceDesktop = !forceDesktop;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
2023-12-26 02:36:51 +00:00
|
|
|
if(shm_cookie_get("ui-desktop") === "true") {
|
2020-07-06 18:01:02 +00:00
|
|
|
toggleDesktop();
|
|
|
|
}
|
|
|
|
});
|