はてブ検索結果にHTTP記法をつける

  • /*
     * @title はてブ検索結果にHTTP記法をつける
     * @description === @title
     * @include http://b.hatena.ne.jp/search/*
     * @license MIT License
     * @require
     */
    (function () {
      var elm = document.querySelectorAll('#search-result-lists h3 > a[href]');
      var link, title, i, nd = [];
      for (i = 0; i < elm.length; i++) {
        link = elm[i].getAttribute('href');
        title = elm[i].getAttribute('title');
        nd[i] = document.createElement('input');
        nd[i].type = 'text';
        nd[i].value = '[' + link + ':title=' + title + ':bookmark]';
        nd[i].setAttribute('readonly', 'true');
        nd[i].setAttribute('onclick', 'this.select();');
        elm[i].parentNode.appendChild(nd[i]);
      }
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/08/18 08:55:46 - 2014-08-18
  2. 2014/08/18 08:52:55 - 2014-08-18