在人人上拖了个书签到chrome的书签栏,只要下次在某个页面点击下就能轻松分享当前页面。
怎么实现的呢?编辑书签,有:
javascript:void(
(function(s,d,e) {
if(/renren/.com/.test(d.location))return;
var f='http://share.renren.com/share/buttonshare.do?link=',
u=d.location,
l=d.title,
p=[e(u),'&title=',e(l)].join('');
function a() {
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 a();
})(screen,document,encodeURIComponent));
取出基本框架:
javascript:void ((
function(s,d,e)
{
// TODO: do something here
}
)(screen,document,encodeURIComponent));
下面就靠大家驰骋啦~~
举个小例子,让div里的文字变红:
javascript:void ((
function(s,d,e)
{
var i=0,t=d.getElementsByTagName('div');
for(i=0;i<t.length;i++) t[i].style.color='#ff0000';
}
)(screen,document,encodeURIComponent));
然后把它编成一行,添加到书签里。
打开一个网页,然后点刚才的书签~
文字变红啦~