diff --git a/src/randomization.mjs b/src/randomization.mjs index fc2e3d22..39120257 100644 --- a/src/randomization.mjs +++ b/src/randomization.mjs @@ -11,13 +11,12 @@ export { insertText, paintSource, tryReadFile }; // stringOrFunctionToGenerateNewText); */ const insertText = (lis, str, newText) => { -// The lis argument should be a list of strings containing placeholders. -// This will put other relevant argument types, like a string, into a list. - lis = [].concat(lis); - let position; -// Loop through each of the placeholder strings. - for (let placeholder of lis) { + +// The lis argument should be a list of strings containing placeholders. +// Ensure lis is formatted as a list, and loop through each of the +// placeholder strings. + for (let placeholder of [].concat(lis)) { // Find all matches of a placeholder string and insert new text there. while ((position = str.indexOf(placeholder)) >= 0) str = str.slice(0, position) diff --git a/views/assets/css/styles-1644738239.css b/views/assets/css/styles-1644738239.css index 1cd2ea2e..b481110a 100644 --- a/views/assets/css/styles-1644738239.css +++ b/views/assets/css/styles-1644738239.css @@ -1016,7 +1016,7 @@ details[open] summary { height: 100%; background-color: var(--nord1); overflow: hidden; - display: block; + display: none; z-index: 1; } diff --git a/views/assets/js/csel.js b/views/assets/js/csel.js index 38998167..e459aa74 100644 --- a/views/assets/js/csel.js +++ b/views/assets/js/csel.js @@ -4,133 +4,104 @@ /* Settings Menu /* ----------------------------------------------- */ -(function() { + let date = new Date(); date.setFullYear(date.getFullYear() + 100); date = date.toUTCString(); - let csel = document.getElementById("csel"); + const setCookie = (name, value) => { + document.cookie = name + `=${encodeURIComponent(value)}; expires=${date}; SameSite=None; Secure`; + }; - function setCookie(name, value) { - document.cookie = name + "=" + encodeURIComponent(value) + "; expires=" + date + "; "; - } - - function removeCookie(name) { + const removeCookie = name => { document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT; "; - } + }; - async function readCookie(name) { - let cookie = document.cookie.split("; "); - let cookies = {}; - for (let i = 0; i < cookie.length; i++) { - let p = cookie[i].split("="); - cookies[p[0]] = p[1]; - } - return decodeURIComponent(cookies[name]); - } + const readCookie = async name => { + for (let cookie of document.cookie.split("; ")) + if (!cookie.indexOf(name + "=")) + return decodeURIComponent(cookie.slice(name.length + 1)); + }; - function pageTitle(value) { + const pageTitle = value => { let tag = document.getElementsByTagName("title")[0] || document.createElement("title"); tag.innerHTML = value; document.head.appendChild(tag); } - function pageIcon(value) { + const pageIcon = value => { let tag = document.querySelector("link[rel*='icon']") || document.createElement("link"); tag.rel = "icon"; tag.href = value; document.head.appendChild(tag); } - function setTitle(value) { - pageTitle(value); - setCookie("HBTitle", value); - } - - function setIcon(value) { - pageIcon(value); - setCookie("HBIcon", value); - } function pageHideAds() { - document.querySelectorAll(".ad").forEach(n => n.style.display = "none"); + (document.getElementById('advertising')||new Text()).remove(); } function pageShowAds() { - document.querySelectorAll(".ad").forEach(n => n.style.display = "block"); + let advertising = document.createElement('style'); + advertising.id = "advertising"; + advertising.innerText = `.ad { display:block; }`; + document.appendChild.bind(document.head || document.body || document.documentElement || document)(advertising); } - function hideAds() { - pageHideAds(); - setCookie("HBHideAds", "true"); - } + readCookie("HBTitle").then(s => (s != undefined) && pageTitle(s)); + readCookie("HBIcon").then(s => (s != undefined) && pageIcon(s)); - // Ghetto Default Disable Ads - setCookie("HBHideAds", "true"); + readCookie("HBHideAds").then(s => (s != "false") ? pageHideAds() : pageShowAds((document.getElementById("hideads") || {}).checked = 0)); - function showAds() { - pageShowAds(); - removeCookie("HBHideAds"); - } - - readCookie("HBTitle").then(s => (s != "undefined") && pageTitle(s)); - readCookie("HBIcon").then(s => (s != "undefined") && pageIcon(s)); - - readCookie("HBHideAds").then(s => (s != "undefined") && (function() { pageHideAds(); (document.getElementById("hideads") || {}).checked = "true"; })()); - - if (csel) { - csel.innerHTML = -decodeURIComponent(atob("JTNDcCUyMGNsYXNzJTNEJTIyY3NlbHRpdGxlJTIyJTNFVGFiJTIwQ2xvYWslM0MlMkZwJTNFJTBBJTNDcCUyMGNsYXNzJTNEJTIyY3NlbGxhYmVsJTIyJTNFQ2hhbmdlJTIwdGhlJTIwdGl0bGUlM0ElM0MlMkZwJTNFJTBB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hc3MlM0QlMjJjc2VsYnV0dG9uJTIyJTIwdHlwZSUzRCUyMmJ1dHRvbiUyMiUyMHZhbHVlJTNEJTIyYWJvdXQlM0FibGFuayUyMiUzRSUwQSUzQ3AlMjBjbGFzcyUzRCUyMmNzZWxsYWJlbCUyMiUzRSUwQSUyMCUyMCUyMCUyMCUzQ2lucHV0JTIwaWQlM0QlMjJoaWRlYWRzJTIyJTIwdHlwZSUzRCUyMmNoZWNrYm94JTIyJTNFJTBBJTIwJTIwJTIwJTIwJTNDc3BhbiUzRUhpZGUlMjBBZHMlM0MlMkZzcGFuJTNFJTBBJTNDJTJGcCUzRSUwQSUzQ3AlM0VBZHMlMjBoZWxwJTIwc3VwcG9ydCUyMEglMjYlMjMxNzMlM0JvJTI2JTIzMTczJTNCbHklMjBVJTI2JTIzMTczJTNCbmIlMjYlMjMxNzMlM0Jsb2NrJTI2JTIzMTczJTNCZXIhJTNDJTJGcCUzRQ==")); - document.getElementById("titleform").addEventListener("submit", function(e) { + if (document.getElementById('csel')) { + document.getElementById("titleform").addEventListener("submit", e => { e.preventDefault(); - if (this.firstElementChild.value) { - setTitle(this.firstElementChild.value); - this.firstElementChild.value = ""; + e = this.firstElementChild; + if (e.value) { + pageTitle(e.value); + setCookie("HBTitle", e.value); + e.value = ""; } else { alert("Please provide a title."); } }, false); - document.getElementById("iconform").addEventListener("submit", function(e) { + document.getElementById("iconform").addEventListener("submit", e => { e.preventDefault(); - if (this.firstElementChild.value) { - setIcon(this.firstElementChild.value); - this.firstElementChild.value = ""; + e = this.firstElementChild; + if (e.value) { + pageIcon(e.value); + setCookie("HBIcon", e.value); + e.value = ""; } else { alert("Please provide an icon URL."); } }, false); - document.getElementById("cselreset").addEventListener("click", function() { + document.getElementById("cselreset").addEventListener("click", () => { if (confirm("Reset the title and icon to default?")) { removeCookie("HBTitle"); removeCookie("HBIcon"); - pageTitle("H­o­ly Un­blo­ck­er"); + pageTitle("Holy Unblocker"); pageIcon("assets/img/icon.png"); } }, false); - document.getElementById("cselab").addEventListener("click", function () { - var win = window.open() - var url = `${window.location.href}` - var iframe = win.document.createElement('iframe') - iframe.style.width = "100%"; - iframe.style.height = "100%"; - iframe.style.border = "none"; - iframe.style.overflow = "hidden"; - iframe.style.margin = "0"; - iframe.style.padding = "0"; - iframe.style.position = "fixed"; - iframe.style.top = "0"; - iframe.style.bottom = "0"; - iframe.style.left = "0"; - iframe.style.right = "0"; - iframe.src = url; - win.document.body.appendChild(iframe) + document.getElementById("cselab").addEventListener("click", () => { + let win = window.open(); + let iframe = win.document.createElement('iframe'); + iframe.style = "width: 100%; height: 100%; border: none; overflow: hidden; margin: 0; padding: 0; position: fixed; top: 0; left: 0"; + iframe.src = location.href; + win.document.body.appendChild(iframe); }); - document.getElementById("hideads").addEventListener("change", function(e) { - e.target.checked ? hideAds() : showAds(); + document.getElementById("hideads").addEventListener("change", e => { + if (e.target.checked) { + pageHideAds(); + setCookie("HBHideAds", "true"); + } else { + pageShowAds(); + setCookie("HBHideAds", "false"); + } }, false); - } -})(); \ No newline at end of file + } \ No newline at end of file diff --git a/views/pages/misc/deobf/settings.html b/views/pages/misc/deobf/settings.html index ca9bfa34..d4e8a032 100644 --- a/views/pages/misc/deobf/settings.html +++ b/views/pages/misc/deobf/settings.html @@ -1,16 +1,16 @@ -

Tab Cloak

-

Change the title:

-
- +

Tab Cloak

+

Change the title:

+ +
-

Change the icon:

-
- +

Change the icon:

+ +
- - -

- + + +

+ Hide Ads

Ads are disabled forever.

\ No newline at end of file