E-hentai & exhentai Japanese title(fixed)

Make main listing to show japanese title if avaliable

Tính đến 13-10-2020. Xem phiên bản mới nhất.

  1. // ==UserScript==
  2. // @name E-hentai & exhentai Japanese title(fixed)
  3. // @name:zh-TW E-hentai & exhentai 日語標題
  4. // @name:ja E-hentai & exhentai 日本語作品名(修正版)
  5. // @namespace wonderlife
  6. // @description Make main listing to show japanese title if avaliable
  7. // @description:zh-tw 在 e-hentai 及 ex-hentai 主要列表顯示日語標題 (如果上傳者有設定的話)。
  8. // @description:ja e-hentai と exhentai のリストに日本語タイトルを表示する。
  9. // @include http://exhentai.org/*
  10. // @include https://exhentai.org/*
  11. // @include http://g.e-hentai.org/*
  12. // @include https://g.e-hentai.org/*
  13. // @version 1.5.1
  14. // @grant unsafeWindow
  15. // @require https://code.jquery.com/jquery-3.5.1.min.js
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. var link_nodes = {};
  22. var gidlist = [];
  23. var link_exp = /\/g\/(.*)\/(.*)\//;
  24.  
  25. jQuery("div.gl1t > a").each(function(){
  26. var parts = link_exp.exec($(this).attr('href'));
  27. if(parts === null) {
  28. return;
  29. }
  30. parts.shift();
  31. parts[0] = parseInt(parts[0], 10);
  32. gidlist.push(parts);
  33. link_nodes[parts[0]] = this;
  34. });
  35.  
  36. if(gidlist.length !== 0){
  37. var payload = JSON.stringify({"method":"gdata", "gidlist":gidlist});
  38.  
  39. $.ajax({
  40. url: "/api.php",
  41. type: "POST",
  42. data: payload,
  43. contentType: "application/json; charset=utf-8",
  44. dataType: "json",
  45. success: function(data){
  46. $.each(data.gmetadata, function(i, v){
  47. if(v.title_jpn === "") {
  48. return;
  49. }
  50. jQuery(link_nodes[v.gid]).html('<div class="gl4t glname glink">' + v.title_jpn + '</div>');
  51. });
  52. }
  53. });
  54. }
  55. })();