Greasy Fork is available in English.
只有3kb,必应搜索Bing精简加样式优化加去广告。
当前为
// ==UserScript==
// @name 必应搜索Bing精简加样式优化加去广告
// @namespace http://tampermonkey.net/
// @version 1.1
// @description 只有3kb,必应搜索Bing精简加样式优化加去广告。
// @author 极简实用
// @match https://cn.bing.com/search?*
// @grant none
// @license AGPL
// ==/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();
}
// 删除 id 为 b_pole 的 div
const divBPole = document.getElementById('b_pole');
if (divBPole) {
divBPole.remove();
}
// 删除所有 class 为 b_tpcn 的 div
const b_tpcnElements = document.querySelectorAll('div.b_tpcn');
for (const div of b_tpcnElements) {
div.remove();
}
// 删除 id 为 b_tween 和 est_switch 的 div
const divBTween = document.getElementById('b_tween');
if (divBTween) {
divBTween.remove();
}
const divEstSwitch = document.getElementById('est_switch');
if (divEstSwitch) {
divEstSwitch.remove();
}
// 删除 id 为 id_h 的 div
const divIdH = document.getElementById('id_h');
if (divIdH) {
divIdH.remove();
}
// 删除 id 为 b_footer 的 footer
const footerB = document.getElementById('b_footer');
if (footerB) {
footerB.remove();
}
// 删除所有包含 data-partnertag 的 ul 元素
const partnerTagElements = document.querySelectorAll('ul[data-partnertag]');
for (const ul of partnerTagElements) {
ul.remove();
}
// 删除所有包含 p class="b_lineclamp2 b_algoSlug" 的 li class="b_algo" 的元素
const algoElements = document.querySelectorAll('li.b_algo');
for (const li of algoElements) {
const pElement = li.querySelector('p.b_lineclamp2.b_algoSlug');
if (pElement) {
li.remove();
}
}
// 删除 class 为 b_rs 的 div
const bRsElements = document.querySelectorAll('div.b_rs');
for (const div of bRsElements) {
div.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);
})();