diff --git a/cloaks.json b/cloaks.json new file mode 100644 index 00000000..42a86d04 --- /dev/null +++ b/cloaks.json @@ -0,0 +1,17 @@ +{ + "google": [ + "Google", "https://google.com/favicon.ico" + ], + "canvas": [ + "Dashboard", "https://du11hjcvx0uqb.cloudfront.net/dist/images/favicon-e10d657a73.ico" + ], + "desmos": [ + "Desmos | Graphing Calculator", "https://www.desmos.com/assets/img/apps/graphing/favicon.ico" + ], + "drive": [ + "My Drive - Google Drive", "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png" + ], + "classroom": [ + "Home", "https://ssl.gstatic.com/classroom/ic_product_classroom_144.png" + ] +} \ No newline at end of file diff --git a/functions/helloworld.js b/functions/helloworld.js deleted file mode 100644 index 3634c69b..00000000 --- a/functions/helloworld.js +++ /dev/null @@ -1,3 +0,0 @@ -export function onRequest(context) { - return new Response("Hello, world!") - } \ No newline at end of file diff --git a/js/cloaks.js b/js/cloaks.js new file mode 100644 index 00000000..63326062 --- /dev/null +++ b/js/cloaks.js @@ -0,0 +1,48 @@ +let cloaklist; +$.getJSON("/cloaks.json", function (data) { + cloaklist = data; +}); + +function cloakExceptions(url) { + if (url.includes("harrisonburg.instructure.com") == true) { + return "learn.canvas.net"; + } + return url; +} + +function setCloakCookie(name, url) { + console.log(name + url); + if (!(url == null)) { + document.cookie = + "tabicon=" + url; + document.cookie = "tabname=" + name; + setCloak(); + } else { + url = cloakExceptions($("#webicon").val()); + document.cookie = + "tabicon=https://s2.googleusercontent.com/s2/favicons?domain_url=" + url; + document.cookie = "tabname=" + $("#webname").val(); + setCloak(); + } +} + +function clearCloak() { + document.cookie = "tabicon=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; + document.cookie = "tabname=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; + var link = document.querySelector("link[rel~='icon']"); + link.remove(); + document.title = "Tab Cloak | e-gamepass"; + link = document.createElement("link"); + link.rel = "icon"; + document.head.appendChild(link); + link.href = "/favicon.png"; +} +function loadCloaks() { + var presetCloaks = document.getElementById("presetCloaks"); + presetCloaks.onchange = (event) => { + setCloakCookie( + cloaklist[event.target.value][0], + cloaklist[event.target.value][1] + ); + }; +} diff --git a/js/main.js b/js/main.js index 85271443..129d4356 100644 --- a/js/main.js +++ b/js/main.js @@ -19,6 +19,7 @@ window.onload = function () { } else { document.body.setAttribute("theme", "main") } + loadCloaks(); checkAlert(); check(); }; @@ -85,28 +86,4 @@ function setPanicMode() { return; } document.cookie = "panicurl=" + $("#panic").val(); -} -function cloakExceptions(url) { - if (url.includes('harrisonburg.instructure.com') == true) { - return "learn.canvas.net"; - } - return url; -} - -function setCloakCookie() { - url = cloakExceptions($('#webicon').val()) - document.cookie = 'tabicon=https://s2.googleusercontent.com/s2/favicons?domain_url=' + url; - document.cookie = 'tabname=' + $('#webname').val(); - setCloak(); -} - -function clearCloak() { - document.cookie = "tabicon=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; - document.cookie = "tabname=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; - var link = document.querySelector("link[rel~='icon']");link.remove(); - document.title = "Tab Cloak | e-gamepass"; - link = document.createElement('link'); - link.rel = 'icon'; - document.head.appendChild(link); - link.href = "/favicon.png"; } \ No newline at end of file diff --git a/settings.html b/settings.html index b49f7c11..ead6fa19 100644 --- a/settings.html +++ b/settings.html @@ -13,6 +13,7 @@ + @@ -53,12 +54,18 @@

Settings

-

Website Name

-
+

Website Name


-

Website Icon

-
-

+

Website Icon

+
+

Or select a preset:

+
@@ -74,7 +81,6 @@

Website URL

-

diff --git a/style.css b/style.css index e693d1d3..09b3894c 100644 --- a/style.css +++ b/style.css @@ -113,7 +113,7 @@ button, input#websubmit.submit, input[type=submit]#panic { border-width: 5px; border-radius: 10px; border-style: solid; - padding: 10px; + padding: 7px; margin-left: 20px; margin-right: 20px; margin: 10px; @@ -237,4 +237,15 @@ form { } .samerow.themebtns { width: 70%; +} + +select { + border-radius: 5px; + background-color: var(--inputbg); + border-color: var(--inputborder); + border-width: 5px; + border-radius: 10px; + border-style: solid; + padding: 0.5% 0.5%; + margin: 0.25%; } \ No newline at end of file