浏览器里转贴到校内转贴到开心的书签

Google到这么一个书签地址,楞长楞长的
javascript:void((function(s,d,e){if(/xiaonei\.com/.test(d.location))return;var%20f=’http://share.xiaonei.com/share/buttonshare.do?link=‘,u=d.location,l=d.title,p=[e(u),’&title=’,e(l)].join(”);function%20a(){if(!window.open([f,p].join(”),’xnshare’,[‘toolbar=0,status=0,resizable=1,width=626,height=436,left=’,(s.width-626)/2,’,top=’,(s.height-436)/2].join(”)))u.href=[f,p].join(”);};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent));

排个版:

javascript://html页面中插入javascript代码段的指示头

void //第一对()提供函数定义,第二对()提供参数列表
(

(
function(s,d,e) //未知函数的定义
{

if(/xiaonei\.com/.test(d.location)) //对当前URL做了一个检测,合法性?和谐性?
return;
var f=’http://share.xiaonei.com/share/buttonshare.do?link=‘,
u=d.location,
l=d.title,
p=[e(u),’&title=’,e(l)].join(”); //对当前页面的URL和标题做转码,提供给校内的buttonshare.do
function a() //定义在函数体内的函数,原来JS支持这种特性
{
if(!window.open([f,p].join(”),’xnshare’,[‘toolbar=0,status=0,resizable=1,width=626,height=436,left=’,(s.width-626)/2,’,top=’,(s.height-436)/2].join(”))) //判断是否打开弹窗成功
u.href=[f,p].join(”);//不成功的话,直接在当前页面打开校内的转贴页
};

if(/Firefox/.test(navigator.userAgent))

setTimeout(a,0); //为什么针对Firefox要用这种调用方法?我猜想只是针对Firefox的JavaScript解释器的补丁
else
a();

}

)
(screen,document,encodeURIComponent)//提供给未名函数的三个参数,即s,d,e

);

亲娘嘞,IOCCC的评审得多辛苦。

改一改,也可以用于开心的转贴,把p和f的定义去掉即可,前面的xiaonei.com的检查函数也可以去掉,变成这个样子:

javascript:void((function(s,d,e){var%20f=’http://www.kaixin001.com/~repaste/repaste.php?rurl=’,u=d.location,l=d.title,p=[e(u),’&rtitle=’,e(l)].join(”);function%20a(){if(!window.open([f,p].join(”),’xnshare’,[‘toolbar=0,status=0,resizable=1,width=626,height=436,left=’,(s.width-626)/2,’,top=’,(s.height-436)/2].join(”)))u.href=[f,p].join(”);};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent));

新建一个书签,在地址一栏填进去即可~

美中不足是内容部分还需要自己填写,偷懒就不填了,留个URL让人看~

Nan Wang
Here, there and everywhere


Comments

Leave a Reply