书签Bookmarklet脚本代码收集

来源:互联网 发布:mac战网怎么改地区 编辑:程序博客网 时间:2024/04/29 04:09

收集了不少实用的Bookmarklet脚本代码

将这些代码添加到Bookmarklet(小书签)(IE叫收藏夹,chrome叫书签)里面,

像点击收藏夹的网址一样,点击这些添加好的Bookmarklet就能实现各种功能,简洁方便不占资源,算是绿色环保的小工具了

 1.自动刷新

会调用一个叫"刷刷"的网站实现自动刷新
  1. javascript:location.href = 'http://www.suasua.com/?url=' + location.href;
复制代码
类似于M2中的功能

2.自动滚动
  1. javascript:var%20wN2scRl;Sa5gNA9k=new%20Function (' clearTimeout ( wN2scRl )') ;document.onkeydown=Sa5gNA9k;Sa5gNA9k () ;void ( wN2scRl=setInterval (' if ( pageYOffset<document.height-innerHeight ){ window.scrollBy ( 0,1 )} else { Sa5gNA9k ()}' ,50 ))
复制代码
Esc停下来,修改window.scrollBy ( 0,1 )中的1为1~10任意正数还能调整滚动速度
类似于M2中的一插件

3.列出页面内图片,图片地址,尺寸
  1. javascript:var%20imgWin,i,outText='',di=document.images;for(i=0;i<di.length;i++){if(outText.indexOf(di.src)<0){outText+='<tr><td><img%20src='+di.src+'></td><td>'+di.height+'</td><td>'+di.width+'</td><td>'+di.src+'</td></tr>';}}if(outText==''){alert('No%20Images!');}else{imgWin=window.open('','IW','width=800,height=600,scrollbars=yes');void(imgWin.document.body.innerHTML='<table%20border=1%20cellpadding=10><tr><th>Image</th><th>Height</th><th>Width</th><th>URL</th></tr>'+outText+'</table>');}
复制代码
类似于M2中的一插件

4.EverNote实现收集面板功能
  1. javascript:(function(){EN_CLIP_HOST='http://www.evernote.com';try{var%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+(new%20Date().getTime()/100000);document.getElementsByTagName('head')[0].appendChild(x);}catch(e){location.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);}})();
复制代码
这个先要注册一个EverNote帐号,很方便的,执行时会有一个浮动窗口来记笔记,能向EverNote账户同步

5.GoogleReader实现收集面板功能
  1. javascript:var%20b=document.body;var%20GR________bookmarklet_domain='http://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='http://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}
复制代码
也是浮动窗口,能够在GoogleReader的分享-备注中找到所记笔记
注意:这个记得笔记是公开在你的Google共享上的

6.GoogleNotebook实现收集面板功能
  1. javascript:(function(){var w=window;var d=document;var g=w.open('about:blank','gnotesWin','location=0,menubar=0,scrollbars=0,status=0,toolbar=0,width=300,height=300,resizable');var s=d.createElement('script');s.setAttribute('src','http://www.google.com/notebook/bookmarkletPoster?zx='+(new Date()).valueOf());d.body.appendChild(s);w.setTimeout(function(){w.blur();g.focus();}, 100)}).call({});
复制代码
要开一个新页面,不是很方便哈,但是是隐私的,在google.com/notebook能找到自己的笔记

7.向上一层
  1. javascript:if (location.pathname == '/'); else if (location.pathname.charAt(location.pathname.length-1) == '/') location = '..'; else location = '.'; void 0
复制代码
类似于M2中的功能

8.夜间模式
  1. javascript:var nuStyle=document.createElement('link');nuStyle.rel='stylesheet';nuStyle.rev='stylesheet';nuStyle.href='data:text/css,*{background:#222222 !important;color:#ffffff !important;} :link{color:#ffffff !important;} :visited{color:#888888 !important;}';void(document.documentElement.childNodes[0].appendChild(nuStyle));
复制代码
把页面背景改为黑色,文字改为白色,夜间可保护眼睛~

9.破解限制
  1. javascript:alert(document.body.oncontextmenu=document.body.onmouseup=document.body.onmousemove=document.body.onclick=document.body.onselectstart =document.body.oncopy=document.onmousedown = document.onkeydown =null)
复制代码

可以破解右键限制和复制限制,有M2中"清除烦恼"的功能

-----------------------------------------------------------------------------------------------------------------------

PageZipper 自动翻页

  1. javascript:(function(){if(window['pgzp']){_pgzpToggleBookmarklet();}else{window._page_zipper_is_bookmarklet=true;window._page_zipper=document.createElement('script');window._page_zipper.type='text/javascript';window._page_zipper.src='http://www.printwhatyoulike.com/static/pagezipper/pagezipper_10.js';document.getElementsByTagName('head')[0].appendChild(window._page_zipper);}})();
复制代码

google页面翻译工具栏 类似chrome的扩展
  1. javascript:{d=document;b=d.body;o=d.createElement('scri'+'pt');o.setAttribute('src','http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit');o.setAttribute('type','text/javascript');b.appendChild(o);v=b.insertBefore(d.createElement('div'),b.firstChild);v.id='google_translate_element';v.style.display='none';p=d.createElement('scri'+'pt');p.text='function%20googleTranslateElementInit(){new%20google.translate.TranslateElement({pageLanguage:%22%22},%22google_translate_element%22);}';p.setAttribute('type','text/javascript');b.appendChild(p);}void%200
复制代码

Google翻译页面至简体中文
  1. javascript:(function(){var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset||document.characterSet);if(t!=''){window.open('http://translate.google.cn/translate_t?hl=zh-CN#auto|zh-CN|'+t);}else{window.open('http://translate.google.cn/translate?u='+escape(location.href)+'&hl=zh-CN&ie='+e+'&sl=auto&tl=zh-CN');};})();
复制代码

划词翻译
小D划词 ,可翻译英文、日文
  1. javascript:void((function(){hjelm=document.createElement('script');hjelm.setAttribute('src','http://dict.hjenglish.com/js/dict.js');document.body.appendChild(hjelm);})())
复制代码

Dict划词助手
  1. javascript:void((function() {var element=document.createElement('script'); element.setAttribute('src', 'http://dict.cn/hc/init.php'); document.body.appendChild(element);})())
复制代码

尚译, 翻译多种语言
  1. javascript:void((function(){if(window.Como&&window.Como.someyi){Como.someyi.open()}else{var a=document.createElement('script');a.setAttribute('type','text/javascript');var b=document.charset?document.charset:document.characterSet;var c=b.toLowerCase()=='gb2312'?'pack-gb2312.js':'pack-utf8.js';a.setAttribute('src','http://yi.comsome.com/'+c);document.getElementsByTagName('head').item(0).appendChild(a);Text.prototype.tagName='#text'}})())
复制代码

QQWeb云输入法
  1. javascript:(function(q){!!q?q.toggle():(function(d,j){j=d.createElement('script');j.src='//ime.qq.com/fcgi-bin/getjs';j.setAttribute('ime-cfg','lt=2');d.getElementsByTagName('head')[0].appendChild(j)})(document)})(window.QQWebIME)
复制代码

添加到QQ书签
  1. javascript:{window.open('http://shuqian.qq.com/post?from=3&title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)}
复制代码

Google站内搜索
  1. javascript:var%20ax=prompt('%E8%B0%B7%E6%AD%8C%E7%AB%99%E5%86%85%E6%90%9C%E7%B4%A2\n%E8%AF%B7%E8%BE%93%E5%85%A5%E6%90%9C%E7%B4%A2%E5%85%B3%E9%94%AE%E5%AD%97','');if(ax.length>0){window.open('http://www.google.com/search?hl=zh-CN&client=opera&q=site:'+encodeURIComponent(location.hostname)+'%20'+encodeURIComponent(ax))};void(0)
复制代码

生成短网址

javascript:function iprl5(){var d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);if (!l) {alert('请输入网址!');return;}d.title='(Shortening...) '+d.title;z.setAttribute('src','http://www.ruanyifeng.com/webapp/url_shortener_plugin.php?longUrl='+encodeURIComponent(l));b.appendChild(z);}catch(e){alert('请等待网页加载完毕!');}}iprl5();void(0)

十个浏览器 Bookmarklets : http://blog.istef.info/2007/06/15/google-bookmarkets/



原创粉丝点击