HatenaBlog add HTTP Notation Bookmarklet
by
maRk
2014-02-03 [2014/02/03 19:22:13]
Add HTTP Notation on Entry List page
-
/*
* @title HatenaBlog add HTTP Notation Bookmarklet
* @description Add HTTP Notation on Entry List page
* @include http://*
* @license MIT License
* @require
* @private
*/
(function(){
var etitle,i,nd=[],permalink,title;
var selectors = "a.js-search-entry-title";
etitle = document.querySelectorAll(selectors);
if(etitle[0]!=undefined){
for(i=0;i<etitle.length;i++){
permalink = etitle[i].getAttribute("href");
nd[i] = document.createElement("input");
nd[i].type = "text";
title = getTitle(etitle[i]);
nd[i].value = "[" + permalink + ":title=" + title + ":bookmark]";
nd[i].setAttribute("readonly", "true");
nd[i].setAttribute("onclick","this.select();");
nd[i].setAttribute("size","255");
nd[i].setAttribute("title", permalink +" - " + title);
etitle[i].parentNode.appendChild(nd[i]);
}
}
function getTitle(t){
var cnd, i, titleTxt="";
var cNoz = t.childNodes;
for (i=0; i < cNoz.length; i++){
cnd = cNoz[i];
if(cnd.nodeType == 1){
titleTxt += cNoz[i].firstChild.nodeValue;
getTitle(cnd);
} else if(cnd.nodeType == 3){
titleTxt += cNoz[i].nodeValue;
}
}
return titleTxt;
}
})();
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。