0
我一直受Instapaper bookmarklets的啓發,它允許將頁面添加到Instapaper而無需單獨的彈出窗口,也無需重新加載整頁。我想將這個想法與Delicious bookmarklet結合爲書籤頁面。通過小書籤將jQuery,Colorbox和自定義代碼注入頁面
jQuery Colorbox plugin支持將iframe內容加載到colobox彈出框中,所以它看起來是一個很好的開始。我拼湊了幾個小書籤,以獲得下面的代碼,這似乎是一個良好的開端,直到我添加「$.fn.colorbox ...」行。我似乎無法打開Colorbox。我甚至試圖簡化它,只是打開谷歌的希望頁,但沒有運氣那裏:
javascript:
function iprl5(){
var d=document,z=d.createElement('scr'+'ipt'),y=d.createElement('scr'+'ipt'),x=d.createElement('scr'+'ipt'),b=d.body,l=d.location,t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');
try{
if(!b)
throw(0);
d.title='(Saving...)%20'+d.title;
x.setAttribute('src','http://cachedcommons.org/cache/jquery/1.4.2/javascripts/jquery.js');
y.setAttribute('src','http://cachedcommons.org/cache/jquery-colorbox/1.3.9/javascripts/jquery-colorbox.js');
b.appendChild(x);
b.appendChild(y);
$.fn.colorbox({href:'http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&v=5&',open:true,iframe:true});
}
catch(e){
alert('Please%20wait%20until%20the%20page%20has%20loaded.');
}
}
iprl5();
void(0)