E-H Auto Note Favourites

Fills the notes section with the gallery's tags

  1. // ==UserScript==
  2. // @name E-H Auto Note Favourites
  3. // @description Fills the notes section with the gallery's tags
  4. // @author Hen Tie
  5. // @homepage https://hen-tie.tumblr.com/
  6. // @namespace https://greasyfork.org/en/users/8336
  7. // @include https://e-hentai.org/gallerypopups.php?gid=*
  8. // @include https://exhentai.org/gallerypopups.php?gid=*
  9. // @include https://e-hentai.org/g/*
  10. // @include https://exhentai.org/g/*
  11. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
  12. // @icon https://i.imgur.com/pMMVGRx.png
  13. // @version 4.2
  14. // ==/UserScript==
  15.  
  16. /*╔═════════════════════╦════════════════════╦════════════════════╗
  17. ║ Namespace Reference ║ Namespace Includes ║ Tag Filtering ║
  18. ╠═════════════════════╬════════════════════╬════════════════════╣
  19. ║ reclass ║ On line 50. ║ On line 52. ║
  20. ║ language ║ Format: ║ Format: ║
  21. ║ parody ║ female + male; ║ (/tag1|tag2/g, '') ║
  22. ║ character ║ ║ ║
  23. ║ group ║ ║ ║
  24. ║ artist ║ ║ ║
  25. ║ male ║ ║ ║
  26. ║ female ║ ║ ║
  27. ║ misc ║ ║ ║
  28. ╚═════════════════════╩════════════════════╩════════════════════╝*/
  29.  
  30. $("#taglist table td:contains('misc:')").attr('id', 'miscid');
  31. //onclick in popup window
  32. $('input[type="radio"][name="favcat"]').click(function () {
  33. //navigate to parent window, get all tags, delineate with zero-width spaces
  34. //this is the on-site order
  35. var reclass = $('#taglist a[id^="ta_reclass"]', window.opener.document).append('​').text();
  36. var language = $('#taglist a[id^="ta_language"]', window.opener.document).append('​').text();
  37. var parody = $('#taglist a[id^="ta_parody"]', window.opener.document).append('​').text();
  38. var character = $('#taglist a[id^="ta_character"]', window.opener.document).append('​').text();
  39. var group = $('#taglist td[class=""]+td a[id^="ta_group"]', window.opener.document).append('​').text();
  40. var artist = $('#taglist a[id^="ta_artist"]', window.opener.document).append('​').text();
  41. var male = $('#taglist a[id^="ta_male"]', window.opener.document).append('​').text();
  42. var female = $('#taglist a[id^="ta_female"]', window.opener.document).append('​').text();
  43. var misc = $('#taglist td#miscid+td a', window.opener.document).append('​').text();
  44. //set included tag namespaces and their order
  45. var str = reclass + language + parody + character + group + artist + male + female + misc;
  46. //set tags to remove
  47. str = str.replace(/full censorship|mosaic censorship|incomplete|out of order|scanmark|poor grammar/g, '');
  48. //convert to underscored tag format
  49. str = str.replace(/ /g, '_');
  50. //delineate tags with commas
  51. str = str.replace(/\u200B/g, ', ');
  52. //prevent double commas
  53. str = str.replace(/(, )+/g, ', ');
  54. //remove comma from final tag
  55. str = str.substr(0, str.length - 2);
  56. $('textarea').val(str);
  57. });
  58. //erases notes when remove button is clicked
  59. $('div[onclick*="favdel"]').click(function () {
  60. $('textarea').val('');
  61. });