-
2008-10-06
修改diigo的js插件为弹出窗口式
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://junewong.blogbus.com/logs/29975881.html
一直喜欢用diigo来收藏文章,以前装了它提供firefox的插件,管理起来很方便,不过由于有其他原因除了noscript不想再装太多扩展。而方便的diilolet在我用了noscript扩展之后也不能用了。只好暂时用着post to diigo这个js插件将就着了,不过这个插件跟del.icio.us比起来有点不爽的地方,就是点击之后只会在本地页面跳转,不如del.icio.us的弹出窗口式的方便。所以修改了一些插件的js代码,改为可以弹出式的了:
javascript:(function() {var url = location.href;var title = document.title || url;var desc = (window.getSelection ? window.getSelection().toString() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var target = 'http://www.diigo.com/post?url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&desc=' + encodeURIComponent(desc);post = function(){if(!window.open(target,'Post to Diigo','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=580'))window.location.href = target;};if(/Firefox/.test(navigator.userAgent)){setTimeout(post,0)}else{post()}})();
拷贝覆盖原来的的插件内容就可以了。
没格式化前的源码如下:
javascript:(function()
{
var url = location.href;
var title = document.title || url;
var desc = (window.getSelection ? window.getSelection().toString() : document.getSelection ? document.getSelection() : document.selection.createRange().text);
var target = 'http://www.diigo.com/post?url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&desc=' + encodeURIComponent(desc);
post = function()
{
if(!window.open(target,'Post to Diigo','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=580'))
window.location.href = target;
};
if(/Firefox/.test(navigator.userAgent))
{
setTimeout(post,0)
}
else
{
post()
}
}
)();不过缺点是保存之后不会自动关闭弹出的窗口。在此做个记录,暂时先用着吧。
随机文章:
进步脚印(1) 2007-01-26actionscript远程读取xml文件 2006-12-29opera无法查看wsdl文件 2006-12-23FFmpeg转换后不能播放音频的原因 2006-12-18胡思乱想:记录两道IQ题的思路 2007-01-15
收藏到:Del.icio.us







