Greasy Fork is available in English.

Usuwanie reklam Allegro

Usuwa wszystkie reklamy na Allegro.pl, które nie są blokowane przez zwykłe blokery reklam, np. "Sponsorowane produkty" i "sponsorowane" boksy.

Zainstaluj skrypt?
Skrypt zaproponowany przez autora

Może Ci się również spodobać. Przywrócenie logo Allegro

Zainstaluj skrypt
// ==UserScript==
// @name            Usuwanie reklam Allegro
// @name:en         Remove Allegro ads
// @namespace       http://tampermonkey.net/
// @version         0.6.0.0
// @description     Usuwa wszystkie reklamy na Allegro.pl, które nie są blokowane przez zwykłe blokery reklam, np. "Sponsorowane produkty" i "sponsorowane" boksy.
// @description:en  Aims to remove all ads on Allegro.pl not blocked by regular ad blockers, like "Sponsorowane produkty" and "sponsorowane" ad boxes.
// @author          adamaru
// @match           *://allegro.pl/*
// @icon            https://www.google.com/s2/favicons?sz=64&domain=allegro.pl
// @grant           none
// @license         MIT
// ==/UserScript==

(function() {
	'use strict';
	var running = false;
	var logging = false;

	function removeAllegroAds(mutations){
		if(mutations){
			var ignoreMutation = false;
			// skip removing ads when changes were made only to countdowns
			mutations.forEach(function(mutation) {
				var i, node;

				for (i = 0; i < mutation.addedNodes.length; i++) {
					node = mutation.addedNodes[i];
					if(!node.className || !node.className.indexOf || node.className.indexOf('countdown') !== -1){
						ignoreMutation = true;
						return;
					}
				}

				for (i = 0; i < mutation.removedNodes.length; i++) {
					node = mutation.removedNodes[i];
					if(!node.className || !node.className.indexOf || node.className.indexOf('countdown') !== -1){
						ignoreMutation = true;
						return;
					}
				}
			});
			if(ignoreMutation){
				// only countdown changes, skip
				return;
			}
		}

		if(running){
			// already running, skip
			return;
		}
		running = true;

		log("triggered");

		removeAllegroPremiumAds();
		removeAllegroOfferAds();
		removeAllegroSponsoredAds();
		removeAllegroAdArticles();

		running = false;
	}

	function log(...args){
		if(logging){
			console.log(...args);
		}
	}

	function removeAllegroOfferAds(){
		var adsBoxes = document.querySelectorAll('div[data-box-name*="_ads"],div[data-box-name="seoLazyBelowFilters"]');
		for(var i = 0; i < adsBoxes.length; ++i){
			if(adsBoxes[i].style.display === "none"){
				continue;
			}
			log("hiding offer ad", adsBoxes[i]);
			adsBoxes[i].style.display = "none";
		}
	}

	function removeAllegroSponsoredAds(){
		var spansToCheck = document.querySelectorAll('section[class^="_"] > div[class]');
		for(var i = 0; i < spansToCheck.length; ++i){
			if(spansToCheck[i].innerHTML.indexOf('sponsorowane') !== -1){
				if(spansToCheck[i].parentNode.style.display === "none"){
					continue;
				}
				log("hiding sponsored ad", spansToCheck[i]);
				spansToCheck[i].parentNode.style.display = "none";
			}
		}

		var sponsoredAdsV3 = document.querySelectorAll('div[data-box-name="items-v3"] article[data-analytics-view-custom-context="SPONSORED"]');
		for(var j = 0; j < sponsoredAdsV3.length; ++j){
			if(sponsoredAdsV3[j].style.display === "none"){
				continue;
			}
			log("hiding sponsored ad v3", sponsoredAdsV3[j]);
			sponsoredAdsV3[j].style.display = "none";
		}
	}

	function removeAllegroAdArticles(){
		var adArticles = document.querySelectorAll('article[data-analytics-view-label="showSponsoredItems"]');
		for(var i = 0; i < adArticles.length; ++i){
			if(adArticles[i].style.display === "none"){
				continue;
			}
			log("hiding ad article", adArticles[i]);
			adArticles[i].style.display = "none";
		}
	}

	function removeAllegroPremiumAds(){
		var premiumAds = document.querySelectorAll('div[data-box-name^="premium.with.dfp"],div[data-box-name="layout.advertisement"]');
		for(var i = 0; i < premiumAds.length; ++i){
			if(premiumAds[i].style.display === "none"){
				continue;
			}
			log("hiding premium ad", premiumAds[i]);
			premiumAds[i].style.display = "none";
		}
	}

	removeAllegroAds(null);
	//setInterval(removeAllegroAds, 10000);

	var observer = new MutationObserver(removeAllegroAds);
	var config = {childList: true, subtree: true, attributes: true};
	observer.observe(document.body, config);
})();