code quality changes

This commit is contained in:
murdle 2025-12-21 16:49:30 +02:00
parent e275b3da94
commit d8628004fb
2 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,5 @@
(function () {
const { CSS_CLASSES, GLOBAL_ENV } = window;
const { CSS_CLASSES, GLOBAL_ENV, IS_MOBILE } = window;
const BUTTON_ID = "rscord-settings-btn";
const CONTENT_CONTAINER_ID = "custom-content";
@ -218,7 +218,7 @@
document.body.addEventListener("click", (e) => {
const clickedHamburger = e.target.closest(`.${CSS_CLASSES.hamburger}`)
if (clickedHamburger && window.IS_MOBILE) {
if (clickedHamburger && IS_MOBILE) {
const settingsRegion = document.querySelector(`.${CSS_CLASSES.settingsRegion}`)
settingsRegion.classList.remove(CSS_CLASSES.hidden);
@ -246,7 +246,7 @@
child.style.display = "none";
}
if (window.IS_MOBILE) {
if (IS_MOBILE) {
const settingsRegion = document.querySelector(`.${CSS_CLASSES.settingsRegion}`)
settingsRegion.classList.add(CSS_CLASSES.hidden);

View File

@ -31,16 +31,14 @@
<script>
(function() {
window.GLOBAL_ENV = {};
window.__OVERLAY__ = /overlay/.test(location.pathname)
window.__BILLING_STANDALONE__ = /^\/billing/.test(location.pathname)
window.AUTH_TOKEN = null;
window.localStorage_ = localStorage;
window.IS_IOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
window.IS_MOBILE = window.matchMedia("(pointer: coarse)").matches;
window.IS_STANDALONE = window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === true;
window.AUTH_TOKEN = null;
window.localStorage_ = localStorage;
function protocolRelative(url) {
if (!url) return "";
return "//" + url.replace(/^https?:\/\//, "").replace(/\/$/, "");