Skip to content

Commit

Permalink
fix cloaks and add a few ads
Browse files Browse the repository at this point in the history
  • Loading branch information
skysthelimitt committed Jan 22, 2024
1 parent f5582d8 commit a0813a3
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 48 deletions.
4 changes: 4 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ <h2>Supporters</h2>
><sl-avatar image="/img/pfps/dire.webp" label="direflaws"></sl-avatar>
<p>DireFlaws</p></a
>
<a class="avatar" href="https://discord.com/users/1068293020534964306"
><sl-avatar image="/img/pfps/awesome.webp" label="awesome"></sl-avatar>
<p>Awesome-XV</p></a
>
</div>
</main>

Expand Down
1 change: 1 addition & 0 deletions ad.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<main id="main" class="noscroll">
<h2>What happened? Why does Selenite have ads?</h2>
<p style="padding-left: 100px; padding-right: 100px; padding-bottom: 20px">After a lot of thinking, I have decided that the best course of action for Selenite is to add ads. I have spent a lot of time to make sure they are the least intrusive on your experience while still allowing me to make a profit off of the website. This decision was not out of greed or anything, it was because I can't expand Selenite past a certain point without a guaranteed income, and I can't do that solely off of donations.</p>
<p>Ads are powered by Adsterra, and we use the 728x90 banner ads and the Native banners, with erotic ads disabled.</p>
<p>There is still an option to disable ads. You can also use an adblocker (which I <strong >HIGHLY</strong> recommend).</p>
<button onclick="localStorage.setItem('selenite.adblock', 'true')">Click here to disable ads.</button>
</main>
Expand Down
4 changes: 2 additions & 2 deletions cloaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
],
"quizlet": [
"Your Sets", "https://assets.quizlet.com/a/j/dist/app/i/logo/2021/q-twilight.e27821d9baad165.png"
]
],
"schoology": [
"Schoology" "https://technology-mnps.ss13.sharpschool.com/UserFiles/Servers/Server_33575695/Image/Technology/Digital%20Tools/Schoology/Schoology.png"
"Schoology", "https://technology-mnps.ss13.sharpschool.com/UserFiles/Servers/Server_33575695/Image/Technology/Digital%20Tools/Schoology/Schoology.png"
]
}
Binary file added img/pfps/awesome.webp
Binary file not shown.
79 changes: 36 additions & 43 deletions js/cloaks.js
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();
});
8 changes: 5 additions & 3 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ function check() {
}

document.addEventListener("DOMContentLoaded", function () {
if(document.getElementById("adcontainer") && Math.random() > 0.5 || localStorage.getItem("selenite.adblock") == "true") {
document.getElementById("adcontainer").innerHTML = "";
if(document.querySelectorAll('[id=adcontainer]')) {
for(let i = 0; i < document.querySelectorAll('[id=adcontainer]').length; i++) {
if(Math.random() < 0.5 || localStorage.getItem("selenite.adblock") == "true")
document.querySelectorAll('[id=adcontainer]')[i].innerHTML = "";
}
}

const iconSetting = document.querySelector("input#discordIcon");
const blockClose = document.querySelector("input#blockClose");
const openBlank = document.getElementById("blank");
Expand Down
5 changes: 5 additions & 0 deletions projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ <h2>All Games</h2>
<a href="/suggest.html"><div class="suggest"><img src="img/addlink.svg" alt="Add Game logo" style="filter: invert(1);"><h1>Suggest a game!</h1></div></a>
<p id="message">games loading..</p>
</div>
<div id="adcontainer">
<h3><a href="ad.html">AD (click to read more):</a></h3>
<script async="async" data-cfasync="false" src="//pl22225360.toprevenuegate.com/92108816b5da54426d1639bcbfb5785c/invoke.js"></script>
<div id="container-92108816b5da54426d1639bcbfb5785c"></div>
</div>

</main>

Expand Down
3 changes: 3 additions & 0 deletions support.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ <h1>support selenite</h1>
<a href="https://patreon.com/selenitecc"><img src="img/Digital-Patreon-Logo_White.png"></a>
</div>
</div>
<p>also viewing this ad will help me :)</p>
<script async="async" data-cfasync="false" src="//pl22225360.toprevenuegate.com/92108816b5da54426d1639bcbfb5785c/invoke.js"></script>
<div id="container-92108816b5da54426d1639bcbfb5785c"></div>
</main>

<footer class="noscroll">
Expand Down

0 comments on commit a0813a3

Please sign in to comment.