E-H GIF Filter

Find which pages of a gallery are animated.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name           E-H GIF Filter
// @description    Find which pages of a gallery are animated.
// @author         Hen-Tie
// @homepage       https://hen-tie.tumblr.com/
// @namespace      https://greasyfork.org/en/users/8336
// @include        /https?:\/\/(e-|ex)hentai\.org\/g\/.*/
// @require        https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js
// @icon           https://i.imgur.com/pMMVGRx.png
// @version        2.0
// ==/UserScript==

/*───────────────┬────────────────┐
│     Action     │     Value      │
├────────────────┼────────────────┤
│ Highlight GIFs │ filterMode = 0 │
│ Only show GIFs │ filterMode = 1 │
│ Click to start │ alwaysOn = 0   │
│ Always enabled │ alwaysOn = 1   │
└────────────────┴───────────────*/
var filterMode = 0;
var alwaysOn = 0;

if ($('.gdtl img[title$=".gif"]').length) {
	var notGif = $('.gdtl img:not([title$=".gif"])');
	var checked = "";

	$('<style type="text/css">.gif-filter .gif-filter-hidden {display:none;} .gif-filter .gif-filter-highlight {opacity:.33;} body:not(.gif-filter) .gif-filter-count {display:none;}</style>').appendTo('head');

	if (alwaysOn) {
		$('body').addClass('gif-filter');
		checked = 'type="checkbox" checked';
	} else {
		checked = 'type="checkbox"';
	}

	$('#gdt').prepend('<div class="gif-filter-info" style="display:block; padding:0 0 .5em; width:100%; text-align:center;"><label><input ' + checked + ' class="gif-filter-toggle" style="top:0;"/> E-H GIF Filter</label></div>');
	if (filterMode) {
		notGif.closest('.gdtl').addClass('gif-filter-hidden');
		$('.gif-filter-info').append('<span class="gif-filter-count">—' + notGif.length + ' hidden</span>');
	} else {
		notGif.addClass('gif-filter-highlight');
	}
}

$('.gif-filter-toggle').click(function() {
	$('body').toggleClass('gif-filter');
});