-
+
+
Nebula
diff --git a/static/options/index.html b/static/options/index.html
index ed4f592..5f4d844 100644
--- a/static/options/index.html
+++ b/static/options/index.html
@@ -12,8 +12,8 @@
-
-
+
+
@@ -187,7 +187,10 @@ if (cloakStored == "on") {
}
themeSelector.value = themeStored
proxySel.value = proxyStored
-document.getElementById("bareLocationInput").value = localStorage.getItem("_BareLocation")
+
+getBareLocation().then(bareLocation => {
+document.getElementById("bareLocationInput").value = bareLocation;
+});
diff --git a/static/resources/appModules/BareSwitcher.js b/static/resources/appModules/BareSwitcher.js
new file mode 100644
index 0000000..0ccc6e3
--- /dev/null
+++ b/static/resources/appModules/BareSwitcher.js
@@ -0,0 +1,103 @@
+// NOTE: THIS FILE MUST BE ACCOMPANIED BY THE ULTRAVIOLET BUNDLE BECAUSE IT CONTAINS THE INDEXEDDB LIBRARY
+
+const dbPromise = Ultraviolet.openDB('keyval-store', 1, {
+ upgrade (db) {
+ db.createObjectStore('keyval')
+ }
+})
+
+function getBareLocation () {
+ return dbPromise
+ .then(db => db.get('keyval', 'bareLocation'))
+ .then(value => value || '')
+}
+
+self.storage = {
+ async get (key) {
+ return (await dbPromise).get('keyval', key)
+ },
+
+ async set (key, val) {
+ return (await dbPromise).put('keyval', val, key)
+ },
+
+ async del (key) {
+ return (await dbPromise).delete('keyval', key)
+ }
+}
+
+function setBareLocation (location) {
+ if (
+ /^http(s?):\/\//.test(location) ||
+ (location.includes('.') && val.substr(0, 1) !== ' ') ||
+ location.includes('/bare/')
+ ) {
+ storage.set('bareLocation', location)
+ return 'Bare is located at: ' + location
+ } else {
+ console.log(
+ 'Invalid Location provided, please provide a server in the format of http(s)://server.domain.com/'
+ )
+ return 'Invalid Location provided'
+ }
+}
+
+function bareValidator (bareLocation) {
+ try {
+ // open a request to the bare location
+ var xmlHttp = new XMLHttpRequest()
+ xmlHttp.open('GET', bareLocation, false) // false for synchronous request
+ xmlHttp.send(null)
+ const _response = xmlHttp.responseText
+ // turn the response text into json
+
+ const response = JSON.parse(_response)
+
+ if (response.project.name === 'bare-server-node') {
+ console.log('Bare located at: ' + bareLocation + '')
+ return true
+ } else {
+ console.error('Bare not found at: ' + bareLocation)
+ return false
+ }
+ } catch (error) {
+ console.error(
+ 'An error occured while attempting to identify the bare server at: ' +
+ bareLocation
+ )
+ return false
+ }
+}
+
+window.addEventListener('load', () => {
+ console.log('Loaded ')
+ const _loc = document.getElementById('bareLocationInput')
+ const indicator = document.getElementById('validIndicator')
+
+ // wait 3 seconds
+ setTimeout(() => {
+ if (bareValidator(_loc.value) === true) {
+ indicator.innerText = 'Connected to server: ' + _loc.value
+ indicator.style.color = '#42f851'
+ } else if (bareValidator(_loc.value) === false) {
+ indicator.innerText = 'Could not connect to server: ' + _loc.value
+ indicator.style.color = '#f45145bd'
+ }
+ }, 1000)
+
+ document
+ .getElementById('bareLocationInput')
+ .addEventListener('keydown', function (event) {
+ if (event.key === 'Enter') {
+ if (bareValidator(_loc.value) === true) {
+ indicator.innerText = 'Connected to server: ' + _loc.value
+ indicator.style.color = '#42f851'
+ setBareLocation(_loc.value)
+ } else if (bareValidator(_loc.value) === false) {
+ _loc.value = ''
+ indicator.innerText = 'Could not connect to server: ' + _loc.value
+ indicator.style.color = '#f45145bd'
+ }
+ }
+ })
+})
diff --git a/static/resources/appModules/database-manager.js b/static/resources/appModules/database-manager.js
index a2e035a..847a85b 100644
--- a/static/resources/appModules/database-manager.js
+++ b/static/resources/appModules/database-manager.js
@@ -1,19 +1,24 @@
+// NOTE - This file is not used in the current version of the app.
+// this is just a snippet of code that I am keeping for future reference.
+// NOTE: THIS FILE MUST BE ACCOMPANIED BY THE ULTRAVIOLET BUNDLE BECAUSE IT CONTAINS THE INDEXEDDB LIBRARY
+
+
const dbPromise = Ultraviolet.openDB('keyval-store', 1, {
- upgrade(db) {
- db.createObjectStore('keyval');
- },
-});
+ upgrade (db) {
+ db.createObjectStore('keyval')
+ }
+})
self.storage = {
- async get(key) {
- return (await dbPromise).get('keyval', key);
- },
-
- async set(key, val) {
- return (await dbPromise).put('keyval', val, key);
- },
-
- async del(key) {
- return (await dbPromise).delete('keyval', key);
- },
-}
\ No newline at end of file
+ async get (key) {
+ return (await dbPromise).get('keyval', key)
+ },
+
+ async set (key, val) {
+ return (await dbPromise).put('keyval', val, key)
+ },
+
+ async del (key) {
+ return (await dbPromise).delete('keyval', key)
+ }
+}
diff --git a/static/resources/appModules/selectBare.js b/static/resources/appModules/selectBare.js
deleted file mode 100644
index a494d81..0000000
--- a/static/resources/appModules/selectBare.js
+++ /dev/null
@@ -1,74 +0,0 @@
-
-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) {
- return (await dbPromise).put('keyval', val, key);
- },
-
- async del(key) {
- return (await dbPromise).delete('keyval', key);
- },
-}
-
-function getBareLocation() {
- const location = storage.get("bareLocation");
- return location;
-}
-
-function setBareLocation(location) {
- if (/^http(s?):\/\//.test(location) || (location.includes('.') && val.substr(0, 1) !== ' ') || location.includes('/bare/')) {
- storage.set("bareLocation", location);
- return 'Bare is located at: ' + location;
- } else {
- console.log('Invalid Location provided, please provide a server in the format of http(s)://server.domain.com/');
- return 'Invalid Location provided';
- }
-}
-
-function bareValidator(bareLocation) {
- fetch(bareLocation)
- .then((res) => res.json())
- .then((data) => {
- if (data.project.name === "bare-server-node") {
- return true;
- }
-
- return false;
- })
-}
-
-
-window.addEventListener("load", () => {
- const _loc = document.getElementById('bareLocationInput')
- const indicator = document.getElementById('validIndicator')
- if (bareValidator(_loc.value) === true) {
- indicator.innerText = 'Connected to server: ' + _loc.value
- indicator.style.color = '#42f851'
- } else if (bareValidator(_loc.value) === false) {
- indicator.innerText = 'Could not connect to server: ' + _loc.value
- indicator.style.color = '#f45145bd'
- }
-
- document.getElementById('bareLocationInput').addEventListener('keydown', function (event) {
- if (event.key === 'Enter') {
- if (bareValidator(_loc.value) === true) {
- indicator.innerText = 'Connected to server: ' + _loc.value
- indicator.style.color = '#42f851'
- setBareLocation(_loc.value)
- } else if (bareValidator(_loc.value) === false) {
- indicator.innerText = 'Could not connect to server: ' + _loc.value
- indicator.style.color = '#f45145bd'
- }
- }
- });
-
-});
\ No newline at end of file
diff --git a/static/resources/nebulamain.js b/static/resources/nebulamain.js
index 1e9363f..a68f9a8 100644
--- a/static/resources/nebulamain.js
+++ b/static/resources/nebulamain.js
@@ -9,148 +9,181 @@
// Navigation controls for smaller devices
// Executed in the inline HTML
-function openNav() {
- document.getElementById("sidenav").style.width = "260px"
+function openNav () {
+ document.getElementById('sidenav').style.width = '260px'
}
-function closeNav() {
- document.getElementById("sidenav").style.width = "0px"
+function closeNav () {
+ document.getElementById('sidenav').style.width = '0px'
}
-window.addEventListener("load", () => {
+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.
- if (localStorage.getItem("_BareLocation") == undefined || localStorage.getItem("_BareLocation") == null) {
- localStorage.setItem("_BareLocation", "/bare/")
- }
-
+ const dbPromise = Ultraviolet.openDB('keyval-store', 1, {
+ upgrade (db) {
+ db.createObjectStore('keyval')
+ }
+ })
+ self.storage = {
+ async get (key) {
+ return (await dbPromise).get('keyval', key)
+ },
- navigator.serviceWorker.register("./sw.js", {
- scope: "/service/",
+ async set (key, val) {
+ console.log('please wait')
+ return (await dbPromise).put('keyval', val, key)
+ },
+
+ async del (key) {
+ return (await dbPromise).delete('keyval', key)
+ }
+ }
+
+ function getBareLocation () {
+ return dbPromise
+ .then(db => db.get('keyval', 'bareLocation'))
+ .then(value => value || '')
+ }
+
+ getBareLocation().then(bareLocation => {
+
+ console.log('Bare Location: ' + bareLocation)
+ if (bareLocation === '') {
+ console.log('No bare location found, automatically setting to default')
+ storage.set('bareLocation', '/bare/')
+
+ }
+
+ // if bare location is not only whitespace
+ // if (bareLocation.trim() !== '') {
+
+ })
+
+ navigator.serviceWorker.register('./sw.js', {
+ scope: '/service/'
})
// Get's the current day using the Date function built in.
// A dependency for displaying time - displayTime(void)
- function getDayName(dateStr, locale) {
+ function getDayName (dateStr, locale) {
var date = new Date(dateStr)
- return date.toLocaleDateString(locale, { weekday: "long" })
+ return date.toLocaleDateString(locale, { weekday: 'long' })
}
// The main function to show the time on the main page
// needs to be initialized by a call (only one)
// Dependent on getDayName function
- function displayTime() {
+ function displayTime () {
var date = new Date()
var h = date.getHours() // 0 - 23
var m = date.getMinutes() // 0 - 59
var s = date.getSeconds() // 0 - 59
- var session = "AM"
- h = h == 12 ? 24 : h;
+ var session = 'AM'
+ h = h == 12 ? 24 : h
if (h == 0) {
h = 12
} else if (h >= 12) {
h = h - 12
- session = "PM"
+ session = 'PM'
}
- h = h < 10 ? "0" + h : h
- m = m < 10 ? "0" + m : m
- s = s < 10 ? "0" + s : s
+ h = h < 10 ? '0' + h : h
+ m = m < 10 ? '0' + m : m
+ s = s < 10 ? '0' + s : s
// Repeat itself every second
setTimeout(displayTime, 1000)
// Get today's date
var today = new Date()
- var dd = String(today.getDate()).padStart(2, "0")
- var mm = String(today.getMonth() + 1).padStart(2, "0") //January is 0!
+ var dd = String(today.getDate()).padStart(2, '0')
+ var mm = String(today.getMonth() + 1).padStart(2, '0') //January is 0!
var yyyy = today.getFullYear()
- today = mm + "/" + dd + "/" + yyyy
+ today = mm + '/' + dd + '/' + yyyy
var time = h + ":" + m
- document.getElementById("digitalClock").innerHTML =
- getDayName(today, "us-US") + ", " + time + " " + session + "."
+ document.getElementById('digitalClock').innerHTML =
+ getDayName(today, 'us-US') + ', ' + time + ' ' + session + '.'
return time
}
// initialize the time function
-
- if (window.location.pathname == "/"){
+
displayTime()
- }
// Link evaluation
// This functions' purpose is to check a string of text (the argument)
// it recognizes whether a string is a URL or not, and it returns a true or false value
- function isUrl(val = "") {
+ function isUrl (val = '') {
if (
/^http(s?):\/\//.test(val) ||
- (val.includes(".") && val.substr(0, 1) !== " ")
+ (val.includes('.') && val.substr(0, 1) !== ' ')
)
return true
return false
}
const useNoGG = false
- const proxy = localStorage.getItem("proxy") || "uv"
- const inpbox = document.querySelector("form")
+ const proxy = localStorage.getItem('proxy') || 'uv'
+ const inpbox = document.querySelector('form')
// Display the "loading" indicators on the main page, looks much better than a static/still screen.
-
- inpbox.addEventListener("submit", (event) => {
+
+ inpbox.addEventListener('submit', event => {
// Prevents the default event tasks
event.preventDefault()
- console.log("Connecting to service -> loading")
- const loader = document.getElementById("lpoader")
- const texts = document.getElementById("connecterText")
+ console.log('Connecting to service -> loading')
+ const loader = document.getElementById('lpoader')
+ const texts = document.getElementById('connecterText')
// Adjust size as neccesary
const loadConstructer = loader.style
const textConstructer = texts.style
- loadConstructer.display = "flex"
- loadConstructer.justifyContent = "center"
+ loadConstructer.display = 'flex'
+ loadConstructer.justifyContent = 'center'
// Changing the text over multiple periods of time creates character, and aliveness (is that even a word?)
setTimeout(() => {
- document.getElementById("connecterText").style.fontSize = "12px"
- document.getElementById("connecterText").innerHTML =
- "Due to high server load, this may take a while."
+ document.getElementById('connecterText').style.fontSize = '12px'
+ document.getElementById('connecterText').innerHTML =
+ 'Due to high server load, this may take a while.'
}, 3200)
setTimeout(() => {
- document.getElementById("connecterText").style.fontSize = "14px"
- document.getElementById("connecterText").innerHTML =
+ document.getElementById('connecterText').style.fontSize = '14px'
+ document.getElementById('connecterText').innerHTML =
"Hmmm.. Something isn't right.."
}, 17000)
})
// Form submission
- const form = document.querySelector("form")
- form.addEventListener("submit", (event) => {
+ const form = document.querySelector('form')
+ form.addEventListener('submit', event => {
event.preventDefault()
// Check if the service worker (commonly called SW) is registered
- if (typeof navigator.serviceWorker === "undefined")
+ if (typeof navigator.serviceWorker === 'undefined')
alert(
- "An error occured registering your service worker. Please contact support - discord.gg/unblocker"
+ 'An error occured registering your service worker. Please contact support - discord.gg/unblocker'
)
//
- if (proxy === "uv" || proxy === "osana") {
+ if (proxy === 'uv' || proxy === 'osana') {
// Re-register the service worker incase it failed to onload
navigator.serviceWorker
- .register("./sw.js", {
- scope: "/service/",
+ .register('./sw.js', {
+ scope: '/service/'
})
.then(() => {
const value = event.target.firstElementChild.value
let url = value.trim()
- if (!isUrl(url)) url = "https://www.google.com/search?q=" + url
- if (!(url.startsWith("https://") || url.startsWith("http://")))
- url = "http://" + url
+ if (!isUrl(url)) url = 'https://www.google.com/search?q=' + url
+ if (!(url.startsWith('https://') || url.startsWith('http://')))
+ url = 'http://' + url
// encode the URL for UltraViolet
let redirectTo =
- proxy === "uv"
+ proxy === 'uv'
? __uv$config.prefix + __uv$config.encodeUrl(url)
: __osana$config.prefix + __osana$config.codec.encode(url)
- const option = localStorage.getItem("nogg")
- if (option === "on") {
+ const option = localStorage.getItem('nogg')
+ if (option === 'on') {
stealthEngine(redirectTo)
} else {
setTimeout(() => {
// If StealthMode is off, this is the enabled option.
- const _popout = window.open("/blob", "_self")
+ const _popout = window.open('/blob', '_self')
const blob = _popout.document
// Write all of the neccesary page elements, and the Options including the cloak (if enabled)
// The blob writing is just the background elements, like the "Nebula is loading your content, please wait" screen. It does not carry proxied content, or even the iframe.
@@ -193,25 +226,25 @@ document.addEventListener("visibilitychange", handleTabLeave)
`)
// inside of the blob, create and append the Iframe element which WILL carry the proxied content.
- const iframe = blob.createElement("iframe")
+ const iframe = blob.createElement('iframe')
const style = iframe.style
- const img = blob.createElement("link")
+ const img = blob.createElement('link')
const link = location.href
// We attach ARC because it supports us, keeping our arc link there would be greatly appreciated :)
- const arcSrc = blob.createElement("script")
+ const arcSrc = blob.createElement('script')
arcSrc.setAttribute(
- "src",
- "https://arc.io/widget.min.js#BgaWcYfi"
+ 'src',
+ 'https://arc.io/widget.min.js#BgaWcYfi'
)
// Arc requires the Async attribute
// Async means not running parallel to other tasks, so it loads seperately to everything else (in a sense)
// Aysnchronous and Synchronous are somewhat difficult topics, so we recommend you
- arcSrc.setAttribute("async", "")
+ arcSrc.setAttribute('async', '')
blob.head.appendChild(arcSrc)
- img.rel = "icon"
+ img.rel = 'icon'
img.href =
- "https://static.nebulacdn.xyz/content/images/nebula_logo_619x619.png"
- blob.title = "Nebula"
+ 'https://static.nebulacdn.xyz/content/images/nebula_logo_619x619.png'
+ blob.title = 'Nebula'
// slice the link like some nice fruit :)
// Removing the '/' from 'whateverthislinkis.gay/'
// ^
@@ -220,10 +253,10 @@ document.addEventListener("visibilitychange", handleTabLeave)
iframe.src = currentLink + redirectTo
// Style the Iframe to fill the entire screen and remove the bessels.
- style.position = "fixed"
+ style.position = 'fixed'
style.top = style.bottom = style.left = style.right = 0
- style.border = style.outline = "none"
- style.width = style.height = "100%"
+ style.border = style.outline = 'none'
+ style.width = style.height = '100%'
// finally, append the iframe to the blob's (window) body
blob.body.appendChild(iframe)
}, 1000)
@@ -233,7 +266,7 @@ document.addEventListener("visibilitychange", handleTabLeave)
})
// Stealth engine, a dependency for everything above.
- function stealthEngine(encodedURL) {
+ 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!
@@ -248,37 +281,37 @@ document.addEventListener("visibilitychange", handleTabLeave)
setTimeout(() => {
// Basically, a checklist to make sure that an error won't occur.
// In this if statement, we're checking if an iframe is already being opened, if popups are disabled, and if the user agent IS NOT firefox (firefox sucks, sorry Moz)
- if (!inFrame && !navigator.userAgent.includes("Firefox")) {
- const popup = open("about:blank", "_blank")
+ 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?)"
+ 'StealthEngine was unable to open a popup. (do you have popups disabled?)'
)
} else {
const doc = popup.document
- const iframe = doc.createElement("iframe")
+ const iframe = doc.createElement('iframe')
const style = iframe.style
// Favicon attachment
- const img = doc.createElement("link")
- const arcSrc = doc.createElement("script")
+ const img = doc.createElement('link')
+ const arcSrc = doc.createElement('script')
// We attach ARC because it supports us, keeping our arc link there would be greatly appreciated :)
- arcSrc.setAttribute("src", "https://arc.io/widget.min.js#BgaWcYfi")
- arcSrc.setAttribute("async", "")
+ arcSrc.setAttribute('src', 'https://arc.io/widget.min.js#BgaWcYfi')
+ arcSrc.setAttribute('async', '')
doc.head.appendChild(arcSrc)
const link = location.href
- img.rel = "icon"
+ img.rel = 'icon'
img.href =
- "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png"
+ '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 = currentLink + encodedURL
- style.position = "fixed"
+ style.position = 'fixed'
style.top = style.bottom = style.left = style.right = 0
- style.border = style.outline = "none"
- style.width = style.height = "100%"
+ style.border = style.outline = 'none'
+ style.width = style.height = '100%'
doc.body.appendChild(iframe)
}
@@ -288,88 +321,79 @@ document.addEventListener("visibilitychange", handleTabLeave)
})
// Set the option
-var option = localStorage.getItem("nogg")
-
-function toggleNoGG() {
- if (option === "on") {
- option = "off"
- localStorage.setItem("nogg", "off")
- } else {
- option = "on"
- localStorage.setItem("nogg", "on")
- }
-}
-var option2 = localStorage.getItem("ADVcloak")
-function toggleClickoff() {
- if (option2 === "on") {
- option2 = "off"
- localStorage.setItem("ADVcloak", "off")
- } else {
- option2 = "on"
- localStorage.setItem("ADVcloak", "on")
- }
-}
-
-const storedSetTheme = localStorage.getItem("theme")
-
-function switchProxy() {
- var selecter = document.getElementById("proxySwitcher")
- var selectedOption = selecter.value
-
- localStorage.setItem("proxy", selectedOption)
- var storedChoice = localStorage.getItem("proxy")
- console.log(selectedOption)
-}
+var option = localStorage.getItem('nogg')
+const storedSetTheme = localStorage.getItem('theme')
if (storedSetTheme == null) {
- localStorage.setItem("theme", "dark")
+ localStorage.setItem('theme', 'dark')
}
-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")
+window.onload = function () {
+ function setCookie (cname, cvalue, exdays) {
+ const d = new Date()
+ d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)
+ let expires = 'expires=' + d.toUTCString()
+ document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'
}
- 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")
+
+ function getCookie (cname) {
+ let name = cname + '='
+ let decodedCookie = decodeURIComponent(document.cookie)
+ let ca = decodedCookie.split(';')
+ for (let i = 0; i < ca.length; i++) {
+ let c = ca[i]
+ while (c.charAt(0) == ' ') {
+ c = c.substring(1)
+ }
+ if (c.indexOf(name) == 0) {
+ return c.substring(name.length, c.length)
+ }
+ }
+ return ''
}
- if (selectedOption == "custom") {
- let response = prompt("Please enter the code for a custom theme:", "")
- alert("This feature is not ready yet. Please try again later.")
+ function httpGet (theUrl) {
+ var xmlHttp = new XMLHttpRequest()
+ xmlHttp.open('GET', theUrl, false) // false for synchronous request
+ xmlHttp.send(null)
+ return xmlHttp.responseText
}
+ if (httpGet('/verification') == 'true') {
+ if (getCookie('verifiedAccess') == '') {
+ console.log('COOKIE NOT FOUND - ENTRY NOT PERMITTED')
+ window.location = '/unv.html'
+ } else {
+ console.log('COOKIE RECOGNIZED - ENTRY PERMITTED ')
+ }
+ }
+ 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 defaultThemes() {}
-
-function changeCSS(variable, value, saveBool) {
+function changeCSS (variable, value, saveBool) {
document.documentElement.style.setProperty(variable, value)
if (saveBool === true) {
@@ -377,113 +401,31 @@ function changeCSS(variable, value, saveBool) {
}
}
-function saveCSS(variable, value) {
+function saveCSS (variable, value) {
localStorage.setItem(variable, value)
}
-window.onload = function () {
- function setCookie(cname, cvalue, exdays) {
- const d = new Date()
- d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)
- let expires = "expires=" + d.toUTCString()
- document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"
- }
-
- function getCookie(cname) {
- let name = cname + "="
- let decodedCookie = decodeURIComponent(document.cookie)
- let ca = decodedCookie.split(";")
- for (let i = 0; i < ca.length; i++) {
- let c = ca[i]
- while (c.charAt(0) == " ") {
- c = c.substring(1)
- }
- if (c.indexOf(name) == 0) {
- return c.substring(name.length, c.length)
- }
- }
- return ""
- }
- function httpGet(theUrl) {
- var xmlHttp = new XMLHttpRequest()
- xmlHttp.open("GET", theUrl, false) // false for synchronous request
- xmlHttp.send(null)
- return xmlHttp.responseText
- }
- if (httpGet("/verification") == "true") {
- if (getCookie("verifiedAccess") == "") {
- console.log("COOKIE NOT FOUND - ENTRY NOT PERMITTED")
- window.location = "/unv.html"
- } else {
- console.log("COOKIE RECOGNIZED - ENTRY PERMITTED ")
- }
- }
- 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)
-}
-
-// Resets themes
-function resetViews() {
- changeCSS("--background-primary", "#191724", true)
- changeCSS("--navbar-color", "#26233a", true)
- changeCSS("--navbar-height", "60px", true)
- changeCSS("--navbar-text-color", "rgb(121 103 221)", true)
- changeCSS("--navbar-link-color", "#e0def4", true)
- changeCSS("--navbar-font", '"Roboto"', 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)
- return "All views reset"
-}
-
// Extra logging for support
-function log() {
+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;"
+ '%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;"
+ '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;"
+ '%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 enabledCookies = navigator.cookieEnabled
@@ -497,235 +439,246 @@ function log() {
let browserName
let diagnosticDomain = window.location.href
if (userAgent.match(/chrome|chromium|crios/i)) {
- browserName = "chrome"
+ browserName = 'chrome'
} else if (userAgent.match(/firefox|fxios/i)) {
- browserName = "firefox"
+ browserName = 'firefox'
} else if (userAgent.match(/safari/i)) {
- browserName = "safari"
+ browserName = 'safari'
} else if (userAgent.match(/opr\//i)) {
- browserName = "opera"
+ browserName = 'opera'
} else if (userAgent.match(/edg/i)) {
- browserName = "edge"
+ browserName = 'edge'
} else {
- browserName = "No browser detection"
+ browserName = 'No browser detection'
}
setTimeout(
console.log.bind(
console,
`%cInformation: \n URL: ${diagnosticDomain} \n BrowserName: ${browserName} \n IsOnline: ${online} \n agent: ${userAgent}, `,
- "background: gray;color:#FFF;padding:3px;border-radius: 0px;line-height: 26px; font-size:6px;"
+ 'background: gray;color:#FFF;padding:3px;border-radius: 0px;line-height: 26px; font-size:6px;'
)
)
}
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') {
+ let response = prompt('Please enter the code for a custom theme:', '')
+ alert('This feature is not ready yet. Please try again later.')
+ }
+}
-// Notification Banners
-// "Saved" notification
-function saveIc() {
- console.log("Checked")
- var notification = `
-
-
- Success! Your settings have been saved!
-
-
- `
- document.getElementById("notifhere").innerHTML = notification
- setTimeout(() => {
- var NotificationOBJ = document.getElementById("notifhere")
- }, 2000)
-}
-// The "You have unsaved changes" banner. You can remove this but it isn't recommended
-function unsavedChanges() {
- var notification = `
-