指鼠为鸭

这个世界上不再有鼠鼠,全是鸭鸭!

目前為 2023-06-08 提交的版本,檢視 最新版本

// ==UserScript==
// @name         指鼠为鸭
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  这个世界上不再有鼠鼠,全是鸭鸭!
// @author       HowardZhangdqs
// @match        https://www.bing.com/search?*
// @match        https://www.baidu.com/s?*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bing.com
// @grant        none
// @license      WTFPL
// ==/UserScript==

(function() {
    'use strict';

    // 需要替换的内容
    const replace_ls = {
        '鸭脖': /老鼠|鼠鼠/g,
        '鸭': /鼠/g,
    };

    // Get all DOM tags on the webpage
    var tags = document.querySelectorAll('#b_results, #wrapper, #sb_form_q');

    // Loop through all DOM tags
    for (var i = 0; i < tags.length; i++) {
        // Get the innerHTML of the current tag
        var html = tags[i].innerHTML;

        // Replace all occurrences of "老鼠" with "鸭脖"
        for (let i in replace_ls)
            html = html.replace(replace_ls[i], i);

        // Set the new innerHTML of the current tag
        tags[i].innerHTML = html;
    }


    // Your code here...
})();