阅读:4237回复:6
分享两个userChrome.js脚本(有关搜索的)
搜索后,清空地址栏关键字
(个人挺喜欢的,有时候搜索后,同事跑过来........) // ==UserScript== // @name Clear Search Term // @namespace http://www.xuldev.org/ // @description Clears the search term and reset the engine after searching. // @include main // @author Gomita // @version 1.0.20080201 // @homepage http://www.xuldev.org/misc/ucjs.php // ==/UserScript== ( function() { var searchbar = document.getElementById("searchbar"); searchbar._doSearchInternal = searchbar.doSearch; searchbar.doSearch = function(aData, aInNewTab) { this._doSearchInternal(aData, aInNewTab); // clear the search term this.value = ""; // reset the search engine //this.currentEngine = this.engines ? this.engines[0] : this._engines[0]; }; } () ); 鼠标中键点击搜索引擎列表中的某个引擎,临时使用该搜索引擎搜索。 (粘贴关键字给我去掉了。) // ==UserScript== // @name Search Clipboard // @namespace http://www.xuldev.org/ // @description Middle-click the search engine button or popup to search clipboard text. // @include main // @author Gomita // @version 1.0.20080201 // @homepage http://www.xuldev.org/misc/ucjs.php // ==/UserScript== //作用:鼠标中键点击搜索引擎,临时使用该搜索 (function() { var searchClipboard = function(event) { if (event.button != 1) return; // get clipboard text //var str = readFromClipboard(); var str = document.getElementById("searchbar").value; // get nsISearchEngine object var engine = event.target.engine; if (!engine) engine = document.getElementById("searchbar").currentEngine; // get nsISearchSubmission object var submission = engine.getSubmission(str, null); if (!submission) return; // decide whether opening in a new tab or not var inNewTab = gPrefService.getBoolPref("browser.search.openintab"); inNewTab = ((event && event.altKey) ^ inNewTab); // load the URL if (inNewTab) { var tab = gBrowser.loadOneTab(submission.uri.spec, null, null, submission.postData, null, false); gBrowser.selectedTab = tab; } else { loadURI(submission.uri.spec, null, submission.postData, false); } // hide popup after middle-clicking the search popup if (event.target.localName == "menuitem") { event.target.parentNode.hidePopup(); event.stopPropagation(); } }; var searchbar = document.getElementById("searchbar"); // middle-click the search engine popup to search clipboard document.getAnonymousElementByAttribute(searchbar, "anonid", "searchbar-popup") .addEventListener("click", searchClipboard, false); // middle-click the search engine button to search clipboard document.getAnonymousElementByAttribute(searchbar, "anonid", "searchbar-engine-button") .addEventListener("click", searchClipboard, false); }()); |
|
|
1楼#
发布于:2008-11-22 12:42
好东西,谢谢!!!
|
|
2楼#
发布于:2008-11-22 12:42
收下了!顺便问下,在Google主页双击搜索栏会出现以前的搜索记录,有办法去除么?
|
|
3楼#
发布于:2008-11-22 12:42
不错。
|
|
4楼#
发布于:2008-11-22 12:42
用地址栏关键字搜索就不会有这种烦恼。。。
|
|
5楼#
发布于:2008-11-22 12:42
|
|
|
6楼#
发布于:2008-11-22 12:42
你多少个搜索引擎?我40来个,关键字都记得挺好,我还算是记性很差的人。
关键字要设置得有意义才好记。比如土豆网就是td;中日英3国wiki就是wc,wj,we;mininova就是mn;百度知道就是zd。基本规律就是取有意义的音节首字母,搜两遍就记得了。 |
|