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

时间:2016-03-20 13:10:05

标签: css regex stylish

有没有办法使用Stylish?

排除网站的子文件夹?
@-moz-document domain("www.website.com") { }

会影响website.com的所有页面。问题是,这个网站还有一个wiki(www.website.com/wiki/*),它的风格完全不同 一些时尚的CSS也会影响这个wiki,我想避免使用它。

有没有办法做到这一点?我读过:Disable stylish on certain sites in Firefox,但这是一种全球风格,我没有。

我应该说我对regexp一无所知。

1 个答案:

答案 0 :(得分:3)

我对Stylish中的编码一无所知,但假设您可以使用RegEx,您可以尝试以下方法:

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

所以你的完整代码将是:

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

以下是RegEx的工作原理:

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

相关问题