bookmarklet

    @@ -30,6 +30,8 @@ var length = elms.length; for(i = 0; i < length; ++i){ elm = elms[i]; + if ( elm.getElementsByClassName('popupSrc')[0] ) + continue; html = elm.innerHTML; var idx = html.search("#[0-9]{7}"); if ( idx < 0 ) continue; @@ -37,7 +39,7 @@ var targetspan = document.getElementById('comment_otherdetails_' + comm_idx ); var link_id = (i + "__" + comm_idx).trim(); var targethtml = targetspan.parentNode.parentNode.parentNode.getElementsByClassName('contents_text')[0].innerHTML; - html = html.substring(0,idx) + '<span onclick="__show(\''+ link_id +'\');" style="color:blue;">#' + html = html.substring(0,idx) + '<span onclick="__show(\''+ link_id +'\');" style="color:blue;" class="popupSrc">#' + comm_idx + '</span>' + '<div class="_popop commentBody" id="__commPopup_' + link_id + '" style="position:absolute;background-color:white;border: 1px solid brown;display:none;z-index:10;" dblclick="__hide(\'' + link_id + '\')">' + targethtml + '</div>' + html.substring(idx + 8);
  • /*
     * @title bookmarklet
     * @description my bookmarklet
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    function __show(idx)
    {
       var popup = document.getElementById('__commPopup_' + idx);
       if ( !popup ) return;
       if ( popup.style.display=='none' )
       {
          popup.style.display='';
          return;
       }
       popup.style.display='none';
    }
    function __hide(idx)
    {
       var popup = document.getElementById('__commPopup_' + idx);
       if ( !popup ) return;
       popup.style.display='none';
    }
    
    (function o()
    {
    	var elms=document.getElementsByClassName('contents_text');
            var length = elms.length;
            for(i = 0; i < length; ++i){
                elm = elms[i];
                if ( elm.getElementsByClassName('popupSrc')[0] )
                    continue;
                html = elm.innerHTML;
                var idx = html.search("#[0-9]{7}");
                if ( idx < 0 ) continue;
                var comm_idx = html.substring(idx + 1, idx + 1 + 7);
                var targetspan = document.getElementById('comment_otherdetails_' + comm_idx );
                var link_id = (i + "__" + comm_idx).trim();
                var targethtml = targetspan.parentNode.parentNode.parentNode.getElementsByClassName('contents_text')[0].innerHTML;
                html = html.substring(0,idx) + '<span onclick="__show(\''+ link_id +'\');" style="color:blue;" class="popupSrc">#' 
                       + comm_idx + '</span>'
                       + '<div class="_popop commentBody" id="__commPopup_' + link_id + '" style="position:absolute;background-color:white;border: 1px solid brown;display:none;z-index:10;" dblclick="__hide(\'' + link_id + '\')">'
                       + targethtml + '</div>' + html.substring(idx + 8);
                elm.innerHTML = html;
            }
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/06/05 12:33:01 - 2017-06-05
  2. 2017/06/05 12:29:47 - 2017-06-05
  3. 2017/06/05 12:28:11 - 2017-06-05
  4. 2017/06/05 12:26:32 - 2017-06-05
  5. 2017/06/05 12:25:23 - 2017-06-05
  6. 2017/06/05 12:24:51 - 2017-06-05
  7. 2017/06/05 12:22:41 - 2017-06-05
  8. 2017/06/05 12:21:36 - 2017-06-05
  9. 2017/06/05 12:16:17 - 2017-06-05
  10. 2017/06/05 12:14:09 - 2017-06-05
  11. 2017/06/05 12:13:18 - 2017-06-05
  12. 2017/06/05 12:12:52 - 2017-06-05
  13. 2017/06/05 12:11:02 - 2017-06-05
  14. 2017/06/05 12:06:54 - 2017-06-05
  15. 2017/06/05 12:06:19 - 2017-06-05
  16. 2017/06/05 12:05:11 - 2017-06-05
  17. 2017/06/05 12:03:13 - 2017-06-05
  18. 2017/06/05 11:58:27 - 2017-06-05
  19. 2017/06/05 11:56:36 - 2017-06-05
  20. 2017/06/05 11:55:45 - 2017-06-05