E-hentai & exhentai Japanese title

Make main listing to show japanese title if avaliable

// ==UserScript==
// @name        E-hentai & exhentai Japanese title
// @name:zh-TW  E-hentai & exhentai 日語標題
// @name:ja     E-hentai & exhentai 日本語作品名
// @namespace   tw.nya.hentai_jpn_title
// @description Make main listing to show japanese title if avaliable
// @description:zh-tw 在 e-hentai 及 ex-hentai 主要列表顯示日語標題 (如果上傳者有設定的話)。
// @description:ja e-hentai と exhentai のリストに日本語タイトルを表示する。
// @include     http://exhentai.org/*
// @include     https://exhentai.org/*
// @include     http://g.e-hentai.org/*
// @include     https://g.e-hentai.org/*
// @version     1.5
// @grant       unsafeWindow
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==

var link_nodes = {};
var gidlist = [];
var link_exp = /\/g\/(.*)\/(.*)\//;

jQuery("td.itd a, div.id2 a").each(function(){
  parts = link_exp.exec($(this).attr('href'));
  if(parts === null)
    return;

  parts.shift();
  parts[0] = parseInt(parts[0], 10);
  gidlist.push(parts);
  link_nodes[parts[0]] = this;
});

if(gidlist.length !== 0){
  payload = JSON.stringify({"method":"gdata", "gidlist":gidlist});

  $.ajax({
    url: "/api.php",
    type: "POST",
    data: payload,
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(data){
      $.each(data.gmetadata, function(i, v){
        if(v.title_jpn === "")
          return;
        jQuery(link_nodes[v.gid]).html(v.title_jpn);
      });
    }
  });
}