Tampermonkey 的评价
Tampermonkey 作者: Jan Biniok
DannSKiller 的评价
评分 5 / 5
来自 DannSKiller, 2 年前After getting annoyed with searches I didn't want showing up on my Google page, especially for video searches, my web browser redirected me to TikTok. That platform is totally useless and shouldn't even be linked with Google. I'm sharing the script below that will help you block sites as well."
// ==UserScript==
// @name Google Search Filter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Filter out specified sites from Google search results
// @author Your Name
// @match https://www.google.com/search*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const blockedSites = ['example.com', 'anotherexample.com']; // Add the sites you want to block here
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
blockedSites.forEach(site => {
const results = document.querySelectorAll(`a[href*="${site}"]`);
results.forEach(result => {
const parent = result.closest('.g'); // Google results container
if (parent) {
parent.style.display = 'none';
}
});
});
}
});
});
observer.observe(document.body, { childList: true, subtree: true });
// Initial execution for already loaded content
blockedSites.forEach(site => {
const results = document.querySelectorAll(`a[href*="${site}"]`);
results.forEach(result => {
const parent = result.closest('.g'); // Google results container
if (parent) {
parent.style.display = 'none';
}
});
});
})();
// ==UserScript==
// @name Google Search Filter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Filter out specified sites from Google search results
// @author Your Name
// @match https://www.google.com/search*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const blockedSites = ['example.com', 'anotherexample.com']; // Add the sites you want to block here
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
blockedSites.forEach(site => {
const results = document.querySelectorAll(`a[href*="${site}"]`);
results.forEach(result => {
const parent = result.closest('.g'); // Google results container
if (parent) {
parent.style.display = 'none';
}
});
});
}
});
});
observer.observe(document.body, { childList: true, subtree: true });
// Initial execution for already loaded content
blockedSites.forEach(site => {
const results = document.querySelectorAll(`a[href*="${site}"]`);
results.forEach(result => {
const parent = result.closest('.g'); // Google results container
if (parent) {
parent.style.display = 'none';
}
});
});
})();
5,241 条评价
- 评分 5 / 5来自 Firefox 用户 19743679, 1 天前
- 评分 5 / 5来自 Firefox 用户 10447271, 4 天前
- 评分 5 / 5来自 Firefox 用户 19729411, 9 天前
- 评分 5 / 5来自 left2crazy, 1 个月前
- 评分 5 / 5来自 melodic mustox, 1 个月前Thanks to Tampermonkey, I can do a lot of things from my browser. I thanks with a donation, which I will repeat next month again for sure.
- 评分 4 / 5来自 Carlos Páez, 2 个月前
- 评分 5 / 5来自 Firefox 用户 13035229, 2 个月前
- 评分 5 / 5来自 Firefox 用户 18699594, 2 个月前
- 评分 5 / 5来自 Antonio Johns, 2 个月前
- 评分 5 / 5来自 Marlon Ruiz, 2 个月前