Exclude subfolders of a website in Stylish?

天涯浪子 提交于 2021-01-28 04:36:38

问题


Is there a way to exclude subfolders of a website using Stylish?

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

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.

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.


回答1:


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 (*)

Live Demo on RegExr



来源:https://stackoverflow.com/questions/36114101/exclude-subfolders-of-a-website-in-stylish

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!