// ==UserScript== // @name Pinterest搜索框内容屏蔽助手 // @name:en Pinterest Search Box Content Blocker // @name:zh-TW Pinterest 搜尋框內容屏蔽器 // @name:ja Pinterest 検索ボックスコンテンツブロッカー // @namespace http://tampermonkey.net/ // @version 0.1 // @description Block specific elements on Pinterest page // @description:en A Tampermonkey script to block the search box content on Pinterest. // @description:zh-tw 一個用於在 Pinterest 上屏蔽搜尋框內容的 Tampermonkey 腳本。 // @description:ja Pinterest で検索ボックスのコンテンツをブロックする Tampermonkey スクリプト。 // @author CobleeH // @match https://www.pinterest.jp/* // @grant none // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/490914/Pinterest%E6%90%9C%E7%B4%A2%E6%A1%86%E5%86%85%E5%AE%B9%E5%B1%8F%E8%94%BD%E5%8A%A9%E6%89%8B.user.js // @updateURL https://update.greasyfork.icu/scripts/490914/Pinterest%E6%90%9C%E7%B4%A2%E6%A1%86%E5%86%85%E5%AE%B9%E5%B1%8F%E8%94%BD%E5%8A%A9%E6%89%8B.meta.js // ==/UserScript== (function() { 'use strict'; // 定义要屏蔽的元素选择器 var selectors = [ "#SuggestionsMenu > div > div > div:nth-child(1) > div > div > div", // 最近的搜尋 "#SuggestionsMenu > div > div > div:nth-child(2) > div > div > div", // 適合你的Pin "#SuggestionsMenu > div > div > div:nth-child(3) > div > div > div" // Pinterest的熱門內容 ]; // 创建 MutationObserver 实例 var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // 监听到 DOM 变化时,检查要屏蔽的元素是否已经出现 selectors.forEach(function(selector) { var blockedElement = document.querySelector(selector); // 如果要屏蔽的元素存在,则移除它 if (blockedElement) { blockedElement.parentNode.removeChild(blockedElement); } }); }); }); // 配置 MutationObserver 监听的目标节点和选项 var targetNode = document.body; var config = { childList: true, subtree: true }; // 启动 MutationObserver observer.observe(targetNode, config); })();