最新优化收藏到网摘代码(digg,diigo)
收藏到网摘这样应该是最为理想的,点击收藏链接在新窗口打开网摘窗口,能自动填写网摘标题及来源地址,如果能自动截取摘要则更好,下面是经过我优化的代码:
delicious,和yahoo的都是在新窗口打开
代码如下:
<a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(del = window.open('http://del.icio.us/login/?url=' + escape(d.location.href) + '&title=' + escape(d.title), 'del','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));del.focus();"><img src="images/Digest/delicious.gif" alt="Del.icio.us" border="0"></a>
<a href="#" onclick="window.open('http://myweb.cn.yahoo.com/popadd.html?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title), 'Yahoo','scrollbars=yes,width=780,height=455,left=80,top=80,status=yes,resizable=yes');"><img src="images/Digest/yahoo.gif" alt="Yahoo书签" border="0"></a>
diglog:能用鼠标选中部分作为描述
<a title="鼠标选中部分作为描述,提交到diglog.com" href="javascript://" onclick="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.diglog.com/submit.aspx?title='+escape(d.title)+'&url='+escape(d.location.href)+'&description='+escape(t),'keyit','scrollbars=yes,width=500,height=500,left=65,top=20,status=no,resizable=yes'));keyit.focus();"><img src="images/Digest/digit.gif" border="0" alt="提交新发现,Dig it" /></a>
国外digg收藏代码:
<a href="javascript:window.open('http://digg.com/submit?phase=2&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title))()"><img src="images/Digest/digg.gif" border="0" alt="DIGG this story" /></a>
国外diigo收藏代码:
<a href="#" onclick="var s=document.createElement('script');s.type='text/javascript';s.src='http://www.diigo.com/javascripts/webtoolbar/diigolet_b_h_b.js';document.body.appendChild(s);"><img style="border:none" alt="diigo it" src="http://www.diigo.com/images/ii_blue.gif" /></a>
另外百度收藏代码:能用鼠标选中部分作为描述
<a href="javascript:u=location.href;t=document.title;c = %22%22 + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var url=%22http://cang.baidu.com/do/add?it=%22+encodeURIComponent(t)+%22&iu=%22+encodeURIComponent(u)+%22&dc=%22+encodeURIComponent(c)+%22&fr=ien#nw=1%22;window.open(url,%22_blank%22,%22scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes%22); void 0"><img src="images/Digest/baidu.gif" border="0" alt="添加到百度搜藏" /></a>