MozTW 討論區

各項 Mozilla 相關軟體與技術討論
現在的時間是 2025-06-29, 18:30

所有顯示的時間為 UTC + 8 小時





發表新文章 回覆主題  [ 5 篇文章 ] 
發表人 內容
文章發表於 : 2004-02-26, 17:04 
目前有什麼擴充套件可以實作出來嗎
或是會在未來的版本直接加入
或是根本就不實用?
麻煩各位前輩解感:)


回頂端
  
引用回覆  
 文章主題 :
文章發表於 : 2004-02-26, 18:11 
與其讓Find as you Type支援Regular Expression, 不如建議你用[url=javascript:(function(){var count=0, text, regexp;text=prompt("Search regexp:", "");if(text==null || text.length==0)return;try{regexp=new RegExp("(" + text +")", "i");}catch(er){alert("Unable to create regular expression using text '"+text+"'.\n\n"+er);return;}function searchWithinNode(node, re){var pos, skip, spannode, middlebit, endbit, middleclone;skip=0;if( node.nodeType==3 ){pos=node.data.search(re);if(pos>=0){spannode=document.createElement("SPAN");spannode.style.backgroundColor="yellow";middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.$1.length);middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);++count;skip=1;}}else if( node.nodeType==1 && node.childNodes && node.tagName.toUpperCase()!="SCRIPT" && node.tagName.toUpperCase!="STYLE"){for (var child=0; child < node.childNodes.length; ++child){child=child+searchWithinNode(node.childNodes[child], re);}}return skip;}window.status="Searching for "+regexp+"...";searchWithinNode(document.body, regexp);window.status="Found "+count+" match"+(count==1?"":"es")+" for "+regexp+".";})();]Bookmarklets[/url]更實際.
因為Find As You Type不方便顯示所有符合的條件. 每次都需要按F3才能顯示下一個符合的字串.


回頂端
  
引用回覆  
 文章主題 :
文章發表於 : 2004-02-26, 18:13 
抱歉, 上面的post出現問題了.

與其讓Find as you Type支援Regular Expression, 不如建議你用
代碼:
javascript:(function(){var count=0, text, regexp;text=prompt("Search regexp:", "");if(text==null || text.length==0)return;try{regexp=new RegExp("(" + text +")", "i");}catch(er){alert("Unable to create regular expression using text '"+text+"'.\n\n"+er);return;}function searchWithinNode(node, re){var pos, skip, spannode, middlebit, endbit, middleclone;skip=0;if( node.nodeType==3 ){pos=node.data.search(re);if(pos>=0){spannode=document.createElement("SPAN");spannode.style.backgroundColor="yellow";middlebit=node.splitText(pos);endbit=middlebit.splitText(RegExp.$1.length);middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);++count;skip=1;}}else if( node.nodeType==1 && node.childNodes && node.tagName.toUpperCase()!="SCRIPT" && node.tagName.toUpperCase!="STYLE"){for (var child=0; child < node.childNodes.length; ++child){child=child+searchWithinNode(node.childNodes[child], re);}}return skip;}window.status="Searching for "+regexp+"...";searchWithinNode(document.body, regexp);window.status="Found "+count+" match"+(count==1?"":"es")+" for "+regexp+".";})();
更實際.
因為Find As You Type不方便顯示所有符合的條件. 每次都需要按F3才能顯示下一個符合的字串.


回頂端
  
引用回覆  
 文章主題 :
文章發表於 : 2004-02-26, 18:15 
上面是一個Bookmarklet, 將它當網址儲存成Bookmark來用就可以了.


回頂端
  
引用回覆  
 文章主題 :
文章發表於 : 2004-02-28, 12:32 
感謝! 真是太讚了~:)


回頂端
  
引用回覆  
顯示文章 :  排序  
發表新文章 回覆主題  [ 5 篇文章 ] 

所有顯示的時間為 UTC + 8 小時


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 29 位訪客


不能 在這個版面發表主題
不能 在這個版面回覆主題
不能 在這個版面編輯您的文章
不能 在這個版面刪除您的文章
不能 在這個版面上傳附加檔案

搜尋:
前往 :  
Powered by phpBB® Forum Software © phpBB Group
正體中文語系由 竹貓星球 維護製作
© moztw.org, Mozilla Foundation
MozTW,Mozilla 台灣社群