TvTroper

Blocking ads and popup on TvTropes.org

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name     TvTroper
// @namespace tvtroper_1773095933
// @version  1.2
// @grant    none
// @author 	 LuaMaria (GreasyFork Version)
// @include	 *://tvtropes.org/*
// @description Blocking ads and popup on TvTropes.org
// @run-at 	 document-end
// @icon		https://assets.tvtropes.org/img/icons/apple-icon-180x180.png
// @license   LGPL-3.0-or-later
// ==/UserScript==

/*
  This program is free software: 
  you can redistribute it and/or modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
  < https://www.gnu.org/licenses/lgpl-3.0.html >. 
*/


//Last Update = March 18, 2026

'use strict';

const init = '##TVTroper is Active!';
console.warn(init);
//alert(init);

function id(str){
    return document.getElementById(str);
}

function sa(str){
    return document.querySelectorAll(str); 
}

const old_content = id('main-entry');

console.clear();

function blast(){
    //remove that pesky anti ad-block
    setTimeout( function(){
	console.clear();
	console.warn('restored', old_content);
	id('main-entry').innerHTML = old_content.innerHTML;
    }, 1000);

    //remove that sidebar ad
    id('stick-cont').remove();
    const sidebar_ad_class = '.tvtropes-ad-unit';
    const cursed_ad = sa(sidebar_ad_class);
    cursed_ad.forEach( s => {
	alert(s);
	console.log(s);
	s.style.display = 'none';
    });
}

blast();
let checking_counter = 0;
let checking_max_retries = 10;
const keep_checking = setInterval( function(){
    const anti_adblock = document.getElementById('adblock_title');
    if(anti_adblock){
	console.warn('they block you');
	blast();
	return;
    }else{
   	console.warn('you bypassed it hehe');
    }
    
    checking_counter ++;
    if(checking_counter > checking_max_retries){
	console.clear();
   	clearInterval(keep_checking);
	console.warn("Unblocking is done!");
    }
}, 1000);