Stop stylish from applying the style to certain pages.

edited November 2017 in Style Development Chrome
I have searched the site and can't find exactly what I am looking for. I am making a style for Reddit. I want the style to work on every 'main page' of Reddit, but not on things like comment pages or the inbox.

I want it to work on:
https://www.reddit.com
https://www.reddit.com/r/all/
https://www.reddit.com/r/subreddit/
etc.

But I do not want it to work on:
https://www.reddit.com/r/subreddit/comments/
https://www.reddit.com/message/inbox/
etc.

How do I achieve this?

Comments

  • Try if it works if you put your code inside

    @-moz-document url("https://www.reddit.com/"), 
        regexp("https?:\\/\\/www\\.reddit\\.com\\/r\\/((?!\\/comments\\/).)+")  {
    
        /* your code here*/
    
    }
    
  • I thought I had thanked you for this. Sorry. Thank you so much.

    How would I do this for user profiles. Reddit changed them recently so they appear blank with my style.

    https://www.reddit.com/user/USERNAME

    I wish I understood regexp code.
  • I need more info. Why not just use

    @-moz-document url-prefix("https://www.reddit.com/user/") {
        /* your code here */
    }
    

    ?

    RegEx

  • Wouldn't that apply the code to the user page? I want it to ignore the userpage but work on all other parts of the site.
  • Also thank you again for your help.
  • edited February 27 Firefox

    Then try if this works sufficient for you

    @-moz-document url("https://www.reddit.com/"), 
        url("https?:\\/\\/www\\.reddit\\.com\\/((?!message\\/|user\\/|r\\/.+\\/comments\\/).)+") {
    
    /* your code here */
    
    }
    
    includes:
    https://www.reddit.com
    https://www.reddit.com/r/all/
    https://www.reddit.com/r/subreddit/
    
    excludes:
    https://www.reddit.com/r/subreddit/comments/
    https://www.reddit.com/message/inbox/
    https://www.reddit.com/user/USERNAME
    
  • Sorry for another late reply:

    Style code has an invalid @-moz-document value: url https?:\/\/www\.reddit\.com\/((?!message\/|user\/|r\/.+\/comments\/).)+. Read https://github.com/JasonBarnabe/stylish/wiki/Valid-@-moz-document-rules for more info.
  • ehm yeah it shouldn't be url, but regexp. Sorry for my mistake.
    Furthermore I'm not sure if I put those extra brackets on purpose. Removed them and still looks fine.

    @-moz-document url("https://www.reddit.com/"), 
        regexp("https?:\\/\\/www\\.reddit\\.com\\/(?!message\\/|user\\/|r\\/.+\\/comments\\/).+") {
    
    /* your code here */
    
    }
    

    Ask back, if something doesn't work.

Sign In or Register to comment.