Warning: fopen(/www/sites/update.greasyfork.icu/index/store/forever/eb4f20a7c5df6072a021bc81f0d53189.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @name Google+(baidu bing youdao)
// @namespace http://userscripts.org/users/86496
// @description Show results from Baidu, Bing and Youdao in Google web search. | 在Google网页搜索显示百度、有道和必应的搜索结果。
// @include http://www.google.tld/search?*
// @include https://www.google.tld/search?*
// @include http*://www.google.*/*q=*
// @grant GM_log
// @grant GM_xmlhttpRequest
// @version 1.4.4
// @downloadURL none
// ==/UserScript==
(function() {
// only shown in normal search page
if (document.location.href.indexOf('&tbs=') != -1 || document.location.href.indexOf('&tbm=') != -1) return;
// ===Config START | 设置开始===
// Show external results only on the first page? 0-no, 1-yes | 设置是否只在第一页显示?0-否,1-是
var onlyPageOne = 1;
// **The following two lines are not for config, do not modify. | **以下两行并非设置项,请勿修改!
var _q = document.location.search || document.location.href.substring(document.location.href.indexOf('&')-1);
if (onlyPageOne && _q.indexOf('&start=')>=0 && _q.indexOf('&start=0')<0) return;
// Show how many top results | 设置显示头几个搜索结果。
var resultNumber = 3;
var Al_xSearch = [];
// Select which engines' results will be obtained from | 设置外部搜索引擎。
// Structure: Al_xSearch[x] = new Array([0],[1],[2],[3],[4],[5]);
// Rules: Al_xSearch[x][0] - the name of the engine | 搜索引擎的名字。
// Al_xSearch[x][1] - switch, 1-on, 0-off. | 开关,1-启用,0-禁用。
// Al_xSearch[x][2] - the id of the box to contain results | 结果框的 ID。
// Al_xSearch[x][3] - the query Url of the engine | 搜索引擎的搜索 Url。
// Al_xSearch[x][4] - the xpath to find a result | 搜索结果的 xpath。
// Al_xSearch[x][5] - the highlight pattern (selector) | 高亮部分的格式(选择器)。
// x - the displaying order. | 显示顺序号。
Al_xSearch[0] = new Array('Baidu', 1, "baiduResult", 'http://www.baidu.com/s?wd=--keyword--&ie=utf-8', '//*[@id="--i--"]', 'em');
Al_xSearch[1] = new Array('Youdao', 0, "youdaoResult", 'http://www.youdao.com/search?q=--keyword--', '//ol[@id="results"]/li[--i--]' , 'span.hl');
Al_xSearch[2] = new Array('360', 0, "360Result", 'http://www.so.com/s?ie=utf-8&q=--keyword--', '//ul[@id="m-result"]/li[--i--]' , 'em');
Al_xSearch[3] = new Array('Sogou', 1, "sogouResult", 'http://www.sogou.com/web?query=--keyword--&ie=utf8', '//div[@id="main"]/div/div/div[--i--]' , 'em');
Al_xSearch[4] = new Array('Bing', 1, "bingResult", 'http://www.bing.com/search?q=--keyword--', '//li[@class="b_algo"][--i--]', 'strong');
Al_xSearch[5] = new Array('GoogleCN', 0, "gcnResult", 'http://www.google.com.hk/search?q=--keyword--', '//div[@id="ires"]/ol/li[--i--]', 'em');
Al_xSearch[6] = new Array('Weibo', 1, "weiboResult", 'http://www.baidu.com/s?tn=baiduwb&rtt=2&cl=3&ie=utf-8&wd=--keyword--', '//ol[@id="weibo"]/li[--i--]', 'em');
// ===Config END | 设置结束===
var isHash = !!document.location.hash;
setTimeout(go, 1000);
function go(){
// rebuild array
var A_xSearch = new Array();
for (var l=0, m=0; ldiv{max-height:120px;background:white;overflow:hidden;transition:max-height 0.2s ease 1s;}'
+ _xID + ' ._resultMore{max-height:none!important;}'
+ _xID + ' div._result h3{font-size:13pt!important; border-bottom: 1px solid white; margin-bottom:2px;}'
+ _xID + ' div._result:hover, .GoogleSpecial>div:hover{max-height: 1000px; margin-bottom:0px; padding-bottom:5px; background: #F0F7F9; transition:max-height 0.2s ease 0.1s;}'
+ _xID + ' div._result:hover h3{border-bottom: 1px solid #a7cDd6;}'
+ _xID + '>div>*{height: auto!important;}._hilire{background:#ffd!important;background:-moz-linear-gradient(top, #ffd, white)!important;background:-webkit-gradient(linear, 0 0, 0 100%, from(#ffd), to(white))!important;}'
+ _xID + ' ._re_hide>div,' + _xID + ' ._no_result{display:none;}'
+ _xID + ' ._re_more{display:block;height:20px;width:100%;text-align:center;background:#ddd;cursor:pointer;}'
+ _xID + ' ._re_more:hover{background:#F0F7F9!important;}'
+ _xID + ' ._re_hide ._re_more{background:white;}'
+ _xID + ' div._result+div._result,' + _xID + ' ._resultMore {border-top: 1px solid #aaccff;}'
+ _xID + ' div._result,.GoogleSpecial>div{margin-bottom:5px;}'
+ _xID + ' .GoogleSpecial a {margin-left:0px;}';// + _xID + ':hover{width:400px !important;border-left: 2px solid #7799cc;}';
var ex_style = '._external {color: black!important;} ._external:after {content:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAFVBMVEVmmcwzmcyZzP8AZswAZv////////9E6giVAAAAB3RSTlP///////8AGksDRgAAADhJREFUGFcly0ESAEAEA0Ei6/9P3sEcVB8kmrwFyni0bOeyyDpy9JTLEaOhQq7Ongf5FeMhHS/4AVnsAZubxDVmAAAAAElFTkSuQmCC");}';
var tablestyle = _xID + ' td{padding: 5px 0 5px 13px !important;color:#000!important;}'
+ _xID + ' tr+tr>td{padding: 0px 0 8px 13px !important;}' + _xID + ' td>h3{margin-left:-8px;line-height:1.3em;}';
var li_style = _xID + ' div._result>li {padding: 5px 0 8px 13px !important;background-image:none;}'
+ _xID + ' li h3>a:first-child,' + _xID + ' li h3>em {font-size: 13pt !important;margin-left: -8px;}'
+ _xID + ' li>div, ' + _xID + ' li>p {font-size: small;}';
var mat_style = _xID + ' div._match {background: #eee; background:-moz-linear-gradient(top, #eee, white); background:-webkit-gradient(linear, 0 0, 0 100%, from(#eee), to(white)); max-height:1.1em;}' + _xID + ' div._match:hover{max-height: 1000px;}';
var gs_style = /*Google Special*/'.GoogleSpecial div.newsimg>a>div{position:relative!important;}';
var bd_style = /*Baidu link BG img*/'div[id^="baiduResult_"]>div{padding: 5px 0 8px 13px !important;} div[id^="baiduResult_"] h3{margin-left:-8px;line-height:1.3em;} div[id^="baiduResult_"] .favurl{background-position: left center;background-repeat: no-repeat; padding-left: 16px;} div[id^="baiduResult_"] div.c-row div.c-span6, div[id^="baiduResult_"] div[id^="tools_"].c-tools{display:none!important;}';
var bg_style = /*Bing style*/'div[id^="bingResult_"] .crch, div[id^="bingResult"] .sb_tsuf{display:none!important;} h2{margin:5px 0; font-size: 13pt !important; font-weight: 400 !important;}';
var yd_style = /*Youdao style*/'div[id^="youdaoResult_"] .imgbox, div[id^="youdaoResult_"] div.play-icon, div[id^="youdaoResult_"] div.play-bk, div.img{display:none!important;} div[id^="youdaoResult_"] .info .details{margin-left:0px!important;} div[id^="youdaoResult_"] div.intro-des{background:white;} div.floatright{margin-left: 0px !important;}';
var sg_style = /*Sogou style*/'div[id^="sogouResult_"]>div {padding: 7px 0 8px 13px !important;background-image:none;} div[id^="sogouResult_"]>div>h3 {margin-left:-8px;} div[id^="sogouResult_"] .tit-ico {background-position: left 1px;background-repeat: no-repeat;padding-left: 20px;}';
var sz_style = /*360 style*/'div[id^="360Result_"] h3>a>img {width:16px !important; height:16px !important;}';
var wb_style = /*Weibo style*/'div[id^="weiboResult_"] div.weibo_face img{max-height:50px;} div[id^="weiboResult"] div.weibo_img_small img{max-height:120px;} div[id^="weiboResult"] div.weibo_img_small{margin: 3px;} div[id^="weiboResult"] div.weibo_face{float:left;margin:7px;} div[id^="weiboResult"] div.weibo_info{float:right;}';
// Get keyword
_q = _q.slice(1).replace('#','&');
if (_q.length > 0) {
var qspairs = _q.split('&');
for (k = 0; k < qspairs.length; k++) {
if (qspairs[k].indexOf('q=') == 0) {var googlekeyword = qspairs[k].substring(2); break;}
}
} //log('115:'+googlekeyword);
// Prepare frame 1
var googleframe = document.evaluate('//div[@id="rcnt"]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(0);
googleframe.style.position = 'relative';
var googlestyle = '#res>h2+div,#res>div.e,div#navcnt,div.clr{max-width: 840px !important;}#res{max-width:1400px!important;}#iur{height:auto!important;}span.bl{display:none!important;}span.gl{white-space:normal!important;}#nyc{z-index:11!important;}.ds{z-index:9!important;}.mw{max-width:95%;}';
var A_hili_s = new Array();
var A_xS_box = new Array();
for (var a=0;aol>li>div {margin-bottom:0!important;background:white;} \
div#lu_pinned_rhs {overflow:visible!important;} \
#rhs div#lu_pinned_rhs .rhsvw {width:366px!important; padding:0!important;} \
#rhs div#lu_pinned_rhs .rhsvw>div {margin:0!important;} \
div#rhs:hover {height:auto!important; transform:scale(1);} \
#rhs_block {width:auto!important; height:auto!important;} \
._T2 {padding-bottom: 0px!important;}';
// Insert CSS
var headID = document.getElementsByTagName("head")[0];
var cssNode = creaElemIn('style', headID);
cssNode.type = 'text/css';
cssNode.innerHTML = close_style + glo_style + ex_style + tablestyle + li_style + hili_style + googlestyle + mat_style + gs_style + bd_style + bg_style + sg_style + sz_style + yd_style + wb_style + gm_style;
// Prepare links
var lis = document.evaluate('//li[@class="g"]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
var gooRes = [], gooRelnkh = [], gooResNo = 0;
var speIDs = /imagebox_bigimages|imagebox|newsbox|videobox|blogbox/;
for (h=0;h' + (Number(p) + 1) + ' 结果' + _result[j];
if (gooRes[p].className.indexOf('_hilire') == -1) {
gooRes[p].className += ' _hilire';
gooRes[p].title += ';同时为 ' + sname + ' 第 ' + (j + 1) + ' 结果';
} else {
gooRes[p].title += '及 ' + sname + ' 第 ' + (j + 1) + ' 结果';
}
}
}
}
j++;
//if (j == resultNumber) break;
if (j == 10) break;
}
}
for (i=0;i<10;i++) {
set(A_elem[i], _result[i]);
if (_result[i]) A_elem[i].className += ' _result';
}
}
// Construct result boxes
function resultbox(dest, _l) {
//main frame
b = creaElemIn('div', dest);
b.id = _ID;
b.setAttribute("style", bstyle);
//engine frame
var c_first = true;
for (var j=0;j<_l;j++) {
//name frame
c = creaElemIn('div', b);
c.setAttribute('style', cstyle);
c.id = A_xSearch[j][2];
d = creaElemIn('a', c);
addtext(d, A_xSearch[j][0] + ' ');
d.href = A_xSearch[j][3];
d.className = '_external';
if (c_first) { //close button on first engine name frame
close = creaElemIn('a', c);
close.href = '#';
close.className = 'close';
close.addEventListener('click', command_close, false);
close.innerHTML = 'X';
close.title = '关闭';
c_first = false;
}
//result frame
for (var k=0;k";
return str+">"+elem.innerHTML+""+elem.tagName+">";
}
function canHaveChildren(elem) {
return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(elem.tagName.toLowerCase());
}
// Add text node
function addtext(obj, text) {
var content = document.createTextNode(text);
obj.appendChild(content);
}
// 修复微博图片
function fixweibo(_resultcontent) {
var Imgs = _resultcontent.getElementsByTagName('img');
if (!!Imgs[0]) {
for(_i = 0; _i < Imgs.length; _i++) {
Imgs[_i].removeAttribute('onerror');
var imgA = creaElemIn('a', Imgs[_i].parentNode);
imgA.href = Imgs[_i].src;
imgA.target = '_blank';
imgA.appendChild(Imgs[_i]);
}
}
}
// 修复有道链接和图片
function fixyoudao(_resultcontent) {
var Links = _resultcontent.getElementsByTagName('a'), Imgs = _resultcontent.getElementsByTagName('img');
if (!!Links[0]) {
for(_i = 0; _i < Links.length; _i++) {
if (Links[_i].className == 'yl') {
Links[_i].parentNode.parentNode.removeChild(Links[_i].parentNode);
break;
}
var lin = Links[_i].getAttribute('href');
if ((lin.indexOf('http://') != 0) && (lin.indexOf('https://') != 0)) {
if (lin.indexOf('/') == 0) lin = lin.slice(1);
Links[_i].href = 'http://www.youdao.com/' + lin;
}
}
}
if (!!Imgs[0]) {
for(_i = 0; _i < Imgs.length; _i++) {
if (/oimagea\d\.youdao\.com\/image\?/.test(Imgs[_i].src)) {
Imgs[_i].removeAttribute('onerror');
var imgA = document.createElement('a');
imgA.href = Imgs[_i].src;
var _sc = imgA.search;
if (_sc.length > 0) {
var qpairs = _sc.split('&');
for (_k = 0; _k < qpairs.length; _k++) {console.log(qpairs[_k]);
if (qpairs[_k].indexOf('durl=') == 0) {Imgs[_i].src = qpairs[_k].substring(5); break;}
}
}
} else if (!!Imgs[_i].getAttribute('data-img')) {
Imgs[_i].src = Imgs[_i].getAttribute('data-img');
}
}
}
}
// "修复"GoogleCN链接
function fixgcn(_resultcontent) {
var Links = _resultcontent.getElementsByTagName('a');
if (!Links[0]) return;
for(_i = 0; _i < Links.length; _i++) {
if (Links[_i].href && Links[_i].href.match(/^http:\/\/www\.google\..*\/url\?q=/i))
Links[_i].href = Links[_i].href.replace(/^http:\/\/www\.google\..*\/url\?q=(.*?)&.*/i,"$1");
}
}
// "修复"百度Https链接
function fixbd(_resultcontent) {
var Links = _resultcontent.getElementsByTagName('a');
if (!Links[0]) return;
for(_i = 0; _i < Links.length; _i++) {
if (Links[_i].href && Links[_i].href.indexOf('https://www.baidu.com/link') == 0)
Links[_i].href = Links[_i].href.replace('https://www', 'http://www');
}
}
// 修复Bing图片地址
function fixbmg(_resultcontent) {
var Imgs = _resultcontent.getElementsByTagName('img');
if (!Imgs[0]) return;
for(_i = 0; _i < Imgs.length; _i++) {
if (Imgs[_i].src && Imgs[_i].src.indexOf('http://') != 0)
Imgs[_i].src = 'http://www.bing.com' + Imgs[_i].src;
}
}
// Move Google special results right
function moveGoogleSpecialResult() {
var sb = b.insertBefore(document.createElement('div'), b.firstChild);
sb.className = 'GoogleSpecial';
var spReIDs = ['imagebox_bigimages', 'imagebox', 'newsbox', 'videobox', 'blogbox']; //lclbox,
for (i=0;i