本帖最后由 Ycxw2008 于 2012-2-9 17:56 编辑 javascript:location.href='http://www.google.com/search?q=site:'+window.location.hostname+'%20%s'
地址用上面的,然后你再设置个关键字就行了,
比如你想搜索Func HelloWord 这个函数,
直接用论坛的不一定能搜索到,
但是这样搜索就不一定了哈
图中我设置的关键字z
所以地址栏直接'z HelloWord'的话大大增强效率,
之前版主提过,不过这样好像又增加点效率了,希望能帮到大家
不知我有没有发错区?这里应该找资料的挺多的.:)
如果发错 请版主见谅 直接转移
下面这一段uc.js脚本更不错//站内搜索
(function () {
var engineName = "Search Site";
var ss = Cc["@mozilla.org/browser/search-service;1"].getService(Ci.nsIBrowserSearchService);
var engine = ss.getEngineByName(engineName);
if (!engine) {
ss.addEngineWithDetails(
engineName,
"http://w-shadow.com/files/currentsitesearch16.ico",
"",
"Search the current site with Google",
"GET",
"http://www.google.com/search?q={searchTerms}"
);
engine = ss.getEngineByName(engineName);
}
engine = engine.wrappedJSObject;
if(engine.getSubmission.toString().indexOf("getHostname") == -1) {
engine.getSubmission = function (aData, aResponseType) {
function getHostname() {
var focusedWindow = document.commandDispatcher.focusedWindow;
if (!focusedWindow || focusedWindow == window)
focusedWindow = window.content;
var hostname = ("hostname" in focusedWindow.location) ? focusedWindow.location.hostname : "";
hostname = hostname.match(/[^.]+\.(com|net|org)(\.[^.]+)?$/g) || hostname.match(/[^.]+(\.[^.]+)+/g) || "";
return hostname;
};
var url = "http://www.google.com/search?q=" + encodeURIComponent(aData) + "&sitesearch=" + getHostname();
var submission = {uri:{spec:url}, postData:null};
return submission;
}
}
})();
|