Greasy Fork

Greasy Fork is available in English.

百度搜索去除n+

去除搜索跳转及相关推荐

当前为 2020-12-08 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         百度搜索去除n+
// @namespace    http://tampermonkey.net/
// @version      0.1.3
// @description  去除搜索跳转及相关推荐
// @author       MT-戒酒的李白染
// @match        https://www.baidu.com/from=*
// @match        https://www.baidu.com/s?word=*
// @grant        GM_addStyle
// @require	     http://cdn.staticfile.org/jquery/2.1.4/jquery.min.js
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';



function main_start() {
	var tpl_len = $(".c-result.result").length;
	try {
		for (var i = 0; i < tpl_len; i++) {
			var tpl_text = $(".c-result.result")[i].attributes.tpl.textContent;
			if (tpl_text == "recommend_list") {
				$(".c-result.result")[i].remove();
			}
            var real_url = JSON.parse($(".c-result.result")[i].attributes["data-log"].value)["mu"];
            console.log(real_url);
            $(".c-gap-inner-bottom-lh")[i].children[0].href=real_url//中间
            $(".c-result.result")[i].children[0].children[0].attributes["rl-link-href"].value=real_url//标题
		}
	} catch(err) {}

	try {
		$(".c-container.na-ec-item")[0].remove()
	} catch(err) {}
	try {
		$(".c-recomm-wrap.new-ux-recom-wrapper.animation")[0].remove()
	} catch(err) {}
    setTimeout(function(){try {$(".c-container.na-ec-item")[0].remove()} catch(err) {}},500);
    setTimeout(function(){try {$(".c-recomm-wrap.new-ux-recom-wrapper.animation")[0].remove()} catch(err) {}},500);
}
GM_addStyle(".c-container.na-ec-item,.c-recomm-wrap.new-ux-recom-wrapper.animation{display:none}")
     $(function(){main_start();})
})();