From d937871cf65175ec8b044312c39ba96fcd7e71f4 Mon Sep 17 00:00:00 2001 From: GreenyDev Date: Thu, 13 Apr 2023 10:28:53 -0400 Subject: [PATCH] More themes, somewhat better application system --- public/resources/adjectives_surnames.json | 306 +++++++++++----------- public/resources/nebulaclock.js | 13 +- public/resources/nebulamain.js | 206 +++++---------- public/resources/options.js | 158 ----------- public/resources/preload.js | 33 +++ public/resources/stealthEngine.js | 26 +- public/resources/theme.js | 189 +++++++++++++ public/resources/v.js | 28 +- src/index.html | 29 +- src/options.html | 33 +-- 10 files changed, 499 insertions(+), 522 deletions(-) create mode 100644 public/resources/preload.js create mode 100644 public/resources/theme.js diff --git a/public/resources/adjectives_surnames.json b/public/resources/adjectives_surnames.json index b444bf5a..0a9f21f6 100644 --- a/public/resources/adjectives_surnames.json +++ b/public/resources/adjectives_surnames.json @@ -1,154 +1,154 @@ { - "adjectives": [ - "admiring", - "adoring", - "affectionate", - "agitated", - "amazing", - "angry", - "awesome", - "beautiful", - "blissful", - "bold", - "boring", - "brave", - "busy", - "charming", - "clever", - "cool", - "compassionate", - "competent", - "condescending", - "confident", - "cranky", - "crazy", - "dazzling", - "determined", - "distracted", - "dreamy", - "eager", - "ecstatic", - "elastic", - "elated", - "elegant", - "eloquent", - "epic", - "exciting", - "fervent", - "festive", - "flamboyant", - "focused", - "friendly", - "frosty", - "funny", - "gallant", - "gifted", - "goofy", - "gracious", - "great", - "happy", - "hardcore", - "heuristic", - "hopeful", - "hungry", - "infallible", - "inspiring", - "interesting", - "intelligent", - "jolly", - "jovial", - "keen", - "kind", - "laughing", - "loving", - "lucid", - "magical", - "mystifying", - "modest", - "musing", - "naughty", - "nervous", - "nice", - "nifty", - "nostalgic", - "objective", - "optimistic", - "peaceful", - "pedantic", - "pensive", - "practical", - "priceless", - "quirky", - "quizzical", - "recursing", - "relaxed", - "reverent", - "romantic", - "sad", - "serene", - "sharp", - "silly", - "sleepy", - "stoic", - "strange", - "stupefied", - "suspicious", - "sweet", - "tender", - "thirsty", - "trusting", - "unruffled", - "upbeat", - "vibrant", - "vigilant", - "vigorous", - "wizardly", - "wonderful", - "xenodochial", - "youthful", - "zealous", - "zen" - ], - "surnames": [ - "albattani", - "allen", - "almeida", - "antonelli", - "agnesi", - "archimedes", - "ardinghelli", - "aryabhata", - "austin", - "babbage", - "banach", - "banzai", - "bardeen", - "bartik", - "bassi", - "beaver", - "bell", - "benz", - "bhabha", - "bhaskara", - "black", - "blackburn", - "blackwell", - "bohr", - "booth", - "borg", - "bose", - "bouman", - "boyd", - "brahmagupta", - "brattain", - "brown", - "buck", - "burnell", - "cannon", - "carson", - "cartwright", - "carver", - "cerf", - "chandrasekhar" - ] -} \ No newline at end of file + "adjectives": [ + "admiring", + "adoring", + "affectionate", + "agitated", + "amazing", + "angry", + "awesome", + "beautiful", + "blissful", + "bold", + "boring", + "brave", + "busy", + "charming", + "clever", + "cool", + "compassionate", + "competent", + "condescending", + "confident", + "cranky", + "crazy", + "dazzling", + "determined", + "distracted", + "dreamy", + "eager", + "ecstatic", + "elastic", + "elated", + "elegant", + "eloquent", + "epic", + "exciting", + "fervent", + "festive", + "flamboyant", + "focused", + "friendly", + "frosty", + "funny", + "gallant", + "gifted", + "goofy", + "gracious", + "great", + "happy", + "hardcore", + "heuristic", + "hopeful", + "hungry", + "infallible", + "inspiring", + "interesting", + "intelligent", + "jolly", + "jovial", + "keen", + "kind", + "laughing", + "loving", + "lucid", + "magical", + "mystifying", + "modest", + "musing", + "naughty", + "nervous", + "nice", + "nifty", + "nostalgic", + "objective", + "optimistic", + "peaceful", + "pedantic", + "pensive", + "practical", + "priceless", + "quirky", + "quizzical", + "recursing", + "relaxed", + "reverent", + "romantic", + "sad", + "serene", + "sharp", + "silly", + "sleepy", + "stoic", + "strange", + "stupefied", + "suspicious", + "sweet", + "tender", + "thirsty", + "trusting", + "unruffled", + "upbeat", + "vibrant", + "vigilant", + "vigorous", + "wizardly", + "wonderful", + "xenodochial", + "youthful", + "zealous", + "zen" + ], + "surnames": [ + "albattani", + "allen", + "almeida", + "antonelli", + "agnesi", + "archimedes", + "ardinghelli", + "aryabhata", + "austin", + "babbage", + "banach", + "banzai", + "bardeen", + "bartik", + "bassi", + "beaver", + "bell", + "benz", + "bhabha", + "bhaskara", + "black", + "blackburn", + "blackwell", + "bohr", + "booth", + "borg", + "bose", + "bouman", + "boyd", + "brahmagupta", + "brattain", + "brown", + "buck", + "burnell", + "cannon", + "carson", + "cartwright", + "carver", + "cerf", + "chandrasekhar" + ] +} diff --git a/public/resources/nebulaclock.js b/public/resources/nebulaclock.js index c057816f..2cb7c6f8 100644 --- a/public/resources/nebulaclock.js +++ b/public/resources/nebulaclock.js @@ -33,17 +33,14 @@ function displayTime() { var mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0! var yyyy = today.getFullYear(); today = mm + "/" + dd + "/" + yyyy; - var time = - h + ":" + m; + var time = h + ":" + m; try { - document.getElementById("digitalClock").innerHTML = getDayName(today, "us-US") + ", " + time + " " + session + "."; - } catch { - - } - + document.getElementById("digitalClock").innerHTML = + getDayName(today, "us-US") + ", " + time + " " + session + "."; + } catch {} return time; } // initialize the time function -displayTime(); \ No newline at end of file +displayTime(); diff --git a/public/resources/nebulamain.js b/public/resources/nebulamain.js index 91d24e0f..38783a95 100644 --- a/public/resources/nebulamain.js +++ b/public/resources/nebulamain.js @@ -17,7 +17,8 @@ function closeNav() { } function setLoaderText() { - document.getElementById('connectorText').textContent = "connecting to service" + document.getElementById("connectorText").textContent = + "connecting to service"; const loader = document.getElementById("lpoader"); const loadConstructer = loader.style; @@ -26,38 +27,21 @@ function setLoaderText() { // Changing the text over multiple periods of time creates character, and aliveness (is that even a word?) setTimeout(() => { document.getElementById("connectorText").style.fontSize = "12px"; - document.getElementById("connectorText").textContent = "Due to high server load, this may take a while."; + document.getElementById("connectorText").textContent = + "Due to high server load, this may take a while."; }, 3200); setTimeout(() => { document.getElementById("connectorText").style.fontSize = "14px"; - document.getElementById("connectorText").textContent = "Hmmm.. Something isn't right.."; + document.getElementById("connectorText").textContent = + "Hmmm.. Something isn't right.."; }, 17000); } -window.stealthEngineLoaded = false; +window.stealthEngineLoaded = false; window.addEventListener("load", () => { // Register the service workers for Osana and Ultraviolet proxy protocols // This is a better method than registering onsubmit because this allows the ability to use proxied links on the main page. - const dbPromise = Ultraviolet.openDB("keyval-store", 1, { - upgrade(db) { - db.createObjectStore("keyval"); - } - }); - self.storage = { - async get(key) { - return (await dbPromise).get("keyval", key); - }, - - async set(key, val) { - console.log("please wait"); - return (await dbPromise).put("keyval", val, key); - }, - - async del(key) { - return (await dbPromise).delete("keyval", key); - } - }; navigator.serviceWorker.register("./sw.js", { scope: "/service/" @@ -84,8 +68,6 @@ window.addEventListener("load", () => { hasLoadedElement.style.display = "none"; document.body.appendChild(hasLoadedElement); - - inpbox.addEventListener("submit", (event) => { // Prevents the default event tasks event.preventDefault(); @@ -99,7 +81,9 @@ window.addEventListener("load", () => { event.preventDefault(); // Check if the service worker (commonly called SW) is registered if (typeof navigator.serviceWorker === "undefined") - alert("An error occured registering your service worker. Please contact support - discord.gg/unblocker"); + alert( + "An error occured registering your service worker. Please contact support - discord.gg/unblocker" + ); // if (proxy === "uv" || proxy === "osana") { // Re-register the service worker incase it failed to onload @@ -123,7 +107,9 @@ window.addEventListener("load", () => { if (window.stealthEngineLoaded !== false) { stealthEngine(redirectTo); } else { - console.error("Stealth Engine failed to load! Please contact support - discord.gg/unblocker") + console.error( + "Stealth Engine failed to load! Please contact support - discord.gg/unblocker" + ); } } else { setTimeout(() => { @@ -209,8 +195,6 @@ document.addEventListener("visibilitychange", handleTabLeave) }); } }); - - }); // Set the option @@ -219,49 +203,27 @@ if (localStorage.getItem("theme") == null) { localStorage.setItem("theme", "dark"); } -window.onload = function () { - changeCSS("--background-primary", localStorage.getItem("--background-primary")); - changeCSS("--navbar-color", localStorage.getItem("--navbar-color")); - changeCSS("--navbar-height", localStorage.getItem("--navbar-height")); - changeCSS("--navbar-text-color", localStorage.getItem("--navbar-text-color")); - changeCSS("--input-text-color", localStorage.getItem("--input-text-color")); - changeCSS("--input-placeholder-color", localStorage.getItem("--input-placeholder-color")); - changeCSS("--input-background-color", localStorage.getItem("--input-background-color")); - changeCSS("--input-border-color", localStorage.getItem("--input-border-color")); - changeCSS("--input-border-size", localStorage.getItem("--input-border-size")); - changeCSS("--navbar-link-color", localStorage.getItem("--navbar-link-color")); - changeCSS("--navbar-font", localStorage.getItem("--navbar-font")); - changeCSS("--navbar-logo-filter", localStorage.getItem("--navbar-logo-filter")); - changeCSS("--text-color-primary", localStorage.getItem("--text-color-primary")); -}; - -function changeCSS(variable, value, saveBool) { - document.documentElement.style.setProperty(variable, value); - - if (saveBool === true) { - saveCSS(variable, value); - } -} - -function saveCSS(variable, value) { - localStorage.setItem(variable, value); -} - // Extra logging for support function log() { setTimeout( console.log.bind( - console, "%cWelcome To Nebula", "background: #3F51B5;color:#FFF;padding:5px;border-radius: 5px;line-height: 26px; font-size:30px;" + console, + "%cWelcome To Nebula", + "background: #3F51B5;color:#FFF;padding:5px;border-radius: 5px;line-height: 26px; font-size:30px;" ) ); setTimeout( console.log.bind( - console, "%c If you are seeing this, Nebula's main script has succesfully loaded!", "background: green;color:#FFF;padding:5px;border-radius: 5px;line-height: 26px; font-size:12px;" + console, + "%c If you are seeing this, Nebula's main script has succesfully loaded!", + "background: green;color:#FFF;padding:5px;border-radius: 5px;line-height: 26px; font-size:12px;" ) ); setTimeout( console.log.bind( - console, "%cIf you encounter an error, contact our support team on discord. Copy and paste the information below and send it in the ticket", "background: red;color:#FFF;padding:5px;border-radius: 5px;line-height: 26px; font-size:12px;" + console, + "%cIf you encounter an error, contact our support team on discord. Copy and paste the information below and send it in the ticket", + "background: red;color:#FFF;padding:5px;border-radius: 5px;line-height: 26px; font-size:12px;" ) ); let online = navigator.onLine; @@ -288,59 +250,6 @@ function log() { ); } log(); -function switchTheme() { - var selecter = document.getElementById("themeSwitcher"); - var selectedOption = selecter.value; - if (selectedOption == "dark") { - changeCSS("--background-primary", "#191724", true); - changeCSS("--navbar-color", "#26233a", true); - changeCSS("--navbar-height", "60px", true); - changeCSS("--navbar-text-color", "#7967dd", true); - changeCSS("--input-text-color", "#e0def4", true); - changeCSS("--input-placeholder-color", "#6e6a86", true); - changeCSS("--input-background-color", "#1f1d2e", true); - changeCSS("--input-placeholder-color", "white", true); - changeCSS("--input-border-color", "#eb6f92", true); - changeCSS("--input-border-size", "1.3px", true); - changeCSS("--navbar-link-color", "#e0def4", true); - changeCSS("--navbar-font", '"Roboto"', true); - changeCSS("--navbar-logo-filter", "invert(0%)", true); - changeCSS("--text-color-primary", "#e0def4", true); - localStorage.setItem("theme", "dark"); - } - if (selectedOption == "light") { - changeCSS("--background-primary", "#d8d8d8", true); - changeCSS("--navbar-color", "#a2a2a2", true); - changeCSS("--navbar-height", "4em", true); - changeCSS("--navbar-text-color", "#000000", true); - changeCSS("--input-text-color", "#e0def4", true); - changeCSS("--input-placeholder-color", "white", true); - changeCSS("--input-background-color", "black", true); - changeCSS("--input-border-color", "#eb6f92", true); - changeCSS("--input-border-size", "1.3px", true); - changeCSS("--navbar-link-color", "#000000", true); - changeCSS("--navbar-font", '"Roboto"', true); - changeCSS("--navbar-logo-filter", "invert(30%)", true); - changeCSS("--text-color-primary", "#303030", true); - localStorage.setItem("theme", "light"); - } - if (selectedOption == 'custom') { - changeCSS('--background-primary', localStorage.getItem("--background-primary"), true) - changeCSS('--navbar-color', localStorage.getItem("--navbar-color"), true) - changeCSS('--navbar-height', localStorage.getItem("--navbar-height"), true) - changeCSS('--navbar-text-color', localStorage.getItem("--navbar-text-color"), true) - changeCSS('--input-text-color', localStorage.getItem("--input-text-color"), true) - changeCSS('--input-placeholder-color', localStorage.getItem("--input-placeholder-color"), true) - changeCSS('--input-background-color', localStorage.getItem("--input-background-color"), true) - changeCSS('--input-border-color', localStorage.getItem("--input-border-color"), true) - changeCSS('--input-border-size', localStorage.getItem("--input-border-size"), true) - changeCSS('--navbar-link-color', localStorage.getItem("--navbar-link-color"), true) - changeCSS('--navbar-font', localStorage.getItem("--navbar-font"), true) - changeCSS('--navbar-logo-filter', localStorage.getItem("--navbar-logo-filter"), true) - changeCSS('--text-color-primary', localStorage.getItem("--text-color-primary"), true) - localStorage.setItem('theme', 'custom') - } -} // Adjectives and surnames for a more advanced stealth engine. // Used together to generate random names for the tab name @@ -353,12 +262,10 @@ async function surnameAdjectivesData() { .then((data) => { adjectives = data.adjectives; surnames = data.surnames; - }) + }); } surnameAdjectivesData(); - - // Random number generator // Dependency of getRandomName function function getRandomNumber(min, max) { @@ -376,13 +283,6 @@ function getRandomName() { return randomName; } -// Check if the Browser variable is undefined -// This is unused as of now but it could be used for better cloaking in the future, specifically with activeTab -if (typeof browser === "undefined") { - var browser = chrome; -} -browser = chrome; - // Clickoff cloaking // This is used to cloak the tab when it is not active function handleTabLeave() { @@ -403,7 +303,8 @@ function handleTabLeave() { link.rel = "icon"; document.getElementsByTagName("head")[0].appendChild(link); } - link.href = "https://camo.githubusercontent.com/b565ae2e136e0ac6023e7099288a62382de7c2b8cdce86a8b90449b86649434c/68747470733a2f2f6e6562756c6170726f78792e6e6562756c612e62696f2f696d616765732f6c6f676f2e706e67"; + link.href = + "https://camo.githubusercontent.com/b565ae2e136e0ac6023e7099288a62382de7c2b8cdce86a8b90449b86649434c/68747470733a2f2f6e6562756c6170726f78792e6e6562756c612e62696f2f696d616765732f6c6f676f2e706e67"; } else { return false; } @@ -412,31 +313,44 @@ function handleTabLeave() { // Create and Add the event listener document.addEventListener("visibilitychange", handleTabLeave); -const stealthStored = localStorage.getItem('nogg') +const stealthStored = localStorage.getItem("nogg"); function link(_link) { if (stealthStored == "on") { - let inFrame - try { inFrame = window !== top } catch (e) { inFrame = true } + let inFrame; + try { + inFrame = window !== top; + } catch (e) { + inFrame = true; + } setTimeout(() => { if (!inFrame && !navigator.userAgent.includes("Firefox")) { - const popup = open("about:blank", "_blank") - if (!popup || popup.closed) { alert("Popups are disabled!") } else { - const doc = popup.document - const iframe = doc.createElement("iframe") - const style = iframe.style - const img = doc.createElement("link") - img.rel = "icon" - img.href = "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png" - doc.title = getRandomName() - var currentLink = _link.slice(0, _link.length - 1) - iframe.src = location.origin + "/service/go/" + __uv$config.encodeUrl(currentLink) - style.position = "fixed" - style.top = style.bottom = style.left = style.right = 0 - style.border = style.outline = "none" - style.width = style.height = "100%" - doc.body.appendChild(iframe) + const popup = open("about:blank", "_blank"); + if (!popup || popup.closed) { + alert("Popups are disabled!"); + } else { + const doc = popup.document; + const iframe = doc.createElement("iframe"); + const style = iframe.style; + const img = doc.createElement("link"); + img.rel = "icon"; + img.href = + "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png"; + doc.title = getRandomName(); + var currentLink = _link.slice(0, _link.length - 1); + iframe.src = + location.origin + + "/service/go/" + + __uv$config.encodeUrl(currentLink); + style.position = "fixed"; + style.top = style.bottom = style.left = style.right = 0; + style.border = style.outline = "none"; + style.width = style.height = "100%"; + doc.body.appendChild(iframe); } } - }, 200) - } else { location.href = "service/go/" + __uv$config.encodeUrl("https://radon.games/") } -} \ No newline at end of file + }, 200); + } else { + location.href = + "service/go/" + __uv$config.encodeUrl("https://radon.games/"); + } +} diff --git a/public/resources/options.js b/public/resources/options.js index 715e9ccf..7c7715d8 100644 --- a/public/resources/options.js +++ b/public/resources/options.js @@ -10,164 +10,6 @@ function switchProxy() { var storedChoice = localStorage.getItem("proxy"); console.log(selectedOption); } -function switchTheme() { - var selecter = document.getElementById("themeSwitcher"); - var selectedOption = selecter.value; - if (selectedOption == "dark") { - changeCSS("--background-primary", "#191724", true); - changeCSS("--navbar-color", "#26233a", true); - changeCSS("--navbar-height", "60px", true); - changeCSS("--navbar-text-color", "#7967dd", true); - changeCSS("--input-text-color", "#e0def4", true); - changeCSS("--input-placeholder-color", "#6e6a86", true); - changeCSS("--input-background-color", "#1f1d2e", true); - changeCSS("--input-placeholder-color", "white", true); - changeCSS("--input-border-color", "#eb6f92", true); - changeCSS("--input-border-size", "1.3px", true); - changeCSS("--navbar-link-color", "#e0def4", true); - changeCSS("--navbar-font", '"Roboto"', true); - changeCSS("--navbar-logo-filter", "invert(0%)", true); - changeCSS("--text-color-primary", "#e0def4", true); - localStorage.setItem("theme", "dark"); - } - if (selectedOption == "light") { - changeCSS("--background-primary", "#d8d8d8", true); - changeCSS("--navbar-color", "#a2a2a2", true); - changeCSS("--navbar-height", "4em", true); - changeCSS("--navbar-text-color", "#000000", true); - changeCSS("--input-text-color", "#e0def4", true); - changeCSS("--input-placeholder-color", "white", true); - changeCSS("--input-background-color", "black", true); - changeCSS("--input-border-color", "#eb6f92", true); - changeCSS("--input-border-size", "1.3px", true); - changeCSS("--navbar-link-color", "#000000", true); - changeCSS("--navbar-font", '"Roboto"', true); - changeCSS("--navbar-logo-filter", "invert(30%)", true); - changeCSS("--text-color-primary", "#303030", true); - localStorage.setItem("theme", "light"); - } - if (selectedOption == "custom") { - let startCustom = prompt( - "Would you like to have an interactive setup? Y/N", - "" - ); - if (startCustom == "Y" || startCustom == "y") { - alert( - "Welcome to the interactive setup. Please enter the following values. If you don't know what to enter, just press enter. They will default to Dark Mode." - ); - let background = prompt( - "Background color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #191724", - "" - ); - let navbar = prompt( - "Navbar color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #26233a", - "" - ); - let navbarHeight = prompt( - "Navbar height || Possible Types: ABSOLUTE: cm, mm, Q, in, pc, pt, px RELATIVE: em, ex, ch, rem, lh, rlh, vw, vh, vb, vi || Default Value: 60px", - "" - ); - let navbarText = prompt( - "Navbar text color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #7967dd", - "" - ); - let inputText = prompt( - "Input text color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #e0def4", - "" - ); - let inputPlaceholder = prompt( - "Input placeholder color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #6e6a86", - "" - ); - let inputBackground = prompt( - "Input background color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #1f1d2e", - "" - ); - let inputBorder = prompt( - "Input border color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #eb6f92", - "" - ); - let inputBorderSize = prompt( - "Input border size || Possible Types: ABSOLUTE: cm, mm, Q, in, pc, pt, px RELATIVE: em, ex, ch, rem, lh, rlh, vw, vh, vb, vi || Default Value: 1.3px", - "" - ); - let navbarFont = prompt( - 'Navbar font || Enter a default font name, custom ones will likely not work. || Default Value: "Roboto"', - "" - ); - let navbarLink = prompt( - "Navbar link color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #e0def4", - "" - ); - let navbarLogoFilter = prompt( - "Navbar logo filter || Adjust the NavBar-Logo-Filter. || Default Value: invert(0%)", - "" - ); - let textColorPrimary = prompt( - "Text color primary || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #e0def4", - "" - ); - localStorage.setItem("theme", "custom"); - changeCSS("--background-primary", background, true); - changeCSS("--navbar-color", navbar, true); - changeCSS("--navbar-height", navbarHeight, true); - changeCSS("--navbar-text-color", navbarText, true); - changeCSS("--input-text-color", inputText, true); - changeCSS("--input-placeholder-color", inputPlaceholder, true); - changeCSS("--input-background-color", inputBackground, true); - changeCSS("--input-border-color", inputBorder, true); - changeCSS("--input-border-size", inputBorderSize, true); - changeCSS("--navbar-link-color", navbarLink, true); - changeCSS("--navbar-font", navbarFont, true); - changeCSS("--navbar-logo-filter", navbarLogoFilter, true); - changeCSS("--text-color-primary", textColorPrimary, true); - } else { - alert("Non-Interactive Setup Not supported yet."); - } - } -} - -// onload event -window.onload = function () { - let background = localStorage.getItem("--background-primary"); - let navbar = localStorage.getItem("--navbar-color"); - let navbarHeight = localStorage.getItem("--navbar-height"); - let navbarText = localStorage.getItem("--navbar-text-color"); - let inputText = localStorage.getItem("--input-text-color"); - let inputPlaceholder = localStorage.getItem("--input-placeholder-color"); - let inputBackground = localStorage.getItem("--input-background-color"); - let inputBorder = localStorage.getItem("--input-border-color"); - let inputBorderSize = localStorage.getItem("--input-border-size"); - let navbarFont = localStorage.getItem("--navbar-font"); - let navbarLink = localStorage.getItem("--navbar-link-color"); - let navbarLogoFilter = localStorage.getItem("--navbar-logo-filter"); - let textColorPrimary = localStorage.getItem("--text-color-primary"); - changeCSS("--background-primary", background); - changeCSS("--navbar-color", navbar); - changeCSS("--navbar-height", navbarHeight); - changeCSS("--navbar-text-color", navbarText); - changeCSS("--input-text-color", inputText); - changeCSS("--input-placeholder-color", inputPlaceholder); - changeCSS("--input-background-color", inputBackground); - changeCSS("--input-border-color", inputBorder); - changeCSS("--input-border-size", inputBorderSize); - changeCSS("--navbar-link-color", navbarLink); - changeCSS("--navbar-font", navbarFont); - changeCSS("--navbar-logo-filter", navbarLogoFilter); - changeCSS("--text-color-primary", textColorPrimary); -}; - -function changeCSS(variable, value, saveBool) { - document.documentElement.style.setProperty(variable, value); - - if (saveBool === true) { - saveCSS(variable, value); - } -} - -function saveCSS(variable, value) { - localStorage.setItem(variable, value); -} function resetViews() { changeCSS("--background-primary", "#191724", true); diff --git a/public/resources/preload.js b/public/resources/preload.js new file mode 100644 index 00000000..b504d266 --- /dev/null +++ b/public/resources/preload.js @@ -0,0 +1,33 @@ +window.onload = function () { + changeCSS( + "--background-primary", + localStorage.getItem("--background-primary") + ); + changeCSS("--navbar-color", localStorage.getItem("--navbar-color")); + changeCSS("--navbar-height", localStorage.getItem("--navbar-height")); + changeCSS("--navbar-text-color", localStorage.getItem("--navbar-text-color")); + changeCSS("--input-text-color", localStorage.getItem("--input-text-color")); + changeCSS( + "--input-placeholder-color", + localStorage.getItem("--input-placeholder-color") + ); + changeCSS( + "--input-background-color", + localStorage.getItem("--input-background-color") + ); + changeCSS( + "--input-border-color", + localStorage.getItem("--input-border-color") + ); + changeCSS("--input-border-size", localStorage.getItem("--input-border-size")); + changeCSS("--navbar-link-color", localStorage.getItem("--navbar-link-color")); + changeCSS("--navbar-font", localStorage.getItem("--navbar-font")); + changeCSS( + "--navbar-logo-filter", + localStorage.getItem("--navbar-logo-filter") + ); + changeCSS( + "--text-color-primary", + localStorage.getItem("--text-color-primary") + ); +}; diff --git a/public/resources/stealthEngine.js b/public/resources/stealthEngine.js index 2545d580..18bd8d9f 100644 --- a/public/resources/stealthEngine.js +++ b/public/resources/stealthEngine.js @@ -1,7 +1,7 @@ // Stealth engine, a dependency for everything above. // ensures that the js file is loaded -window.stealthEngineLoaded = true; +window.stealthEngineLoaded = true; function stealthEngine(encodedURL) { // Remember that the EncodedURL argument must be pre-encoded, or encoded before the function is called. // This function does not encode the argument at all! @@ -20,23 +20,28 @@ function stealthEngine(encodedURL) { if (!inFrame && !navigator.userAgent.includes("Firefox")) { const popup = open("about:blank", "_blank"); if (!popup || popup.closed) { - alert("StealthEngine was unable to open a popup. (do you have popups disabled?)"); + alert( + "StealthEngine was unable to open a popup. (do you have popups disabled?)" + ); } else { const doc = popup.document; const iframe = doc.createElement("iframe"); const style = iframe.style; popup.onload = () => { - document.getElementById("lpoader").style.display = "none" - document.getElementById('connectorText').textContent = "connecting to service" + document.getElementById("lpoader").style.display = "none"; + document.getElementById("connectorText").textContent = + "connecting to service"; setTimeout(() => { - document.getElementById('connectorText').textContent = "connecting to service" + document.getElementById("connectorText").textContent = + "connecting to service"; }, 17500); }; var isClosed = setInterval(function () { if (popup.closed) { clearInterval(isClosed); - document.getElementById("lpoader").style.display = "none" - document.getElementById('connectorText').textContent = "connecting to service" + document.getElementById("lpoader").style.display = "none"; + document.getElementById("connectorText").textContent = + "connecting to service"; } }, 1000); // Favicon attachment @@ -48,14 +53,15 @@ function stealthEngine(encodedURL) { doc.head.appendChild(arcSrc); const link = location.href; img.rel = "icon"; - img.href = ABFavicon || "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png"; + img.href = + ABFavicon || + "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png"; if (localStorage.nogg == "on") { doc.title = ABTitle || getRandomName(); } else { doc.title = ABTitle || "Nebula"; } - var currentLink = link.slice(0, link.length - 1); iframe.src = currentLink + encodedURL; @@ -94,4 +100,4 @@ if (tryAbTitle === null) { ABTitle = ""; } else { ABTitle = tryAbTitle; -} \ No newline at end of file +} diff --git a/public/resources/theme.js b/public/resources/theme.js new file mode 100644 index 00000000..c036415f --- /dev/null +++ b/public/resources/theme.js @@ -0,0 +1,189 @@ +const THEME_OPTIONS = { + dark: { + "--background-primary": "#191724", + "--navbar-color": "#26233a", + "--navbar-height": "60px", + "--navbar-text-color": "#7967dd", + "--input-text-color": "#e0def4", + "--input-placeholder-color": "#6e6a86", + "--input-background-color": "#1f1d2e", + "--input-placeholder-color": "white", + "--input-border-color": "#eb6f92", + "--input-border-size": "1.3px", + "--navbar-link-color": "#e0def4", + "--navbar-font": '"Roboto"', + "--navbar-logo-filter": "invert(0%)", + "--text-color-primary": "#e0def4" + }, + light: { + "--background-primary": "#d8d8d8", + "--navbar-color": "#a2a2a2", + "--navbar-height": "4em", + "--navbar-text-color": "#000000", + "--input-text-color": "#e0def4", + "--input-placeholder-color": "white", + "--input-background-color": "black", + "--input-border-color": "#eb6f92", + "--input-border-size": "1.3px", + "--navbar-link-color": "#000000", + "--navbar-font": '"Roboto"', + "--navbar-logo-filter": "invert(30%)", + "--text-color-primary": "#303030" + }, + suit: { + "--background-primary": "#0c0c0c", + "--navbar-color": "#ff2e4e", + "--navbar-height": "4em", + "--navbar-text-color": "#000000", + "--input-text-color": "#e0def4", + "--input-placeholder-color": "white", + "--input-background-color": "#00000000", + "--input-border-color": "#ff346e", + "--input-border-size": "1.3px", + "--navbar-link-color": "#000000", + "--navbar-font": '"Roboto"', + "--navbar-logo-filter": "brightness(30)", + "--text-color-primary": "#00000" + }, + metallic: { + "--background-primary": "#171717", + "--navbar-color": "#004953", + "--navbar-height": "4em", + "--navbar-text-color": "#ffffff", + "--input-text-color": "#e0def4", + "--input-placeholder-color": "white", + "--input-background-color": "#004953", + "--input-border-color": "#000000", + "--input-border-size": "1.3px", + "--navbar-link-color": "#e0def4", + "--navbar-font": '"Roboto"', + "--navbar-logo-filter": "invert(50%)", + "--text-color-primary": "#e0def4" + }, + dante: { + "--background-primary": "#131313", + "--navbar-color": "#e4ff8b", + "--navbar-height": "3.5em", + "--navbar-text-color": "#000000", + "--input-text-color": "#000000", + "--input-placeholder-color": "000000", + "--input-background-color": "#e4ff8b", + "--input-border-color": "#00000000", + "--input-border-size": "1.3px", + "--navbar-link-color": "#000000", + "--navbar-font": '"Roboto"', + "--navbar-logo-filter": "brightness(0%)", + "--text-color-primary": "#000" + } +}; + +function changeCSS(property, value, isRoot = false) { + const root = document.documentElement; + isRoot + ? root.style.setProperty(property, value) + : root.style.setProperty(property, value, "important"); +} + +function saveCSS(variable, value) { + localStorage.setItem(variable, value); +} +function applyTheme(theme) { + Object.entries(theme).forEach(([property, value]) => { + changeCSS(property, value); + localStorage.setItem(property, value); + }); +} + +function switchTheme() { + const selecter = document.getElementById("themeSwitcher"); + const selectedOption = selecter.value; + console.log(selectedOption); + const theme = THEME_OPTIONS[selectedOption]; + + if (!theme) { + return; + } + + applyTheme(theme); + localStorage.setItem("theme", selectedOption); + + if (selectedOption == "custom") { + let startCustom = prompt( + "Would you like to have an interactive setup? Y/N", + "" + ); + if (startCustom == "Y" || startCustom == "y") { + alert( + "Welcome to the interactive setup. Please enter the following values. If you don't know what to enter, just press enter. They will default to Dark Mode." + ); + let background = prompt( + "Background color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #191724", + "" + ); + let navbar = prompt( + "Navbar color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #26233a", + "" + ); + let navbarHeight = prompt( + "Navbar height || Possible Types: ABSOLUTE: cm, mm, Q, in, pc, pt, px RELATIVE: em, ex, ch, rem, lh, rlh, vw, vh, vb, vi || Default Value: 60px", + "" + ); + let navbarText = prompt( + "Navbar text color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #7967dd", + "" + ); + let inputText = prompt( + "Input text color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #e0def4", + "" + ); + let inputPlaceholder = prompt( + "Input placeholder color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #6e6a86", + "" + ); + let inputBackground = prompt( + "Input background color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #1f1d2e", + "" + ); + let inputBorder = prompt( + "Input border color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #eb6f92", + "" + ); + let inputBorderSize = prompt( + "Input border size || Possible Types: ABSOLUTE: cm, mm, Q, in, pc, pt, px RELATIVE: em, ex, ch, rem, lh, rlh, vw, vh, vb, vi || Default Value: 1.3px", + "" + ); + let navbarFont = prompt( + 'Navbar font || Enter a default font name, custom ones will likely not work. || Default Value: "Roboto"', + "" + ); + let navbarLink = prompt( + "Navbar link color || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #e0def4", + "" + ); + let navbarLogoFilter = prompt( + "Navbar logo filter || Adjust the NavBar-Logo-Filter. || Default Value: invert(0%)", + "" + ); + let textColorPrimary = prompt( + "Text color primary || Possible Types: Keywords, RGB, RBBA, HSL, HSLA, Hexadecimal. || Default Value: #e0def4", + "" + ); + localStorage.setItem("theme", "custom"); + changeCSS("--background-primary", background, true); + changeCSS("--navbar-color", navbar, true); + changeCSS("--navbar-height", navbarHeight, true); + changeCSS("--navbar-text-color", navbarText, true); + changeCSS("--input-text-color", inputText, true); + changeCSS("--input-placeholder-color", inputPlaceholder, true); + changeCSS("--input-background-color", inputBackground, true); + changeCSS("--input-border-color", inputBorder, true); + changeCSS("--input-border-size", inputBorderSize, true); + changeCSS("--navbar-link-color", navbarLink, true); + changeCSS("--navbar-font", navbarFont, true); + changeCSS("--navbar-logo-filter", navbarLogoFilter, true); + changeCSS("--text-color-primary", textColorPrimary, true); + } else { + alert("Non-Interactive Setup Not supported yet."); + } + } +} diff --git a/public/resources/v.js b/public/resources/v.js index e687303a..d6a359d6 100644 --- a/public/resources/v.js +++ b/public/resources/v.js @@ -15,21 +15,23 @@ validateOTP.onclick = () => { body: JSON.stringify({ otp: document.getElementById("otp").value }) - }).then((response) => { - return response.json(); - }).then((data) => { - if (data.success) { - setCookie("validation", data.validation, 30); - location.href = "/"; - } else { - alert("Invalid OTP."); - } - }).catch(() => { - alert("An error occurred while validating your OTP.") - }); + }) + .then((response) => { + return response.json(); + }) + .then((data) => { + if (data.success) { + setCookie("validation", data.validation, 30); + location.href = "/"; + } else { + alert("Invalid OTP."); + } + }) + .catch(() => { + alert("An error occurred while validating your OTP."); + }); }; - function setCookie(name, value, days) { var expires = ""; if (days) { diff --git a/src/index.html b/src/index.html index aac24de6..1b309222 100644 --- a/src/index.html +++ b/src/index.html @@ -37,17 +37,23 @@ - + + + - + + - - - - - + + + + + @@ -385,10 +391,11 @@

nebula.

GitHub - PrivacyPrivacy diff --git a/src/options.html b/src/options.html index 5fcd6f4b..1e505177 100644 --- a/src/options.html +++ b/src/options.html @@ -12,8 +12,9 @@ - - + + + @@ -120,23 +121,18 @@

-
-

Bare location

-

Choose the location where a bare server is hosted.

- -

- -
+

Misc

@@ -176,7 +166,7 @@

-

Version 7.11.4 (Public Release) | Nebula Copyright (c) Nebula Services 2022

+

Nebula Copyright (c) Nebula Services 2022