// ==UserScript== // @name 为百度搜索结果页添加磁力、种子、网盘、软件、头条、哔哩哔哩、Google搜索按钮,为Google添加百度搜索按钮 // @description 给百度搜索引擎的结果页加入头条、哔哩哔哩、软件、网盘搜索按钮,一键跳转到磁力、种子、网盘、软件、头条、哔哩哔哩、Google搜索进行相同关键词的检索;在google搜索结果页添加百度搜索按钮,一键跳转到百度搜索进行相同关键词的检索。支持去除百度结果页面的广告和右边栏。 // @icon https://www.baidu.com/cache/icon/favicon.ico // @namespace https://greasyfork.org/zh-CN/scripts/396960 // @version 1.3 // @author ddrwin // @run-at document-start // @include http*://*baidu.com/s* // @include http*://*baidu.com/baidu* // @include *://www.google.com/search?* // @include *://www.google.com.*/search?* // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js // @grant GM_addStyle // @grant GM_getResourceText // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_registerMenuCommand // @note 2020.2.22 V1.0 在百度搜索的结果页加入磁力、种子、网盘、Google搜索按钮; // @note 2020.2.23 V1.1 在google搜索的结果页加入百度搜索按钮; // @note 2020.2.25 V1.2 增加软件搜索、增加头条搜索、哔哩哔哩搜索; // @note 2020.2.26 V1.3 重写代码,将种子搜索、磁力搜索集成到网盘搜索中、同时软件搜索增加多个搜索网址; // @downloadURL none // ==/UserScript== (function() { 'use strict'; var hostname = window.location.hostname; if(hostname.match(RegExp(/baidu.com/))){ // 百度上添加其他搜索 var style_tag_baidu = document.createElement('style'); style_tag_baidu.innerHTML = '#content_right{display:none;}'; // 移除百度右侧栏 document.head.appendChild(style_tag_baidu); document.addEventListener ("DOMContentLoaded",show_button_baidu); // 参考:https://stackoverflow.com/questions/26268816/how-to-get-a-greasemonkey-script-to-run-both-at-run-at-document-start-and-at-r function show_button_baidu () { $('#content_left>div').has('span:contains("广告")').remove();// 去除常规广告 // $('#content_right>div').has('span:contains("广告")').remove(); //添加Google搜索按钮 $('.s_btn_wr,#s_btn_wr').after('') $("#google").click(function(){ window.open('https://www.google.com/ncr?gws_rd=ssl#newwindow=1&q=' + encodeURIComponent($('#kw').val())); }) // 结束 //添加哔哩哔哩搜索按钮 $('.s_btn_wr,#s_btn_wr').after('') $("#bilibili").click(function(){ window.open('https://search.bilibili.com/all?keyword=' + encodeURIComponent($('#kw').val())); }) // 结束 //添加头条搜索按钮 $('.s_btn_wr,#s_btn_wr').after('') $("#toutiao").click(function(){ window.open('https://www.toutiao.com/search/?keyword=' + encodeURIComponent($('#kw').val())); }) // 结束 //添加软件搜索按钮 $('.s_btn_wr,#s_btn_wr').after('') $("#soft").click(function(){ window.open('https://www.ghpym.com/?s=' + encodeURIComponent($('#kw').val())); window.open('http://www.qiuquan.cc/?s=' + encodeURIComponent($('#kw').val())); window.open('https://hrtsea.com/?s=' + encodeURIComponent($('#kw').val())); window.open('https://www.baidu.com/s?wd= ' + encodeURIComponent($('#kw').val()) + " site:www.52pojie.cn"); window.open('https://www.macno1.com/search.php?q=' + encodeURIComponent($('#kw').val())); window.open('http://www.carrotchou.blog/?s=' + encodeURIComponent($('#kw').val())); window.open('http://www.zdfans.com/search.asp?keyword=' + encodeURIComponent($('#kw').val())); }) // 结束 //添加网盘搜索按钮 $('.s_btn_wr,#s_btn_wr').after('') $("#magnet_torrent_baidupan").click(function(){ window.open('https://www.dashengpan.com/search?keyword=' + encodeURIComponent($('#kw').val())); window.open('https://www.torrentkitty.me/search/' + encodeURIComponent($('#kw').val())); window.open('http://www.clb.biz/s/' + encodeURIComponent($('#kw').val())); window.open('https://www.ywxinxi.com/search/' + encodeURIComponent($('#kw').val())); }) // 结束 function del_delayed_ads(){ $('.c-container').has('.f13>span:contains("广告")').remove(); } setTimeout(function () { del_delayed_ads(); }, 2100); // 去除顽固性的延迟加载广告,一般延迟2秒左右。例如搜索“淘宝”,当页面加载完毕之后在搜索结果最前或最后会再插入一个广告。 } } // 百度上添加其他搜索结束 else if(hostname.match(RegExp(/google.com/))){ //Google上添加百度搜索 document.addEventListener ("DOMContentLoaded", show_button_google); function show_button_google () { var url_baidu = "https://www.baidu.com/s?wd=" + encodeURIComponent($(".gLFyf.gsfi:first").val()) + "&from=TsingScript"; $(".RNNXgb:first").append('
'); $(".gLFyf.gsfi:first").change(function(){ var url_baidu_new = "https://www.baidu.com/s?wd=" + encodeURIComponent($(".gLFyf.gsfi:first").val()) + "&from=TsingScript"; $("#google++").attr('onclick','window.open("'+ url_baidu_new + '")'); }); } } // 结束 GM_registerMenuCommand ("欢迎提出建议和意见", menu_func, ""); // 注册脚本的菜单选项 function menu_func () { window.open("https://greasyfork.org/zh-CN/scripts/396960/feedback"); } console.log("%cThanks for using baidu++ script, enjoy your time here."," font-size:14px; background:#444; border-radius:3px; padding:2px 5px; color:#ffff66; margin:10px 0;","--by ddrwin"); })();