mugLink -> tumblrLink

  • /*
     * @title mugLink -> tumblrLink
     * @description tumblrマグカップ(https://suzuri.jp/taizooo/ productID:26413-42785)のリンクをtumblrのリンクに書き換える。
     * @include https://suzuri.jp/taizooo/
     * @license reblog commons license ( cc by 3.0 )
     * @javascript_url
     */
    
    (function() {
      var changeItemLinkToTumblrLink = function () {
        var titles = document.querySelectorAll('h1.material-title');
        if (!titles) return;
        for (var i = 0,length = titles.length; i < length; i++) {
          var userPage = titles[i].innerText.match(/^[\w\/:%#\$&\?~\.=\+\-]+$/);
          if (userPage) {
            titles[i].parentNode.parentNode.href = 'http://' + userPage[0] + '/';
          }
        }
      };
      changeItemLinkToTumblrLink();
    
      var timer = 0;
      document.addEventListener('DOMNodeInserted', function() {
        if (timer) return;
        timer = setTimeout(function() {
          changeItemLinkToTumblrLink();
          timer = 0;
        }, 500);
      }, false);
    }());
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/06/09 18:59:16 - 2014-06-09
  2. 2014/06/09 16:00:12 - 2014-06-09