DeviantBlocker

DeviantArt gallery - block images from selected artists

Versione datata 12/12/2015. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name DeviantBlocker
// @namespace brandrock.co.za
// @description DeviantArt gallery - block images from selected artists
// @include http://www.deviantart.com/
// @include http://www.deviantart.com/?*
// @include http://browse.deviantart.com/*
// @include http://www.deviantart.com/browse/*
// @include https://www.deviantart.com/
// @include https://www.deviantart.com/?*
// @include https://browse.deviantart.com/*
// @include https://www.deviantart.com/browse/*
// @version 1.1
// @grant GM_log
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==

// This work is licensed under the Creative Commons Attribution 2.0 Generic License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by/2.0/.

var blacklist = GM_getValue('DAGbl', '|');
var thumbs = document.getElementsByTagName('IMG');

for(var i = thumbs.length; i--;) {
	var img = thumbs[i];
	if (img.getAttribute('data-src')){
		var div = img.parentNode;
		while (!(div.tagName == 'DIV' && div.getAttribute('userid')>'')) {
			div = div.parentNode;
		}
		var username = div.getAttribute('username');
		var userid = div.getAttribute('userid');
		var useridD = '|' + userid + '|'
		var elem = document.createElement('button');
		elem.type = 'button';
		elem.userid = userid;
		elem.username = username;
		elem.title = 'Click to hide/show images from this artist';
		elem.img = img;
		elem.innerHTML = username;
		if (blacklist.indexOf(useridD) > -1){
			img.style.visibility = 'hidden';
			elem.addEventListener('click', function(){
				this.img.style.visibility = 'visible';
				blacklist = blacklist.replace(this.userid + '|', '');
				GM_setValue('DAGbl', blacklist);
				//alert(this.username + ' allowed');
			});
		} else {
			elem.addEventListener('click', function(){
				this.img.style.visibility = 'hidden';
				blacklist = blacklist + this.userid + '|';
				GM_setValue('DAGbl', blacklist);
				//alert(this.username + ' blocked');
			});
		}
		catSpan = div.querySelector(".category");
		catSpan.parentNode.insertBefore(elem, catSpan);
	}
}