- UID
- 106904
- 帖子
- 29
- 精华
- 0
- 贡献
- 0
- 推广
- 0
- 有效BUG
- 0
- 注册时间
- 2008-4-14
|
34#
发表于 2010-4-3 02:06
| 只看该作者
本帖最后由 侈吻 于 2010-4-3 05:45 编辑
我分享兼提问
应为我是完全不懂js这种深奥的东东的,所以这个站内搜索是从opera那抠来的,结果居然能用。。。
- javascript:var t=window.location.hostname;var s=prompt('Google site search - enter search string:','');if(s){if(s.match(/^d\s.+/)){s=s.substring(2,s.length);t=t.match(/[^\.]+\.\w{2,4}$/)+''};void(location.href='http://www.google.com/search?q=site:'+t+'+'+s+'&sourceid=opera&num=100&hl=zh-CN')}
复制代码
我的问题就是,有没有高手能把多余的代码去掉啊?虽然不去掉其实也莫有影响来的。。
然后是我收集的一些小书签。。。
跳出新视窗显示当前页面的所有图像
- javascript:outText='';for(i=0;i<document.images.length;i++){if(outText.indexOf(document.images[i].src)==-1){outText+='<tr><td><img%20src='+document.images[i].src+'%20/></td></tr>'}};if(outText!=''){imgWindow=window.open('','imgWin','width=800,height=600');imgWindow.document.write%20('<table%20border=1%20cellpadding=10>'+outText+'</table>');imgWindow.document.close()}else{alert('No%20images!')}
复制代码
新建一个标签来显示所选内容
- javascript:(function(){ var d=open().document; d.title="Selection"; if (window.getSelection) { /*Moz*/ var s = getSelection(); for(i=0; i<s.rangeCount; ++i) { var a, r = s.getRangeAt(i); if (!r.collapsed) { var x = document.createElement("div"); x.appendChild(r.cloneContents()); if (d.importNode) x = d.importNode(x, true); d.body.appendChild(x); } } } else { /*IE*/ d.body.innerHTML = document.selection.createRange().htmlText; } })();
复制代码
在网页中按字母顺序排表
- javascript:function toArray (c){var a, k;a=new Array;for (k=0; k<c.length; ++k)a[k]=c[k];return a;}function insAtTop(par,child){if(par.childNodes.length) par.insertBefore(child, par.childNodes[0]);else par.appendChild(child);}function countCols(tab){var nCols, i;nCols=0;for(i=0;i<tab.rows.length;++i)if(tab.rows[i].cells.length>nCols)nCols=tab.rows[i].cells.length;return nCols;}function makeHeaderLink(tableNo, colNo, ord){var link;link=document.createElement('a');link.href='javascript:sortTable('+tableNo+','+colNo+','+ord+');';link.appendChild(document.createTextNode((ord>0)?'a':'d'));return link;}function makeHeader(tableNo,nCols){var header, headerCell, i;header=document.createElement('tr');for(i=0;i<nCols;++i){headerCell=document.createElement('td');headerCell.appendChild(makeHeaderLink(tableNo,i,1));headerCell.appendChild(document.createTextNode('/'));headerCell.appendChild(makeHeaderLink(tableNo,i,-1));header.appendChild(headerCell);}return header;}g_tables=toArray(document.getElementsByTagName('table'));if(!g_tables.length) alert("This page doesn't contain any tables.");(function(){var j, thead;for(j=0;j<g_tables.length;++j){thead=g_tables[j].createTHead();insAtTop(thead, makeHeader(j,countCols(g_tables[j])))}}) ();function compareRows(a,b){if(a.sortKey==b.sortKey)return 0;return (a.sortKey < b.sortKey) ? g_order : -g_order;}function sortTable(tableNo, colNo, ord){var table, rows, nR, bs, i, j, temp;g_order=ord;g_colNo=colNo;table=g_tables[tableNo];rows=new Array();nR=0;bs=table.tBodies;for(i=0; i<bs.length; ++i)for(j=0; j<bs[i].rows.length; ++j){rows[nR]=bs[i].rows[j];temp=rows[nR].cells[g_colNo];if(temp) rows[nR].sortKey=temp.innerHTML;else rows[nR].sortKey="";++nR;}rows.sort(compareRows);for (i=0; i < rows.length; ++i)insAtTop(table.tBodies[0], rows[i]);}
复制代码
消除了大部分非文本元素而显示文字
- javascript:(function(){var D=document,e,styles="table,thead,tbody,tr,th,td{display:block!important;}*{width:auto!important;height:auto!important;position:static!important;float:none!important;margin-left:0!important;margin-right:0!important;} img,iframe,embed,object{display:none;} body {margin:4px!important;}"; e=D.createElement('link'); e.rel='stylesheet'; e.href=window.opera ? "javascript:'"+styles+"'" : "data:text/css,"+styles; D.getElementsByTagName("head")[0].appendChild(e)})()
复制代码
让一个网页看起来像在PDA上
- javascript:var s=document.createElement('link');s.setAttribute('href','http://www.ressukka.net/misc/pdaize.css');s.setAttribute('rel','stylesheet');s.setAttribute('type','text/css'); document.getElementsByTagName('head')[0].appendChild(s);var l=document.getElementsByTagName('img');for(var i=0;il.length;i++){if(l[i].width>176){l[i].height*=176/l[i].width;l[i].width=176}else if(l[i].naturalWidth>176){var e=176/l[i].naturalWidth;l[i].height=l[i].naturalHeight*e;l[i].width=176;}}void(0);
复制代码
直接在浏览器中编辑当前页面
- javascript:document.body.contentEditable = 'true'; document.designMode='on'; void 0
复制代码
网页调亮
- javascript:(function(){function RGBtoHSL(RGBColor){with(Math){var R,G,B;var cMax,cMin;var sum,diff;var Rdelta,Gdelta,Bdelta;var H,L,S;R=RGBColor[0];G=RGBColor[1];B=RGBColor[2];cMax=max(max(R,G),B);cMin=min(min(R,G),B);sum=cMax+cMin;diff=cMax-cMin;L=sum/2;if(cMax==cMin){S=0;H=0;}else{if(L<=(1/2))S=diff/sum;else S=diff/(2-sum);Rdelta=R/6/diff;Gdelta=G/6/diff;Bdelta=B/6/diff;if(R==cMax)H=Gdelta-Bdelta;else if(G==cMax)H=(1/3)+Bdelta-Rdelta;else H=(2/3)+Rdelta-Gdelta;if(H<0)H+=1;if(H>1)H-=1;}return[H,S,L];}}function getRGBColor(node,prop){var rgb=getComputedStyle(node,null).getPropertyValue(prop);var r,g,b;if(/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)){r=parseInt(RegExp.$1,10);g=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return[r/255,g/255,b/255];}return rgb;}function hslToCSS(hsl){return "hsl("+Math.round(hsl[0]*360)+", "+Math.round(hsl[1]*100)+"%, "+Math.round(hsl[2]*100)+"%)";}var props=["color","background-color","border-left-color","border-right-color","border-top-color","border-bottom-color"];var props2=["color","backgroundColor","borderLeftColor","borderRightColor","borderTopColor","borderBottomColor"];if(typeof getRGBColor(document.documentElement,"background-color")=="string")document.documentElement.style.backgroundColor="white";revl(document.documentElement);function revl(n){var i,x,color,hsl;if(n.nodeType==Node.ELEMENT_NODE){for(i=0;x=n.childNodes[i];++i)revl(x);for(i=0;x=props[i];++i){color=getRGBColor(n,x);if(typeof(color)!="string"){hsl=RGBtoHSL(color);hsl[2] = Math.pow(hsl[2], 5/6);n.style[props2[i]]=hslToCSS(hsl);}}}}})()
复制代码
网页调暗
- javascript:(function(){function RGBtoHSL(RGBColor){with(Math){var R,G,B;var cMax,cMin;var sum,diff;var Rdelta,Gdelta,Bdelta;var H,L,S;R=RGBColor[0];G=RGBColor[1];B=RGBColor[2];cMax=max(max(R,G),B);cMin=min(min(R,G),B);sum=cMax+cMin;diff=cMax-cMin;L=sum/2;if(cMax==cMin){S=0;H=0;}else{if(L<=(1/2))S=diff/sum;else S=diff/(2-sum);Rdelta=R/6/diff;Gdelta=G/6/diff;Bdelta=B/6/diff;if(R==cMax)H=Gdelta-Bdelta;else if(G==cMax)H=(1/3)+Bdelta-Rdelta;else H=(2/3)+Rdelta-Gdelta;if(H<0)H+=1;if(H>1)H-=1;}return[H,S,L];}}function getRGBColor(node,prop){var rgb=getComputedStyle(node,null).getPropertyValue(prop);var r,g,b;if(/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)){r=parseInt(RegExp.$1,10);g=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return[r/255,g/255,b/255];}return rgb;}function hslToCSS(hsl){return "hsl("+Math.round(hsl[0]*360)+", "+Math.round(hsl[1]*100)+"%, "+Math.round(hsl[2]*100)+"%)";}var props=["color","background-color","border-left-color","border-right-color","border-top-color","border-bottom-color"];var props2=["color","backgroundColor","borderLeftColor","borderRightColor","borderTopColor","borderBottomColor"];if(typeof getRGBColor(document.documentElement,"background-color")=="string")document.documentElement.style.backgroundColor="white";revl(document.documentElement);function revl(n){var i,x,color,hsl;if(n.nodeType==Node.ELEMENT_NODE){for(i=0;x=n.childNodes[i];++i)revl(x);for(i=0;x=props[i];++i){color=getRGBColor(n,x);if(typeof(color)!="string"){hsl=RGBtoHSL(color);hsl[2] = Math.pow(hsl[2], 6/5);n.style[props2[i]]=hslToCSS(hsl);}}}}})()
复制代码
网页颜色反相(浅变暗,暗变浅,感觉这个比上面两个方便)
- javascript:(function(){function RGBtoHSL(RGBColor){with(Math){var R,G,B;var cMax,cMin;var sum,diff;var Rdelta,Gdelta,Bdelta;var H,L,S;R=RGBColor[0];G=RGBColor[1];B=RGBColor[2];cMax=max(max(R,G),B);cMin=min(min(R,G),B);sum=cMax+cMin;diff=cMax-cMin;L=sum/2;if(cMax==cMin){S=0;H=0;}else{if(L<=(1/2))S=diff/sum;else S=diff/(2-sum);Rdelta=R/6/diff;Gdelta=G/6/diff;Bdelta=B/6/diff;if(R==cMax)H=Gdelta-Bdelta;else if(G==cMax)H=(1/3)+Bdelta-Rdelta;else H=(2/3)+Rdelta-Gdelta;if(H<0)H+=1;if(H>1)H-=1;}return[H,S,L];}}function getRGBColor(node,prop){var rgb=getComputedStyle(node,null).getPropertyValue(prop);var r,g,b;if(/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)){r=parseInt(RegExp.$1,10);g=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return[r/255,g/255,b/255];}return rgb;}function hslToCSS(hsl){return "hsl("+Math.round(hsl[0]*360)+", "+Math.round(hsl[1]*100)+"%, "+Math.round(hsl[2]*100)+"%)";}var props=["color","background-color","border-left-color","border-right-color","border-top-color","border-bottom-color"];var props2=["color","backgroundColor","borderLeftColor","borderRightColor","borderTopColor","borderBottomColor"];if(typeof getRGBColor(document.documentElement,"background-color")=="string")document.documentElement.style.backgroundColor="white";revl(document.documentElement);function revl(n){var i,x,color,hsl;if(n.nodeType==Node.ELEMENT_NODE){for(i=0;x=n.childNodes[i];++i)revl(x);for(i=0;x=props[i];++i){color=getRGBColor(n,x);if(typeof(color)!="string"){hsl=RGBtoHSL(color);hsl[2]=1-hsl[2];n.style[props2[i]]=hslToCSS(hsl);}}}}})()
复制代码
edit styles(这还需要说明么?- -)
- javascript:(function(){function init(){var newline=unescape(%22%%22+%220A%22),importCount=0,L=[];dead=false;oldCSS=null;x=opener;ta=document.f.ta;ta.select();if(x.editStyles){ta.value=x.editStyles.innerHTML;update();return;}ta.value=%22/* Type CSS rules here and they will be applied%22+newline+%22to pages from '%22+location.host+%22'%22+newline+%22immediately as long as you keep this window open. */%22+newline+newline;function add(s){if(!s.disabled){var y={sheet:s,readable:true,label:%22Imported%22,inline:false,shorturl:%22%22,fulltext:%22%22};try{for(var k=0,m;m=s.cssRules[k];++k)if(m.type==3)add(m.styleSheet);}catch(er){y.readable=false;}L.push(y);if(s.ownerNode){y.label=s.ownerNode.tagName.toUpperCase()+%22-tag%22;if(!s.ownerNode.getAttribute(%22src%22)&&!s.ownerNode.href)y.inline=true;}if(y.inline){y.label=%22Inline %22+y.label;y.fulltext=fix(s.ownerNode.innerHTML);}else if(s.href.substr(0,13)==%22data:text/css%22){y.shorturl=%22 contained in a data: URL%22;y.fulltext=fix(unescape(s.href.slice(14)));}else{++importCount;y.importtext=%22@import \%22%22+s.href+%22\%22;%22;y.shorturl=%22 %22+s.href.split('/').reverse()[0];if(!y.readable){y.fulltext=%22/* Out-of-domain; imported above. */%22;}else if(s.href.substr(0,5)!=%22http:%22){y.fulltext=%22/* Non-http; imported above. */%22;}else{var loadingText=%22/* Loading (%22+(L.length-1)+%22) */%22;y.fulltext=loadingText;var p=new XMLHttpRequest();p.onload=function(e){ta.value=ta.value.replace(y.importtext+newline,%22%22);y.fulltext=p.responseText;ta.value=ta.value.replace(loadingText,fix(y.fulltext));ta.value=ta.value.replace(firstNote+newline,%22%22);};p.open(%22GET%22,s.href);p.send(null);}}}}function fix(s){while((s[0]==newline)&&s.length>1)s=s.slice(1);while((s[s.length-1]==newline)&&s.length>1)s=s.substr(0,s.length-1);s=s.replace(/@import.*;/ig,function(){return %22/* %22+RegExp.lastMatch+%22 */%22;});return s;}for(var i=0,ss;ss=x.document.styleSheets[i];++i)add(ss);var imports=%22%22,main=%22%22;var firstNote=%22/**** Style sheets whose contents could be loaded were ****/%22+newline+%22/**** imported instead. Rule order may be incorrect ****/%22+newline+%22/**** as a result. ****/%22+newline;if(importCount){ta.value+=firstNote;}for(var i=0;ss=L[i];++i){if(ss.importtext){imports+=ss.importtext+newline;}main+=%22/**** %22+ss.label+%22 style sheet%22+ss.shorturl+%22 ****/%22+newline;main+=newline;main+=ss.fulltext;main+=newline;main+=newline;main+=newline;}ta.value+=imports+newline+main;update();}function update(){try{if(!x||x.closed){ta.style.backgroundColor=%22#ddd%22;return;}x.editStyles;}catch(er){ta.style.backgroundColor=%22#fdc%22;setTimeout(update,150);dead=true;return;}if(dead){dead=false;ta.style.backgroundColor=%22%22;oldCSS=null;}if(!x.editStyles){var newSS;newSS=x.document.createElement(%22style%22);newSS.type=%22text/css%22;x.document.getElementsByTagName(%22head%22)[0].appendChild(newSS);x.editStyles=newSS;oldCSS=null;for(var i=0,ss;ss=x.document.styleSheets[i];++i)ss.disabled=true;}if(oldCSS!=ta.value){oldCSS=ta.value;x.editStyles.innerHTML=ta.value;}setTimeout(update,150);}y=open('','','resizable,scrollbars=yes,width=550,height=520');y.document.write('<title>Edit Styles</title><style>.ec { width: 100%; height: 100%; border: none; margin: 0px; padding: 0px; }</style><body class=%22ec%22><form name=%22f%22 style=%22margin: 0px;%22 class=%22ec%22><textarea name=%22ta%22 wrap=%22soft%22 style=%22margin: 0px; border: 0px; width:100%; height:100%;%22 class=%22ec%22></textarea><script>'+update+init+'init();<'+'/script>');y.document.close();})()
复制代码
另一款网址缩短(楼主提供滴是google的,问题怎么复制不了啊,so,这款是可以复制的,不过会跳到他们页面去,反正都有利有弊。)
- javascript:void(location.href='http://tinyurl.com/create.php?url='+location.href)
复制代码
呼出Design工具栏(网页设计工具)
- javascript:function%20fnStartDesign(sUrl)%20{var%20nScript%20=%20document.createElement('script');nScript.setAttribute('language','JavaScript');nScript.setAttribute('src',sUrl);document.body.appendChild(nScript);}fnStartDesign('http://www.sprymedia.co.uk/design/design/media/js/design-loader.js');
复制代码
个人觉得很厉害的保存网址为pdf的小书签,在创建文件前会让你设置需要保存的内容,删除多余的信息。得到的文件可以下载或者把缩短的网址通过Email或twitter发送
- javascript:(function(){pfstyle='bk';_pnicer_script=document.createElement('SCRIPT');_pnicer_script.type='text/javascript';_pnicer_script.src='http://cdn.printfriendly.com/printfriendly.js?x='+(Math.random());document.getElementsByTagName('head')[0].appendChild(_pnicer_script);_pnicer_css=document.createElement('LINK');_pnicer_css.rel='stylesheet';_pnicer_css.href='http://cdn.printfriendly.com/printfriendly.css';_pnicer_css.type='text/css';_pnicer_css.media='screen';document.getElementsByTagName('head')[0].appendChild(_pnicer_css);})();
复制代码 |
|