☆ with icon

    @@ -8,32 +8,32 @@ */ (function(){ - var iconize = function () { - var containers = document.querySelectorAll('.hatena-star-star-container a'); - for (var i = 0, length = containers.length; i < length; i++) { - if (containers[i].hasAttribute('iconized')) continue; - var user = containers[i].href.replace(/^http:\/\/(b|bkuma)\.hatena\.ne\.jp\//, '').replace(/\/$/, ''); - var icon = document.createElement('img'); - icon.src = 'http://cdn1.www.st-hatena.com/users/' + user.substr(0, 2) + '/' + user + '/profile.gif'; - icon.setAttribute('style', 'height:16px;position:absolute;width:16px;'); - var star = containers[i].querySelector('.hatena-star-star'); - star.style['position'] = 'absolute'; - star.style['bottom'] = '1px'; - star.style['opacity'] = '0.7'; - // star.style['width'] = '7px'; - containers[i].insertBefore(icon, star); - containers[i].setAttribute('iconized', ''); - containers[i].style['width'] = '16px'; - containers[i].style['height'] = '16px'; - containers[i].style['position'] = 'relative'; - containers[i].style['display'] = 'inline-block'; - containers[i].style['margin'] = '0 1px 0 1px'; - //containers[i].style['padding-top'] = '1px'; - //containers[i].style['top'] = '10px'; - } - }; - iconize(); - var timer = 0; + var iconize = function () { + var containers = document.querySelectorAll('.hatena-star-star-container a'); + for (var i = 0, length = containers.length; i < length; i++) { + if (containers[i].hasAttribute('iconized')) continue; + var user = containers[i].href.replace(/^http:\/\/(b|bkuma)\.hatena\.ne\.jp\//, '').replace(/\/$/, ''); + var icon = document.createElement('img'); + icon.src = 'http://cdn1.www.st-hatena.com/users/' + user.substr(0, 2) + '/' + user + '/profile.gif'; + icon.setAttribute('style', 'height:16px;position:absolute;width:16px;'); + var star = containers[i].querySelector('.hatena-star-star'); + star.style['position'] = 'absolute'; + star.style['bottom'] = '1px'; + star.style['opacity'] = '0.7'; + // star.style['width'] = '7px'; + containers[i].insertBefore(icon, star); + containers[i].setAttribute('iconized', ''); + containers[i].style['width'] = '16px'; + containers[i].style['height'] = '16px'; + containers[i].style['position'] = 'relative'; + containers[i].style['display'] = 'inline-block'; + containers[i].style['margin'] = '0 1px 0 1px'; + //containers[i].style['padding-top'] = '1px'; + //containers[i].style['top'] = '10px'; + } + }; + iconize(); + var timer = 0; document.addEventListener('DOMNodeInserted', function() { if(timer) return; timer = setTimeout(function() {
  • /*
     * @title ☆ with icon
     * @description ブックマークについてる☆をアイコンにする
     * @include http://b.hatena.ne.jp/*
     * @include http://bkuma.hatena.ne.jp/*
     * @license MIT License
     * @require 
     */
    
    (function(){
      var iconize = function () {
        var containers = document.querySelectorAll('.hatena-star-star-container a');
        for (var i = 0, length = containers.length; i < length; i++) {
          if (containers[i].hasAttribute('iconized')) continue;
          var user = containers[i].href.replace(/^http:\/\/(b|bkuma)\.hatena\.ne\.jp\//, '').replace(/\/$/, '');
          var icon = document.createElement('img');
          icon.src = 'http://cdn1.www.st-hatena.com/users/' + user.substr(0, 2) + '/' + user + '/profile.gif';
          icon.setAttribute('style', 'height:16px;position:absolute;width:16px;');
          var star = containers[i].querySelector('.hatena-star-star');
          star.style['position'] = 'absolute';
          star.style['bottom'] = '1px';
          star.style['opacity'] = '0.7';
          // star.style['width'] = '7px';
          containers[i].insertBefore(icon, star);
          containers[i].setAttribute('iconized', '');
          containers[i].style['width'] = '16px';
          containers[i].style['height'] = '16px';
          containers[i].style['position'] = 'relative';
          containers[i].style['display'] = 'inline-block';
          containers[i].style['margin'] = '0 1px 0 1px';
          //containers[i].style['padding-top'] = '1px';
          //containers[i].style['top'] = '10px';
        }
      };
      iconize();
      var timer  = 0;
      document.addEventListener('DOMNodeInserted', function() {
        if(timer) return;
        timer = setTimeout(function() {
          iconize();
          timer = 0;
        }, 500);
      }, false);
    }());
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/12/10 14:40:44 - 2014-12-10
  2. 2014/12/10 14:40:21 - 2014-12-10
  3. 2014/12/10 14:33:32 - 2014-12-10
  4. 2014/05/28 22:55:18 - 2014-05-28
  5. 2014/05/17 23:53:51 - 2014-05-17
  6. 2014/05/17 23:25:24 - 2014-05-17
  7. 2014/05/17 23:01:48 - 2014-05-17
  8. 2014/05/17 22:18:32 - 2014-05-17
  9. 2014/05/17 22:08:14 - 2014-05-17
  10. 2014/05/17 21:46:25 - 2014-05-17
  11. 2014/05/17 21:46:05 - 2014-05-17