feat: Refactor fullscreen toggle and theme initialization in JavaScript, and refine fullscreen CSS styling for improved appearance.
This commit is contained in:
@@ -1144,12 +1144,20 @@ html[theme="f0ck95d"] .admin-search button {
|
||||
}
|
||||
|
||||
/* fullscreen */
|
||||
html[res="fullscreen"] ._204863 {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
html[res="fullscreen"] .metadata {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
html[res="fullscreen"] .embed-responsive-16by9::before {
|
||||
padding-top: 32.99%;
|
||||
}
|
||||
|
||||
html[res="fullscreen"] .container {
|
||||
max-width: 100% !important;
|
||||
max-width: 90% !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,7 @@ const Cookie = {
|
||||
const acttheme = Cookie.get('theme') ?? "w0bm";
|
||||
const themecontainer = document.querySelector("li#themes > ul.dropdown-menu");
|
||||
|
||||
if (!themecontainer) return; // Theme menu not present on this page
|
||||
|
||||
if (themecontainer) {
|
||||
const themes = [...themecontainer.querySelectorAll("li > a")].map(t => t.innerText.toLowerCase());
|
||||
if (acttheme !== document.documentElement.getAttribute("theme") && themes.includes(acttheme))
|
||||
document.documentElement.setAttribute("theme", acttheme);
|
||||
@@ -48,21 +47,24 @@ const Cookie = {
|
||||
// Cookie.set("theme", themes[i], { path: "/", days: 360 });
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
// Fullscreen toggle - runs regardless of theme menu presence
|
||||
document.addEventListener('click', e => {
|
||||
const tbuttonfull = e.target.closest('svg#a_tfull');
|
||||
if (!tbuttonfull) return;
|
||||
|
||||
if (tbuttonfull = document.querySelector('svg#a_tfull')) {
|
||||
tbuttonfull.addEventListener('click', e => {
|
||||
let f = Cookie.get('fullscreen');
|
||||
if (f == 1) {
|
||||
Cookie.set('fullscreen', 0);
|
||||
document.querySelector('html').setAttribute('res', '');
|
||||
document.documentElement.setAttribute('res', '');
|
||||
tbuttonfull.innerHTML = `<use href="/s/img/iconset.svg#window-maximize"></use>`;
|
||||
}
|
||||
else {
|
||||
Cookie.set('fullscreen', 1);
|
||||
document.querySelector('html').setAttribute('res', 'fullscreen');
|
||||
document.documentElement.setAttribute('res', 'fullscreen');
|
||||
tbuttonfull.innerHTML = `<use href="/s/img/iconset.svg#window-minimize"></use>`;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user