问题描述
是否可以使用时尚"排除网站的子文件夹?
Is there a way to exclude subfolders of a website using Stylish?
@-moz-document domain("www.website.com") { }
将影响website.com的所有页面.问题是,该网站还托管一个完全不同样式的Wiki( www.website.com/wiki/*
).
一些时尚的CSS也会影响此Wiki,我想避免这种情况.
Will affect all pages of website.com. The problem is, this website also hosts a wiki (www.website.com/wiki/*
), which has an entirely different style.
Some of the Stylish CSS affects this wiki as well, which I want to avoid.
有没有办法做到这一点?我已阅读:在Firefox的某些网站上禁用了时尚,但是这是我没有的全球风格.
Is there any way to do this? I've read: Disable stylish on certain sites in Firefox, but this is for a global style, which I don't have.
我应该说我对正则表达式一无所知.
I should say I don't understand anything of regexp.
推荐答案
我对时尚"中的编码一无所知,但是假设您可以使用RegEx,则可以尝试以下操作:
I don't know anything about coding in Stylish, but assuming you can use RegEx, you could try the following:
www.website.com(?!\/wiki\/).*
因此,您的完整代码将是:
So your full code will be:
@-moz-document regexp('https?://www\\.website\\.com(?!/wiki/).*') {
...
}
正则表达式的工作方式如下:
Here is how the RegEx works:
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 (*)
这篇关于排除“时尚"网站的子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!