-2

我正在尝试在 Tampermonkey 4.7(适用于 Safari 12)中安装Darker Google用户脚本,但它不起作用。

由于我是 Tampermonkey 的新手,我真的不知道该把手放在哪里。

在 Tampermonkey 的仪表板中,我看到此用户脚本与任何特定网站都不匹配,而例如Darker Facebook显示“* .facebook.com”并且它可以工作,但也许这只是一个错误的猜测。

用户脚本的开头是:

(function() {var css = "";
css += [
        "/* Darker Google by Zigboom Designs */",
        "",
        "@namespace url(http://www.w3.org/1999/xhtml);"
    ].join("\n");
if (false ||
    (document.location.href.indexOf("http://blogsearch.google") == 0) ||
    (document.location.href.indexOf("http://books.google") == 0) ||
    (document.location.href.indexOf("http://209.85.165.104") == 0) ||
    (document.location.href.indexOf("http://translate.google") == 0) ||
    (document.location.href.indexOf("http://video.google") == 0) ||
    (document.location.href.indexOf("https://encrypted.google") == 0) ||
    (document.location.href.indexOf("https://translate.google") == 0) ||
    (document.location.href.indexOf("http://scholar.google") == 0) ||
    (document.location.href.indexOf("https://scholar.google") == 0) ||
    (document.location.href.indexOf("http://images.google") == 0) ||
    (document.location.href.indexOf("https://images.google") == 0) ||
    (document.location.href.indexOf("https://www.google.com/fonts") == 0) ||
    (new RegExp("^https?://www\\.google\\.[a-z.]*/(?!calendar|nexus|adsense|analytics|maps).*$")).test(document.location.href))

这让我觉得它应该匹配任何 *.google.com 网站......但事实并非如此。

4

1 回答 1

0

这是因为用户脚本没有在页面中运行。添加以下行,保存并重新加载页面。

// @match *://*.google.com/*

以上使用户脚本在谷歌网站上运行。

有关匹配模式,请参阅此处

于 2018-11-08T15:13:37.423 回答