🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/22 00:04:14
🔄 下次更新时间:2026/01/22 01:04:14
手动刷新缓存

DeviantBlocker

DeviantArt gallery - block images from selected artists in Eclipse

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

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

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name DeviantBlocker
// @namespace brandrock.co.za
// @author Peter Brand
// @description DeviantArt gallery - block images from selected artists in Eclipse
// @license GNU GPLv3
// @include http://www.deviantart.com/*
// @include https://www.deviantart.com/*
// @version 4.3
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-start
// ==/UserScript==

// @grant GM_log
(function() {
	//first time scan on load
	document.addEventListener ('DOMContentLoaded', pageInit);
	
	function buttonAdd(parent, label, title, style, clickEvent){
		var elem = document.createElement('button');
		elem.type = 'button';
		elem.style = style;
		elem.style.zIndex = '99';
		elem.style.position = 'absolute';
		elem.title = title;
		elem.innerHTML = label;
		parent.appendChild(elem);
		elem.addEventListener('click', clickEvent);
		return elem;
	}
	
	function pageInit() {
		//button to reveal blacklist
		var bdiv = document.getElementById('root');
		var blackText = document.createElement('textarea');
		blackText.style = 'position: absolute; display: none; top:100px; right: 0px; z-index: 99;';
		bdiv.appendChild(blackText);
		buttonAdd(bdiv, '?DAB', 'Click to show blacklisted artists'
			, 'top:0px; right: 0px', function(e){
			var blacklist = GM_getValue('DAGbl2', '|');
			blackText.innerHTML = blacklist;
			blackText.style.display='inline-block';
		});
		blackText.addEventListener('change', function (){
			GM_setValue('DAGbl2', blackText.value)
		});
	}
	
	function scanImages() {
		var blacklist = GM_getValue('DAGbl2', '|');
		var artSecs = document.querySelectorAll('._2YkEf');
		GM_setValue('DAGdebug', artSecs.length);
		var count = 0;
		//scan all artists sections
		for(var i = artSecs.length; i--;) {
      var artLink = artSecs[i].querySelector('a[data-username]');
			var artist = artLink.getAttribute('data-username');
			var img = artSecs[i].querySelector('img');
			//quick check to see if src has been specified and haven't done this image already
			if (!img.devblok && img.getAttribute('src')>''){
				img.devblok = true;
				img.setAttribute("data-blocked", -1);
				var elem = buttonAdd(artSecs[i], 'x', 'Click to hide/show images from this artist'
					, 'bottom:0px; right: 0px', function(e){
					artistToggle(e, this);
					});
				elem.img = img;
				img.setAttribute('data-artist', artist);
				img.artist = artist;
				var arto = '|' + artist + '|';
				if (blacklist.indexOf(arto) > -1){
					imgHide(img);
					img.isBlocked = true;
					img.setAttribute('data-blocked', 1);
					count++;
				} else {
					img.isBlocked = false;
					img.setAttribute('data-blocked', 0);
				}
			}
		}
	}

	function artistToggle(e, button) {
		//show or hide the images for this artist
		var i, img;
		var blacklist = GM_getValue('DAGbl2', '|');
		var thumbs = document.querySelectorAll('img[data-artist=\'' + button.img.artist + '\']');
		if (button.img.isBlocked){
			//remove from blacklist string - could have used an array, but string is fast enough
			blacklist = blacklist.replace(button.img.artist + '|', '');
			GM_setValue('DAGbl2', blacklist);
			//scan page for all images for this artist and show them
			for(i = thumbs.length; i--;) imgShow(thumbs[i]);
			button.img.isBlocked = false;
		} else {
			//add to blacklist
			blacklist = blacklist + button.img.artist + '|';
			GM_setValue('DAGbl2', blacklist);
			//scan page for all images for this artist and hide them
			for(i = thumbs.length; i--;) imgHide(thumbs[i]);
			button.img.isBlocked = true;
		}
		var event = e || window.event;
		if (!event) return;
		event.cancelBubble = true;
		if (event.stopPropagation) event.stopPropagation();
	}
	function imgHide(img){
		//img.style.opacity = '0.05';
		img.style.visibility = 'hidden';
	}
	function imgShow(img){
		//img.style.opacity = '1';
		img.style.visibility = 'visible';
	}
	setInterval(function() {scanImages();}, 1000);
}
)();