jQuerify书签

我不知道有多少人在使用浏览器的书签,这东东有时候实在是很有用的,比如现在说到的jQuerify书签

jQuerify书签的功能很简单,那就是在当前页面中直接载入jquery.js,并以一个粉红色的浮动层提示jquery已经载入。书签的源代码如下:

var s=document.createElement('script');
s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js');
if(typeof jQuery!='undefined') {
  var msg='This page was already jQuerified'
} else {
  document.getElementsByTagName('head')[0].appendChild(s);
  var msg='This page is now jQuerified'
}
var el=document.createElement('div');
  el.style.position='fixed';
  el.style.height='30';
  el.style.width='200';
  el.style.margin='0 auto 0 auto';
  el.id='jq-kswedberg';
  el.style.top='0';
  el.style.left='40%';
  el.style.padding='5px 10px 5px 10px';
  el.style.backgroundColor='#f99';
  el.innerHTML=msg;
var b=document.getElementsByTagName('body')[0];
b.appendChild(el);
window.setTimeout(function() {
  jQuery('#jq-kswedberg').fadeOut('slow',function() {
	jQuery(this).remove()
  });
}, 2500);
void(s);

书签的链接在下边,如果是firefox的话,可以直接拖拽到firefox的书签栏上。

» jQuerify «

这里用到了最近说到的google cdn,速度可是足够快的。在使用书签之后,就可以尽情享受jquery的便利了,比如在firebug的console输入:

$('body').background('#ffc')

你会看到屏幕的背景色变黄了:)

作者: 发表于June 10, 2008 at 8:35 am

版权信息: 可以任意转载, 转载时请务必以超链接形式标明文章原始出处作者信息及此声明

Tags: ,,

2 条评论 »

  1. aksoft 于 2009-01-06 @ 08:43:45 留言

    这个没用啊,对您这个网页没有效果。。对原作者的可以。。

  2. Volcano 于 2009-01-06 @ 09:41:10 留言

    我刚才测试是有效的,有“This page was already jQuerified”字样出现

RSS 为此帖反馈评论

留条评论