// ==UserScript== // @name 必应搜索Bing精简加样式优化加去广告 // @namespace http://tampermonkey.net/ // @version 1.3 // @description 只有3kb,必应搜索Bing精简加样式优化加去广告。 // @author 极简实用 // @match https://cn.bing.com/search?* // @grant none // @license AGPL // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 修改 h2 标签字体大小 const h2Elements = document.querySelectorAll('h2'); for (const h2 of h2Elements) { h2.style.fontSize = '18px'; // 设置字体大小为18px } // 删除所有 class 为 b_ad 的 li 元素 const adElements = document.querySelectorAll('li.b_ad'); for (const li of adElements) { li.remove(); } // 删除不必要的 div 元素 const divIDsToRemove = ['b_pole', 'b_tween', 'est_switch', 'id_h', 'b_footer']; divIDsToRemove.forEach(id => { const div = document.getElementById(id); if (div) { div.remove(); } }); // 删除所有 class 为 b_tpcn 的 div const b_tpcnElements = document.querySelectorAll('div.b_tpcn'); b_tpcnElements.forEach(div => { const tpttElement = div.querySelector('div.tptt'); if (tpttElement) { // 找到对应的 h2 标签并添加内容到其 a 标签内 const h2 = div.closest('li.b_algo').querySelector('h2 a'); if (h2) { h2.textContent += ' ' + tpttElement.textContent; // 添加内容 } } div.remove(); // 删除 b_tpcn 元素 }); // 删除所有包含 data-partnertag 的 ul 元素 const partnerTagElements = document.querySelectorAll('ul[data-partnertag]'); partnerTagElements.forEach(ul => ul.remove()); // 删除所有包含 p class="b_lineclamp2 b_algoSlug" 的 li class="b_algo" 的元素 const algoElements = document.querySelectorAll('li.b_algo'); algoElements.forEach(li => { const pElement = li.querySelector('p.b_lineclamp2.b_algoSlug'); if (pElement) { li.remove(); } }); // 添加自定义样式 const style = document.createElement('style'); style.textContent = ` #b_results > .b_algo { padding: 0px; /* 设置 .b_algo 的 padding 为 0 */ } #b_content { padding-top: 0px !important; /* 设置 b_content 的顶部内边距为 0 */ padding-bottom: 0px !important; /* 设置 b_content 的底部内边距为 0 */ } `; document.head.appendChild(style); })();