在时尚中排除网站的子文件夹?

2024-04-09

有没有办法使用 Stylish 排除网站的子文件夹?

@-moz-document domain("www.website.com") { }

将会影响 website.com 的所有页面。问题是,这个网站还托管一个维基(www.website.com/wiki/*),风格完全不同。
一些时尚的 CSS 也会影响这个 wiki,我想避免这种情况。

有什么办法可以做到这一点吗?我读了:在 Firefox 中禁用某些网站上的时尚功能 https://superuser.com/questions/463153/disable-stylish-on-certain-sites-in-firefox,但这是针对全局样式的,我没有。

我应该说我对正则表达式一无所知。


我对 Stylish 编码一无所知,但假设您可以使用 RegEx,您可以尝试以下操作:

www.website.com(?!\/wiki\/).*

所以你的完整代码将是:

@-moz-document regexp('https?://www\\.website\\.com(?!/wiki/).*') {
  ...
}

正则表达式的工作原理如下:

http          # Selects HTTP protocol
s?            # Options s for HTTPS protocol
://           # :// After Protocol
www           # www
\\.           # Escaped . (dot)
website\\.com # Website
(?!           # Start of negative lookahead, If anything inside is found, the match will fail
    /wiki/        # Don't match if inside /wiki/ directory
)             # End of negative lookahead
.*            # Selects any character (.) any amount of times (*)

Live Demo on RegExr http://regexr.com/3d219

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在时尚中排除网站的子文件夹? 的相关文章