E-H Search for nhentai Favorites

Quickly move favourite from nhentai back to e-hentai/exhentai.

目前为 2018-11-04 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name E-H Search for nhentai Favorites
  3. // @description Quickly move favourite from nhentai back to e-hentai/exhentai.
  4. // @author Hen Tie
  5. // @homepage https://hen-tie.tumblr.com/
  6. // @namespace https://greasyfork.org/en/users/8336
  7. // @include https://nhentai.net/favorites/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js
  9. // @icon https://i.imgur.com/8bq1S92.jpg
  10. // @version 1.3
  11. // ==/UserScript==
  12.  
  13. $(function(){
  14. var galTitle = []
  15. var url = "https://exhentai.org/?f_search="
  16. $('.gallery-favorite .caption').each(function(){
  17. var str = $(this).text();
  18. str = str.replace(/[\][(){}|\-~."'!?+*%:$]/igm,' ') //replace search operators and punctuation/formatting characters
  19. str = str.replace(/ \w{1,2}\b/igm,'') //remove 1 or 2 char keywords, too short to search
  20. str = str.replace(/ {2,}/igm,' ') //compress 2+ spaces into just one
  21. str = str.replace(/^ (?=.*$)/igm,'') //remove leading space
  22. var isEng = str.match(/english/gi) //check for language
  23. if (isEng !== null) {
  24. str = str.replace(isEng[0],''); //remove lang
  25. str = isEng[0] + ' ' + str; //prepend lang
  26. str = str.replace(/ {2,}/igm,' ') //compress 2+ spaces into just one
  27. }
  28. galTitle.push(str);
  29. })
  30. $('.remove-button').each(function(i) {
  31. $(this).after('<button class="btn btn-primary btn-thin" title="Search on Ex-Hentai">' +
  32. '<a href="' + url + galTitle[i] + '">' +
  33. '<i class="fa fa-external-link"></i>' +
  34. '</a>' +
  35. '</button>');
  36. })
  37. })