Feed on
Posts
Comments

Bookmarkletを比較

gelatoとtumblrとsoupのbookmarkletを比較してみた。

soupのものが70×70以上の画像のurlを渡しているのでいい感じ。

gelato

[js]var w;
setTimeout(‘w.focus()’,100);
w=window.open(‘http://localhost/gelato/admin/bm.php?url=’
+encodeURIComponent(location.href)
+’&sel=’
+encodeURIComponent(window.getSelection()),
‘bookmarklet’,
‘toolbar=0,resizable=0,status=1,width=650,height=460,dependent=yes’ );
w.focus();
[/js]

tumblr
[js]var d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
x=d.selection,
s=(e?e():(k)?k():(x?x.createRange().text:0)),
f=’http://www.tumblr.com/share’,
l=d.location,
e=encodeURIComponent,
p=’?v=3&u=’+e(l.href) +’&t=’+e(d.title) +’&s=’+e(s),
u=f+p;
try{
if(!/^(.*\.)?tumblr[^.]*$/.test(l.host))
throw(0);
tstbklt();
}
catch(z){
a =function(){
if(!w.open(u,’t',’toolbar=0,resizable=0,status=1,width=450,height=430′))
l.href=u;
};
if(/Firefox/.test(navigator.userAgent))
setTimeout(a,0);
else a();
}
void(0)[/js]

soup
[js]var html=function(n){var x=document.createElement(‘div’);x.appendChild(n);return x.innerHTML;},
d=document,
w=window,
di=d.images,
dom=d.location.href.match(/(.*)\/.*$/)[1],
i=”;
for(var n=0;n
if(di[n].offsetWidth*di[n].offsetHeight>70*70)
i+=di[n].src.replace(dom, ‘@@’)+’|'+di[n].offsetWidth+’|'+di[n].offsetHeight+’,';
}
var s1=w.getSelection,
s2=d.getSelection,
s3=d.selection,
sel=s1?(s1()&&s1()!=”?html(s1().getRangeAt(0).cloneContents()):”):s2?s2():s3?s3.createRange():”;
var e=encodeURIComponent,
u=’http://www.soup.io/bookmarklet’,
q=’?v=4&u=’+e(d.location.href)+’&t=’+e(d.title)+’&s=’+e(sel)+’&dom=’+e(dom)+’&i=’+e(i),
r=u+q,
x=function(){
if(!w.open(r,’soup’,'toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=400′))
location.href=r
};
if(/Firefox/.test(navigator.userAgent)){
setTimeout(x,0)
}
else{
x()
}
void(0);[/js]

One Response to “Bookmarkletを比較”

Leave a Reply