// ==UserScript== // @name No Keywords // @name:zh-CN 移除搜索关键词 // @namespace http://tampermonkey.net/ // @version 0.1 // @description Get rid of fucking highlighted search keywords. // @description:zh-CN 去你妈的傻逼高亮搜索关键词。 // @author PRO // @match https://zhidao.baidu.com/question/* // @match https://www.bilibili.com/* // @icon https://cors.cdn.bcebos.com/amis/namespaces/m-activity/iknow-duck/2022-12/1671625780490/%E6%90%9C%E7%B4%A2wap.png // @grant none // @license gpl-3.0 // @downloadURL none // ==/UserScript== (function() { 'use strict'; function purify_once() { let flag = false; if (sel_icon) { let icon = document.querySelector(sel_icon); if (icon) { icon.remove(); flag = true; } } let keyword = document.querySelector(sel_keyword); if (keyword) { let word = keyword.textContent; let to_replace = keyword.outerHTML; let container = keyword.parentElement; container.innerHTML = container.innerHTML.replace(to_replace, word); flag = true; } return flag; } function purify() { let cnt = 0; while (purify_once()) { cnt++; } if (cnt) console.log(`[No Search Keywords] Purified ${cnt} keywords!`); } let config = { "zhidao.baidu.com": { keyword: ".rich-content-container a[highlight='true']", icon: null, persistent: false }, "www.bilibili.com": { keyword: "a.search-word", icon: "i.search-word", persistent: true } } if (!(window.location.hostname in config)) return; let sel_keyword = config[window.location.hostname].keyword; let sel_icon = config[window.location.hostname].icon; if (config[window.location.hostname].persistent) { window.setInterval(purify, 1000); } else { purify(); } })();