はてなブックマークマイページなどでhttp記法を追加表示させるGMスクリプト
はてなブログでは、ブックマーク連携がありますが、ブックマークしたばかりの記事なら貼付けしやすいけど、過去エントリーについてはやりにくいことが分かったので作ることにしました。
http記法は、以下のドキュメントを参考にしました。
ブックマーク数表示をするオプションをつけた形で、title= とあわせる(:title:bookmark とすると、記事タイトルがわかりにくいため)形式で出力するようにしてみました。
// ==UserScript==
// .@name Add Hatebu HTTP notation
// .@namespace https://labs.markdiary.com/
// .@description Add to hatena HTTP notation
// .@include http://b.hatena.ne.jp/*
// .@version 1.0
// ==/UserScript==
window.onload= function(){
function add_notation(){
var d=document, id=d.getElementById("bookmarked_user")||d.getElementById("page-content"), nd=[],i, el, cl, link;
if(id){
el = id.getElementsByTagName("a");
for(i=0; i<el.length; i++){
cl = el[i].className;
if( cl == "entry-link" ){
link = el[i].getAttribute("href");
nd[i] = document.createElement("input");
nd[i].type = "text";
nd[i].value = "[" + link + ":title=" + el[i].firstChild.nodeValue +":bookmark]";
nd[i].setAttribute("readonly", "true");
nd[i].setAttribute("onclick", "this.select();");
el[i].parentNode.appendChild(nd[i]);
}
}
}
}
setTimeout ( add_notation, 2500 );
};
ブックマークレット 置き場
いちおう、新旧のブックマークページで表示を確認していますが、検索ページでの表示には対応してません(旧ブックマークのhttp://b.hatena.ne.jp/my/search?q= のリクエストのページでは表示できたので、個人的にはこれで目的は達成出来たので)。
Trackbacks:0
- TrackBack URL for this entry
- https://www.markdiary.com/mt/app-pingback.cgi/89
- Listed below are links to weblogs that reference
- はてなブックマークマイページなどでhttp記法を追加表示させるGMスクリプト from maRk lab
Comments:0