メタブ表示

    @@ -1,5 +1,5 @@ /* - * @title はてブでメタブ表示(レイアウト汚くなる) + * @titleブクマカのメタブ表示 * @description my bookmarklet * @include http://b.hatena.ne.jp/entry/* * @license MIT License @@ -92,6 +92,11 @@ /* * START */ + + if((function(pn){ + if(pn.match(/^\/entry\/\d+\/comment\//)) return true; + return false; + })(String(location.pathname))) return; if( typeof HBBlogParts == 'undefined' ){
  • /*
     * @titleブクマカのメタブ表示
     * @description my bookmarklet
     * @include http://b.hatena.ne.jp/entry/*
     * @license MIT License
     * @require 
     */
    (function(){
      /*
       * CONSTANTS
       */
      var DEBUG    = true;
      var HBBP_URL = "http://b.hatena.ne.jp/js/bookmark_blogparts.js";
    
      //////////////////////////////
      
      var p = function() {
        if ( !DEBUG ) return;
        console.log.apply(console, arguments);
      };
    
    
      var forEach = function(a,f){
        if(!a) return;
        for (var i=0,l=a.length;i<l;i++){
          if(f(a[i]) === false) break;
        }
      };
    
    
      //////////////////////////////
      var targets = {};
    
      var insert = function(container, url){
        var h = HBBlogParts;
        var sel = 'a[href="'+targets[url]+'"]';
        forEach( document.querySelectorAll('ul.bookmark-list'), function(li){
          var target = li.querySelector(sel);
          if(!target) return;
          var parent = target.parentNode;
          parent.appendChild(container);
        });};
    
      var catchJsonMetab = function(entry){
        var h = HBBlogParts;
        if ( !entry ){
          //p('No Bookmarks');
        }else{
          var container = new h.BookmarkContainer(entry);
          if( h.isPermalinkPage() ) {
            container.commentLimit = h.permalinkCommentLimit;
          } else {
            container.commentLimit = h.listPageCommentLimit;
          }
          var url = entry.url;
          insert(container.toHTML(h.Design),url);
          h.setStyles();
          h.shownPermalinks[url] = 1;
        }
        h.catchCount++;
        if( h.catchCount >= h.Entries.length ) h.showEmptyEntries();
      };
    
    
      var showBookmarkComment = function(uri){
        var h = HBBlogParts;
        var apiEndPoint = h.API_DOMAIN + '/entry/jsonlite/?';
        var request = apiEndPoint + 'url=' + encodeURIComponent(uri) +
              '&callback=HBBlogParts.CatchJsonMetab';
        var scriptTag = Ten.Element('script',{ src: request, type: 'text/javascript'});
        document.body.appendChild(scriptTag);
      };
    
    
    
      var showBlogPart = function(n){
        var h = HBBlogParts;
        var uri = n.href;
        if(targets[uri]) return;
        targets[uri] = n.getAttribute('href');
        showBookmarkComment(uri);
      };
    
      var main = function(){
        var h = HBBlogParts;
        h.debug = DEBUG;
        h.CatchJsonMetab = catchJsonMetab;
        var entries = [];
        forEach(document.querySelectorAll('a.profile-icon'), showBlogPart);};
    
    
      /*
       * START
       */
      
      if((function(pn){
        if(pn.match(/^\/entry\/\d+\/comment\//)) return true;
        return false;
      })(String(location.pathname))) return;
    
    
      if( typeof HBBlogParts == 'undefined' ){
          var mainjs = document.createElement('script');
          mainjs.src = HBBP_URL;
          document.querySelector('head').appendChild(mainjs);}
    
      (function(){
        if(typeof HBBlogParts == 'undefined'){
          setTimeout(arguments.callee,20);}else{main();}})();
    
    
    })();
    
    // Local Variables:
    // mode: hatena-let
    // End:
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/08/15 20:22:44 - 2016-08-15
  2. 2016/08/02 21:43:13 - 2016-08-02
  3. 2016/07/11 19:41:45 - 2016-07-11
  4. 2016/07/11 06:44:39 - 2016-07-11
  5. 2016/07/11 03:34:28 - 2016-07-11
  6. 2016/07/11 03:12:04 - 2016-07-11
  7. 2016/07/11 02:59:16 - 2016-07-11
  8. 2016/07/03 09:28:27 - 2016-07-03
  9. 2016/07/02 06:31:25 - 2016-07-02
  10. 2016/07/01 10:22:11 - 2016-07-01
  11. 2016/06/28 10:16:34 - 2016-06-28
  12. 2016/06/27 09:43:45 - 2016-06-27
  13. 2016/06/27 09:41:26 - 2016-06-27
  14. 2016/06/25 17:14:17 - 2016-06-25
  15. 2016/06/18 13:39:29 - 2016-06-18
  16. 2016/06/18 10:40:52 - 2016-06-18
  17. 2016/06/17 06:47:34 - 2016-06-17