G.E Auto Note Favourites

Fills the notes section with the gallery's tags

Versione datata 28/09/2017. 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        G.E Auto Note Favourites
// @description Fills the notes section with the gallery's tags
// @author      Hen Tie
// @homepage    http://hen-tie.tumblr.com/
// @namespace   https://greasyfork.org/en/users/8336
// @include     http://e-hentai.org/gallerypopups.php?gid=*
// @include     https://e-hentai.org/gallerypopups.php?gid=*
// @include     http://exhentai.org/gallerypopups.php?gid=*
// @include     https://exhentai.org/gallerypopups.php?gid=*
// @run-at      document-start
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @icon        https://i.imgur.com/RPv1X1r.png
// @version     3.0
// ==/UserScript==

	/*╔════════════════╦═══════════════════╦════════════════════╦═════════════════╗
	  ║ Namespace List ║ Includes/Ordering ║    Tag Filters     ║     Notice      ║
	  ╠════════════════╬═══════════════════╬════════════════════╬═════════════════╣
	  ║ reclass        ║ edit line 49,     ║ edit line 51,      ║ misc namespace  ║
	  ║ language       ║ format:           ║ format:            ║ requires        ║
	  ║ parody         ║ x + y + z;        ║ (/tag1|tag2/g, '') ║ helper script:  ║
	  ║ character      ║                   ║                    ║ greasyfork.org/ ║
	  ║ group          ║                   ║                    ║ scripts/8281    ║
	  ║ artist         ║                   ║                    ║                 ║
	  ║ male           ║                   ║                    ║                 ║
	  ║ female         ║                   ║                    ║                 ║
	  ║ misc           ║                   ║                    ║                 ║
	  ╚════════════════╩═══════════════════╩════════════════════╩═════════════════╝*/

jQuery(document).ready(function ($) {
	//onclick in popup window
	$('input[type="radio"]').click(function () {
		//naviate to parent window, get all tags, delineate with zero-width spaces
		//this is the on-site order
		var reclass = $('#taglist a[id^="ta_reclass"]', window.opener.document).append('​').text();
		var language = $('#taglist a[id^="ta_language"]', window.opener.document).append('​').text();
		var parody = $('#taglist a[id^="ta_parody"]', window.opener.document).append('​').text();
		var character = $('#taglist a[id^="ta_character"]', window.opener.document).append('​').text();
		var group = $('#taglist td[class=""]+td a[id^="ta_group"]', window.opener.document).append('​').text();
		var artist = $('#taglist a[id^="ta_artist"]', window.opener.document).append('​').text();
		var male = $('#taglist a[id^="ta_male"]', window.opener.document).append('​').text();
		var female = $('#taglist a[id^="ta_female"]', window.opener.document).append('​').text();
		//helper script needed: greasyfork.org/en/scripts/8281
		var misc = $('#taglist td#miscid+td a', window.opener.document).append('​').text();
		//set included tags and their order
		var str = parody + group + artist + female + male + misc;
		//set tags to remove
		str = str.replace(/full censorship|mosaic censorship|incomplete|out of order|scanmark|poor grammar/g, '');
		//convert to underscored tag format
		str = str.replace(/ /g, '_');
		//delineate tags with commas
		str = str.replace(/\u200B/g, ', ');
		//prevent double commas
		str = str.replace(/(, )+/g, ', ');
		//remove comma from final tag
		str = str.substr(0, str.length - 2);
		$('textarea').val(str);
	});
	//erases notes when remove button is clicked
	$('div[onclick*="favdel"]').click(function () {
		$('textarea').val('');
	});
	//keyboard shortcuts
	document.onkeyup = checkNumber;
	function checkNumber(e) {
		e = e || window.event;
		if (e.keyCode == '13') {
			//return key submits popup
			$('.stdbtn') [0].click();
		}
	}
});