forked from selenite-cc/selenite-old
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5582d8
commit a0813a3
Showing
8 changed files
with
56 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,46 @@ | ||
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; | ||
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(); | ||
} | ||
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 = "Settings | Selenite"; | ||
link = document.createElement("link"); | ||
link.rel = "icon"; | ||
document.head.appendChild(link); | ||
link.href = "/favicon.png"; | ||
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 = "Settings | Selenite"; | ||
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) => { | ||
console.log(event.target.value); | ||
console.log(cloaklist[event.target.value]); | ||
setCloakCookie( | ||
cloaklist[event.target.value][0], | ||
cloaklist[event.target.value][1] | ||
); | ||
}; | ||
async function loadCloaks() { | ||
const response = await fetch("/cloaks.json"); | ||
cloaklist = await response.json(); | ||
var presetCloaks = document.getElementById("presetCloaks"); | ||
presetCloaks.onchange = (event) => { | ||
console.log(event.target.value); | ||
console.log(cloaklist[event.target.value]); | ||
setCloakCookie(cloaklist[event.target.value][0], cloaklist[event.target.value][1]); | ||
}; | ||
} | ||
document.addEventListener('DOMContentLoaded', function() { | ||
loadCloaks(); | ||
}) | ||
document.addEventListener("DOMContentLoaded", function () { | ||
loadCloaks(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters