Get Hatena.Bookmark.entry.eid

    @@ -4,22 +4,10 @@ * @include http://b.hatena.ne.jp/entry* * @license MIT License */ -/* 2013-03-23T8:46:40+09:00 Added Searchbox focus */ -(function(){ - var key,sb,text=''; - if(Hatena.Bookmark.entry.hasOwnProperty('eid')){ - for( key in Hatena.Bookmark.entry) { - key = Hatena.Bookmark.entry['eid']; - text = "id:entry:" + key; - } - sb = document.getElementById("searchtext"); - if(sb){ - sb.value = text; - sb.focus(); - } else { - window.prompt ('Entry ID',text); - } - } -})() - - +(function(d){ + if(!d.documentElement.hasAttribute('data-entry-eid')) return; + const SearchForm = d.querySelector('#header form input'); + const EID = d.documentElement.dataset.entryEid; + SearchForm.value = 'id:' + EID; + SearchForm.focus(); +})(document);
  • /*
     * @title Get Hatena.Bookmark.entry.eid
     * @description inspired by http://let.hatelabo.jp/mame-tanuki/let/gYC-xpP0iY7WfA
     * @include http://b.hatena.ne.jp/entry*
     * @license MIT License
     */
    (function(d){
      if(!d.documentElement.hasAttribute('data-entry-eid')) return;
      const SearchForm = d.querySelector('#header form input');
      const EID = d.documentElement.dataset.entryEid;
      SearchForm.value = 'id:' + EID;
      SearchForm.focus();
    })(document);
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/06/02 07:49:11 - 2018-06-02
  2. 2017/08/26 23:50:58 - 2017-08-26
  3. 2013/03/23 08:47:00 - 2013-03-23
  4. 2013/03/12 10:18:23 - 2013-03-12