您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
百度聚合搜索,支持谷歌,必应,360搜索,搜狗,淘宝,京东,知乎,B站,豆瓣,优酷,爱奇艺,GitHub,云盘精灵,大圣盘,大力盘,小昭来啦,小可搜搜,支持谷歌搜索链接新窗口打开,可以在下面的自定义处自定义自己的内容,也在代码开关中开启或关闭百度聚合功能及谷歌搜索链接新窗口打开功能。
当前为
// ==UserScript== // @name 百度聚合搜索,支持谷歌,必应,360搜索,搜狗,淘宝,京东,知乎,B站,豆瓣,优酷,爱奇艺,GitHub等 // @namespace bbs.91wc.net // @version 0.3 // @description 百度聚合搜索,支持谷歌,必应,360搜索,搜狗,淘宝,京东,知乎,B站,豆瓣,优酷,爱奇艺,GitHub,云盘精灵,大圣盘,大力盘,小昭来啦,小可搜搜,支持谷歌搜索链接新窗口打开,可以在下面的自定义处自定义自己的内容,也在代码开关中开启或关闭百度聚合功能及谷歌搜索链接新窗口打开功能。 // @author Wilson // @match https://www.baidu.com/* // @match https://www.google.com/search* // @grant GM_setValue // @grant GM_getValue // @run-at document-end // @license GPL License // ==/UserScript== (function() { 'use strict'; /////////////// 变量配置 /////////////////////////// //是否开启谷歌搜索链接新窗口打开 var is_google_blank = 1; //是否开启百度聚合搜索 var is_baidu_multi_search=1; /////////////// 谷歌新窗口打开 /////////////////////////////////////// //谷歌搜索链接新窗口打开 if(document.domain.indexOf("google.com")!==-1 && is_google_blank){ var loadJs=function(url, callback){ var script = document.createElement('script'); callback = callback || function(){}; script.type = 'text/javascript'; script.onload = function(){ callback(); }; script.src = url; document.getElementsByTagName('body')[0].appendChild(script); }; //加载jQuery if(typeof jQuery == 'undefined'){ loadJs('https://libs.baidu.com/jquery/1.9.1/jquery.min.js', function(){ $("#search div.r a").attr("target", "_blank"); }); } return; } /////////////// 百度聚合搜索 ////////////////////////////////////////////// if(!is_baidu_multi_search){ return; } var getkw = function(){ return encodeURIComponent($("#kw").val().replace(/^\s+|\s+$/gm,'')); }; var bindSearch=function(kw){ if($("#wish_search_wrapper").length > 0){ return; } //搜索列表HTML,可在这里调整显示顺序和列表显示效果 var html=`<style> #wish_search_wrapper a{display:inline-block;padding:0 4px;font-size: 16px;}#wish_search_wrapper a:hover{background:#EBF1FB;} .wish_s_item{margin-top:8px;} </style> <div id="wish_search_wrapper" style="position:absolute;top:60px;background:#fff;z-index:999999"> <div><a href="javascript:;" id="wish_search_openclose">关闭</a></div> <div id="wish_search_content"> <div id="wish_search_list" style="overflow:hidden;"> <!-------------------------这里可以自定义自己的内容哦-----------------------> <!--google--> <div class="wish_s_item"><a href="https://www.google.com/search?q=#keyword#" target="_blank">谷歌搜索</a></div> <!--bing--> <div class="wish_s_item"><a href="https://cn.bing.com/search?q=#keyword#" target="_blank">Bing搜索</a></div> <!--360搜索--> <div class="wish_s_item"><a href="https://www.so.com/s?q=#keyword#" target="_blank">360搜索</a></div> <!--搜狗--> <div class="wish_s_item"><a href="https://www.sogou.com/web?query=#keyword#" target="_blank">搜狗搜索</a></div> <!--淘宝--> <div class="wish_s_item"><a href="https://s.taobao.com/search?q=#keyword#" target="_blank">淘宝搜索</a></div> <!--京东--> <div class="wish_s_item"><a href="http://search.jd.com/Search?keyword=#keyword#" target="_blank">京东搜索</a></div> <!--知乎--> <div class="wish_s_item"><a href="https://www.zhihu.com/search?type=content&q=#keyword#" target="_blank">知乎搜索</a></div> <!--B站--> <div class="wish_s_item"><a href="http://search.bilibili.com/all?keyword=#keyword#" target="_blank">Bilibili搜索</a></div> <!--豆瓣--> <div class="wish_s_item"><a href="https://www.douban.com/search?source=suggest&q=#keyword#" target="_blank">豆瓣搜索</a></div> <!--优酷--> <div class="wish_s_item"><a href="https://so.youku.com/search_video/q_#keyword#" target="_blank">优酷搜索</a></div> <!--爱奇艺--> <div class="wish_s_item"><a href="https://so.iqiyi.com/so/q_%E5%A5%BD%E5%A5%BD#keyword#" target="_blank">爱奇艺搜索</a></div> <!--GitHub--> <div class="wish_s_item"><a href="https://github.com/search?utf8=✓&q=#keyword#" target="_blank">GitHub搜索</a></div> <!--云盘精灵--> <div class="wish_s_item"><a href="https://www.yunpanjingling.com/search/#keyword#" target="_blank">云盘精灵搜</a></div> <!--大圣盘--> <div class="wish_s_item"><a href="https://www.dashengpan.com/search?keyword=#keyword#" target="_blank">大圣盘搜索</a></div> <!--大力盘--> <div class="wish_s_item"><a href="https://www.dalipan.com/search?keyword=#keyword#" target="_blank">大力盘搜索</a></div> <!--小昭来啦--> <div class="wish_s_item"><a href="https://www.xiaozhaolaila.com/s/search?q=#keyword#" target="_blank">小昭来啦</a></div> <!--小可搜搜--> <div class="wish_s_item"><a href="https://www.xiaokesoso.com/s/search?q=#keyword#" target="_blank">小可搜搜</a></div> <!-------------------------自定义结束-----------------------> </div> <div id="wish_search_more_wrapper" style="text-align:center;"> <a id="wish_search_more_btn" href="javascript:;" style="display:inline-block;width:80px;height:50px;line-height:40px;font-size:16px;border-top:1px solid #ccc;">更多</a> </div> <div> </div>`; //追加搜索列表 kw=kw||getkw(); html = html.replace(/#keyword#/gm, kw); $("#result_logo").after(html); //设置列表高度 var wish_search_list = $('#wish_search_list'); var listH=wish_search_list.outerHeight(true); var winH=$(window).height()-70; if(listH > winH){ winH -= 50; $("#wish_search_more_wrapper").show(); $("#wish_search_more_btn").click(function(){ $("#wish_search_more_wrapper").hide(); winH += 44; wish_search_list.height(winH); $("#wish_search_list").css("overflow", "auto"); }); } wish_search_list.height(winH); //列表关闭 var wish_s_open_key="__wish_s_open"; $("#wish_search_openclose").click(function(){ if(GM_getValue(wish_s_open_key, 1)){ //关闭 $("#wish_search_content").hide(); $(this).html("开启聚合搜索"); GM_setValue(wish_s_open_key, 0); } else { //开启 $("#wish_search_content").show(); $(this).html("关闭"); GM_setValue(wish_s_open_key, 1); } }); if(GM_getValue(wish_s_open_key, 1)){ //开启 $("#wish_search_content").show(); $("#wish_search_openclose").html("关闭"); } else { //关闭 $("#wish_search_content").hide(); $("#wish_search_openclose").html("开启聚合搜索"); } }; //监控百度首页变化 $('#wrapper_wrapper').on("DOMNodeInserted", function(){ bindSearch(); }); //匹配百度搜索页 if(location.href.indexOf("wd=")!==-1){ bindSearch(); } })();