pugson / twitter-dark-mode

⛔️ Dark mode style for Twitter.com & mobile.twitter.com
https://userstyles.org/styles/135366/twitter-dark-mode-2017
GNU General Public License v3.0
20 stars 7 forks source link

Fix Stylish URL regular expression #27

Closed elamperti closed 7 years ago

elamperti commented 7 years ago

Problem As it is now, Stylish is using this regex: ^(?!.*tweetdeck\.twitter).*(.*twitter\.com.*) :x:

This arises problems in cases where it shouldn't be matching:

Solution It could be fixed by replacing it by this new regex: ^https?:\/\/twitter\.com\/.* :white_check_mark: (which is also a bit more elegant! :bowtie: )

Tested with this regex101 demo and manually in my browser's Stylish


Also line 1 of the CSS should be:

@-moz-document regexp('^https?:\/\/twitter\.com\/.*') {

(this CSS change won't have effect if it's being manually changed/overriden at Stylish)

pugson commented 7 years ago

I've used a regex before but it broke compatibility with TamperMonkey and similar extensions. Check out this thread on UserStyles. If you find a way to have it working properly with Stylish and TamperMonkey, let me know!

I'm using a url-prefix at the moment: https://github.com/dubstrike/twitter-dark-mode/blob/master/darkmode.scss#L1

elamperti commented 7 years ago

The match pattern was updated after the changes you made today for #28, now Stylish is targeting just the correct domains without using regular expressions, so I'll consider this solved :slightly_smiling_face: Thank you!

pugson commented 7 years ago

Actually it was updated over 2 weeks ago. Do you have auto-updates enabled in Stylish?

elamperti commented 7 years ago

That would explain why I though it was being overriden! :man_facepalming: I'll turn auto-updates on too :grin:

pugson commented 7 years ago

@elamperti Cheers!