b.hatena on atnd

  • /*
     * @title b.hatena on atnd
     * @description atnd の #post-body のリンクのはてなブックマーク数を表示
     * @include http://atnd.org/events/*
     */
    
    // for 拡散お願いしますアドベントカレンダー2012 #拡散お願いします : ATND http://atnd.org/events/34752
    // example http://cache.gyazo.com/f9f9d298686ad7899da3e5741288fb50.png (2012/12/19時点)
    
    // cf http://blog.webcreativepark.net/2007/06/10-234711.html
    // cf http://d.hatena.ne.jp/Hamachiya2/20090910/bookmarklet
    // add hatena star cf http://let.hatelabo.jp/taizooo/let/gYC-yv6JlpXGeA
    
    (function () {
      //var anchors = document.getElementsByTagName("a");
      var anchors = document.querySelectorAll("#post-body a, #comments-content a");
      for (var i = 0; i < anchors.length; i++) {
        var anc = anchors[i];
        var banc = document.createElement("a");
        var bimg = document.createElement("img");
        var simg = document.createElement("img");
        banc.href = "http://b.hatena.ne.jp/entry/" + anc.href.replace(/#/g, '\u002523').replace(/^http(s{0,1}):\/\//, function (a, b) {
          return b ? 's/' : ''
        });
        bimg.src = "http://b.hatena.ne.jp/entry/image/" + anc.href.replace(/#/g, '\u002523');
        banc.appendChild(bimg);
        anc.parentNode.insertBefore(banc, anc.nextSibling);
        simg.src = "http://s.st-hatena.com/entry.count.image?uri=" + encodeURIComponent(anc);
        banc.parentNode.insertBefore(simg, banc.nextSibling);
      };
    })()
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/01/04 13:02:09 - 2013-01-04
  2. 2012/12/19 15:49:49 - 2012-12-19
  3. 2012/12/19 11:34:19 - 2012-12-19
  4. 2012/12/19 11:33:44 - 2012-12-19
  5. 2012/12/19 11:32:33 - 2012-12-19
  6. 2012/12/19 11:26:52 - 2012-12-19