Skip to content

Commit

Permalink
Avoid useless custom functions on login screen
Browse files Browse the repository at this point in the history
  • Loading branch information
niemes committed May 14, 2024
1 parent 0b0ca5f commit 4430246
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions custom_portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,25 @@ init_portal = async function()
init_portal_original();

// Don't wait if logged
if (document.body.className.indexOf("logged") == -1) document.body.style.opacity = 1.0;

window.openApp = (link) => window.open(link, "_blank");
if (config.customIcons) await addAppsLogo()
if (config.customAvatars) await useCustomAvatar()

// links
let footerNav = 'div.ynh-wrapper:nth-child(3) > nav:nth-child(1)'
var target = document.getElementsByClassName('user')[0];
target.id = "user"

let mainNav = document.querySelector(footerNav)
let clonedMenu = mainNav.cloneNode(true);
clonedMenu.id = "mainmenu"

target.appendChild(clonedMenu);
mainNav.remove()
if (document.body.className.indexOf("logged") == -1) {
document.body.style.opacity = 1.0;
} else { // handle custom UI only if logged
window.openApp = (link) => window.open(link, "_blank");
if (config.customIcons) await addAppsLogo()
if (config.customAvatars) await useCustomAvatar()

// links menu
let footerNav = 'div.ynh-wrapper:nth-child(3) > nav:nth-child(1)'
var target = document.getElementsByClassName('user')[0];
target.id = "user"

let mainNav = document.querySelector(footerNav)
let clonedMenu = mainNav.cloneNode(true);
clonedMenu.id = "mainmenu"

target.appendChild(clonedMenu);
mainNav.remove()
}

document.body.style.opacity = 1.0;
}
Expand Down

0 comments on commit 4430246

Please sign in to comment.