Hello! I have changed a few websites appearance with the userContent.css, but I’d like this to only apply to normal browsing, and not to private browsing. the UserChrome instead I’d like to be applied for both normal and private browsing. Is this possible? searching the web didn’t give me any useful result… thanks in advance!

  • @MrOtherGuy
    link
    English
    1
    edit-2
    11 months ago

    Hmm. I don’t have a good solution for that. It would be trivial using an extension like Stylus though, just don’t allow it to run in PB mode.

    I suppose you could do all your @-moz-document matching with regexp and then using a bookmarklet to add some “mark” to the document url. Then you wouldn’t need to use PB-mode at all.

    So, a bookmarklet like this, when clicked, adds/removes a#pbm suffix to the current tab and loads that address to a new tab:

    javascript:void ((loc)=>window.open(loc.endsWith("#pbm")?loc.slice(0,-4):loc+"#pbm"))(document.location.href)
    

    Then in you userContent.css you would write your document matching like this (example is for en.wikipedia.org):

    @-moz-document regexp(".*en\.wikipedia\.org.*(?<!#pbm)$"){
      body{ color: red !important; }
    }
    

    That should work but honestly if you need this then I would rather just use extension like Stylus or open those links in separate profiles even.

    • tubbaduOP
      link
      English
      1
      edit-2
      11 months ago

      @-moz-document regexp(".*en\.wikipedia\.org.*(?<!#pbm)$"){ body{ color: red !important; }

      this is really cool! I wouldn’t even need a bookmarklet, I can just manually add it whenever I wish to remove the css

      it’s not what I was looking for, but it’s a great compromise. Thank you very much!