14,974
edits
(→工具) |
m (→工具) |
||
| Line 31: | Line 31: | ||
修改自 [http://dpatrickcaldwell.blogspot.com/2010/09/regular-expression-search-bookmarklet.html D. Patrick Caldwell on Software Engineering: Regular Expression Search Bookmarklet] 版本 | 修改自 [http://dpatrickcaldwell.blogspot.com/2010/09/regular-expression-search-bookmarklet.html D. Patrick Caldwell on Software Engineering: Regular Expression Search Bookmarklet] 版本 | ||
<pre> | <pre> | ||
if(void 0===searches)var searches=0;!function(){var e,t,r=0;if(0!=(e="(據透露|據了解|據指出|消息來源指出|知情人士透露|消息人士指示|內情人士指出|內情人士表示|消息人士表示|消息人士指出|有人說|謠傳|疑似|好像|認為|公認)([^。]*?)(。)").length){try{t=new RegExp(e,"i")}catch(t){return void alert("Unable to create regular expression using text | javascript: if(void 0===searches)var searches=0;!function(){var e,t,r=0;if(0!=(e="(據透露|據了解|據指出|消息來源指出|知情人士透露|消息人士指示|內情人士指出|內情人士表示|消息人士表示|消息人士指出|有人說|謠傳|疑似|好像|認為|公認)([^。]*?)(。)").length){try{t=new RegExp(e,"i")}catch(t){return void alert("Unable to create regular expression using text "+e+".\n\n"+t)}var a="#"+(searches+8).toString(2).substr(-3).replace(/0/g,"3").replace(/1/g,"6"),o=a.replace(/3/g,"c").replace(/6/g,"f");if(searches%16/8>=1){var s=a;a=o,o=s}!function e(t,s){var l,c,n,d,i;if(c=0,3==t.nodeType)(l=t.data.search(s))>=0&&((n=document.createElement("ACRONYM")).title="Search "+(searches+1)+": "+s.toString(),n.style.backgroundColor=o,n.style.borderTop="1px solid "+a,n.style.borderBottom="1px solid "+a,n.style.fontWeight="bold",n.style.color=a,(d=t.splitText(l)).splitText(RegExp.lastMatch.length),i=d.cloneNode(!0),n.appendChild(i),d.parentNode.replaceChild(n,d),r++,c=1);else if(1==t.nodeType&&t.childNodes&&"SCRIPT"!=t.tagName.toUpperCase()&&"STYLE"!=t.tagName.toUpperCase)for(var p=0;p<t.childNodes.length;++p)p+=e(t.childNodes[p],s);return c}(document.body,t),window.status="Found "+r+" match"+(1==r?"":"es")+" for "+t+".",r>0&&searches++}}(); | ||
</pre> | </pre> | ||