TvTroper

Blocking ads and popup on TvTropes.org

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==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);