E-H Better Gallery Hiding

Hide galleries based on flags, uploader, ongoing status. Displays a count notice.

2019-02-17 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name           E-H Better Gallery Hiding
// @description    Hide galleries based on flags, uploader, ongoing status. Displays a count notice.
// @author         Hen Tie
// @homepage       https://hen-tie.tumblr.com/
// @namespace      https://greasyfork.org/en/users/8336
// @include        /https?:\/\/(e-|ex)hentai\.org\/?(\?page=.*)?(\?f_.*)?/
// @exclude        https://e-hentai.org/favorites.php?*
// @grant          none
// @require        https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js
// @icon           https://i.imgur.com/pMMVGRx.png
// @version        2.6
// ==/UserScript==

/*───────────────────┐
│   CONFIGURATION    │
├────────────────────┼──────────────────────────┬──────────────────────────────┐
│  uploader hiding   │       title hiding       │         flag hiding          │
├────────────────────┼──────────────────────────┼──────────────────────────────┤
│ edit "var blocked" │ edit "var hidePixiv"     │ needs tag flagging hath perk │
│ case insensitive   │ edit "var hideOngoing"   │ fully hides, no placeholder  │
│ format:            │ edit "var hidePortfolio" │                              │
│ ['user1','user2']  │ format:                  │                              │
│                    │ true/false               │                              │
└────────────────────┴──────────────────────────┴─────────────────────────────*/
var blocked = [];
var hidePixiv = false;
var hideOngoing = false;
var hidePortfolio = false;
/*────────────────────────────────────────────────────────────────────────────*/

//track removed galleries
var removed, fRemoved, uRemoved, oRemoved, pRemoved, aRemoved;
removed = fRemoved = uRemoved = oRemoved = pRemoved = aRemoved = 0;

//list view filters
if($('.gtr0').length > 0) {
	$('.gtr0, .gtr1').each(function() {
		var uploader = $(this).find('.itu a').text().toLowerCase();
		var galTitle = $(this).find('.it5 a').text();

		$.each(blocked, function(index,value) {
			blocked[index] = value.toLowerCase();
		});

		//tag flagged
		//gallery without hover data has been tag flagged and hidden
		if ($(this).find('.it5 a').not('[onmouseover]').length > 0) {
			$(this).remove();
			removed++, fRemoved++;
		}
		//uploader blocked
		else if ($.inArray(uploader, blocked) !== -1) {
			$(this).remove();
			removed++, uRemoved++;
		}
		//ongoing gallery
		else if(/ongoing/i.test(galTitle) && hideOngoing) {
			$(this).remove();
			removed++, oRemoved++;
		}
		//pixiv gallery
		else if(/pixiv/i.test(galTitle) && hidePixiv) {
			$(this).remove();
			removed++, pRemoved++;
		}
		//artist gallery
		else if(/artist - /i.test(galTitle) && hidePortfolio) {
			$(this).remove();
			removed++, aRemoved++;
		}
	});
}
//thumbnail view filters
else if($('.id1').length > 1) {
	$('.id1').each(function() {
		var galTitle = $(this).find('.id2 a').text();

		//tag flagged
		//gallery with blank.gif cover has been flagged and hidden
		if ($(this).find('.id3 img[src="https://exhentai.org/img/blank.gif"]').length > 0) {
			$(this).remove();
			removed++, fRemoved++;
		}
		//ongoing gallery
		else if(/ongoing/i.test(galTitle) && hideOngoing) {
			$(this).remove();
			removed++, oRemoved++;
		}
		//pixiv gallery
		else if(/pixiv/i.test(galTitle) && hidePixiv) {
			$(this).remove();
			removed++, pRemoved++;
		}
		//artist gallery
		else if(/artist - /i.test(galTitle) && hidePortfolio) {
			$(this).remove();
			removed++, aRemoved++;
		}
	});
}

//display removed count with mouseover data
if (removed > 0) {
	var removedInfo = 'Flagged:'+fRemoved+' Uploader:'+uRemoved+' Ongoing:'+oRemoved+' Pixiv:'+pRemoved+' Artist:'+aRemoved;
	$('p.ip').append('<span>'+' | <span class="hiddenCount" title="'+removedInfo+'">Hiding '+removed+'</span></span>');
	$('.hiddenCount').css('border-bottom','1px dotted currentColor');
}