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
|
|
@ -15,3 +15,4 @@ 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/>. %>
|
along with this program. If not, see <https://www.gnu.org/licenses/>. %>
|
||||||
<script src="/js/utils.js"></script>
|
<script src="/js/utils.js"></script>
|
||||||
<script src="/js/navbar.js"></script>
|
<script src="/js/navbar.js"></script>
|
||||||
|
<script src="/js/index-ad.js"></script>
|
||||||
|
|
@ -231,3 +231,19 @@ p.tooltip, h3.tooltip{
|
||||||
.qoute{
|
.qoute{
|
||||||
font-family: monospace;
|
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%;
|
||||||
|
}
|
||||||
|
|
@ -468,6 +468,12 @@ select.panel-head-element{
|
||||||
color: var(--accent1);
|
color: var(--accent1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* psa */
|
||||||
|
#psa-container{
|
||||||
|
border: 3px solid var(--danger0);
|
||||||
|
background-color: var(--danger0-alt2);
|
||||||
|
}
|
||||||
|
|
||||||
/* tooltip */
|
/* tooltip */
|
||||||
div.tooltip{
|
div.tooltip{
|
||||||
background-color: var(--bg1);
|
background-color: var(--bg1);
|
||||||
|
|
@ -648,3 +654,4 @@ div.altcha{
|
||||||
altcha-widget a{
|
altcha-widget a{
|
||||||
color: var(--accent1);
|
color: var(--accent1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
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…
Reference in a new issue