Google Bookmarks用bookmarklet

Google純正のbookmarkletが出てることに気付いた。

javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=420px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();

cとかdとかa.setTimeout 300でfocusとか、ふむ。


&output=popup で追加専用のページに行くみたいで、軽くなった。

m4iさん版*1の ?op=add から ?op=edit に変わったようだけど、違い不明。


個人的には、選択範囲をページタイトルに取り込む機能が欲しい。
あと、今回はldr_gbsaverみたいにLabelsのところにDateも入れたいかも。

ldr_gbsaver.user.js*2によると、&labels=... でいいみたい。


ということで、とりあえずldr_gbsaverに合わせて 年-月 だけにして

javascript:(function(){var a=window,b=document,c=encodeURIComponent,t=b.title,s=''+a.getSelection(),n=new Date(),z=function(n){return (n<10)?'0'+n:n;},d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c((s)?[t,s].join(' - '):t)+"&labels="+c([n.getFullYear(),z(n.getMonth()+1)].join('-')));a.setTimeout(function(){d.focus()},300)})();

としてみた。


Labelsの最後にカンマを付けたかったんだけど、弾かれてしまう…