diff --git a/src/views/partial/scripts.ejs b/src/views/partial/scripts.ejs index bf5c55b..2fbd098 100644 --- a/src/views/partial/scripts.ejs +++ b/src/views/partial/scripts.ejs @@ -14,4 +14,5 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . %> - \ No newline at end of file + + \ No newline at end of file diff --git a/www/css/global.css b/www/css/global.css index 3698b6f..9da73cd 100644 --- a/www/css/global.css +++ b/www/css/global.css @@ -230,4 +230,20 @@ p.tooltip, h3.tooltip{ .qoute{ font-family: monospace; +} + +/* psa */ +#psa-body{ + padding: 1em; + display: flex; +} + +#psa-closer{ + float: right; +} + +a.psa{ + font-size: 1.5em; + text-align: center; + width: 100%; } \ No newline at end of file diff --git a/www/css/theme/movie-night.css b/www/css/theme/movie-night.css index 0f517b3..945fb49 100644 --- a/www/css/theme/movie-night.css +++ b/www/css/theme/movie-night.css @@ -468,6 +468,12 @@ select.panel-head-element{ color: var(--accent1); } +/* psa */ +#psa-container{ + border: 3px solid var(--danger0); + background-color: var(--danger0-alt2); +} + /* tooltip */ div.tooltip{ background-color: var(--bg1); @@ -647,4 +653,5 @@ div.altcha{ altcha-widget a{ color: var(--accent1); -} \ No newline at end of file +} + diff --git a/www/js/index-ad.js b/www/js/index-ad.js new file mode 100644 index 0000000..2d0dbef --- /dev/null +++ b/www/js/index-ad.js @@ -0,0 +1,65 @@ +/*Canopy - The next generation of stoner streaming software +Copyright (C) 2024-2025 Rainbownapkin and the TTN Community + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +//class to display a PSA informaing them that UBlock Origin is an essential part of a balanced breakfast. +class displayAdblockPSA{ + constructor(){ + //Create PSA div + this.psa = document.createElement('div'); + this.psa.id = "psa-container"; + this.psa.classList.add('psa'); + + //Create psa closer button + this.psaCloser = document.createElement('i'); + this.psaCloser.id = "psa-closer" + this.psaCloser.classList.add('psa','bi-x','interactive'); + this.psaCloser.addEventListener('click', this.close.bind(this)); + + + //Create PSA body + this.psaBody = document.createElement('div'); + this.psaBody.id = "psa-body"; + this.psa.classList.add('psa'); + + //Create PSA text/link + this.psaLabel = document.createElement('a'); + this.psaLabel.classList.add('psa','danger-link'); + this.psaLabel.innerText = `Your homies at ${utils.ux.getInstanceName()} would like to remind you that ad-block *IS* self care.` + this.psaLabel.href = "https://ublockorigin.com/"; + + //Assemble PSA + this.psaBody.appendChild(this.psaLabel); + this.psa.appendChild(this.psaCloser); + this.psa.appendChild(this.psaBody); + + //Append PSA to document body + document.body.prepend(this.psa); + } + + close(){ + //Remove the PSA + this.psa.remove(); + + //Prevent it from showing up in the future + localStorage.setItem("noPSA", true); + } +} + +//If the user hasn't told us to fuck off before +if(!localStorage.getItem("noPSA")){ + //Display PSA since we haven't been blocked by an ad-blocker + const nagBlock = new displayAdblockPSA(); +} \ No newline at end of file