Added ad-block PSA, to remind everyone that they should use an ad-blocking extension while browsing the web.
This commit is contained in:
parent
08fe051269
commit
a8a5357b05
4 changed files with 91 additions and 2 deletions
65
www/js/index-ad.js
Normal file
65
www/js/index-ad.js
Normal file
|
|
@ -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 <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue