Get Hatena.Bookmark.entry.eid
by
maRk
2018-06-02 [2018/06/02 07:49:11]
inspired by http://let.hatelabo.jp/mame-tanuki/let/gYC-xpP0iY7WfA
@@ -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 です。