把Google搜索伪装成百度搜索

用Google搜索,很多人看到屏幕后会问你怎么上Google的.所以当我们把Google的logo换成百度,他们就不会问那么多问题了!

< Feedback on 把Google搜索伪装成百度搜索

Question/comment

§
Posted: 28.07.2024

与其让愚蠢的油猴判断是不是google搜索,不如脚本内置判断逻辑:

// Line 8
// @match ://*/*

// Line 44(?)
(function () {
    //addCSS()

    if (!(window.location.origin.split("://")[1].startsWith("www.google.co") && window.location.href.split("://")[1].split("/")[1].startsWith("search"))) {
        return;
    }
// ...
})();
§
Posted: 28.07.2024
Edited: 28.07.2024

改正:

// Line 8
// @match ://*/*

// Line 44(?)
(function () {
    //addCSS()

    if (window.location.origin.split("://")[1].startsWith("www.google.co")) {
        let path = window.location.href.split("://")[1].split("/")[1];
        if (path === "") {
        } else if (path.startsWith("search")) {
        } else {
            return;
        }
    } else {
        return;
    }
// ...
})();

Post reply

Sign in to post a reply.