tholinka / Dark-Crunchyroll-Plugin

Dark Crunchyroll Plugin
GNU Lesser General Public License v3.0
11 stars 4 forks source link

Plugin doesn't work when opening in new tab #7

Closed MarcelRichter-GitHub closed 5 years ago

MarcelRichter-GitHub commented 5 years ago

I don't really know whether that's a bug or just a limitation for the plugin but when opening anything in a new tab it generally doesn't apply the theme. Except if I switch to the new tab fast enough to still open it while it's loading.

tholinka commented 5 years ago

Which browser are you using?

I personally haven't seen this on Firefox or Chrome, and it sounds like it'll be a pain to debug, but I'll look into it when I have some time.

MarcelRichter-GitHub commented 5 years ago

Thanks for looking into this problem. It happens in the most recent Firefox 64-bit in both Windows 10 and Ubuntu 18.10. Steps to reproduce (working for me every time):

  1. Enable dark mode
  2. Open Crunchyroll
  3. Right click on any link within crunchyroll and select open within new tab
  4. Wait until the tab has loaded the page
  5. Switch to the just opened tab, dark mode isn't applied at all
tholinka commented 5 years ago

Huh, interesting.

I can get it to happen on Firefox, but like you said, you need to wait until the page is loaded before switching, otherwise sometimes (but not always) the theme applies. I can't get it to happen at all on Chrome.

Did you ever see this happen on Firefox before recently? I don't think I ever have before, but I also don't use Firefox everyday currently.

I'm going to guess v2.0 will fix this if I ever get around to finishing it, as it applies the theme differently.

I'll look into this some more soon, have some big projects due this week.

tholinka commented 5 years ago

Okay, so v2 fixes this, but it has another issue. The addon always has a white flash before applying the theme, because browsers load the page before the addon, and there is no way to fix this. However, v2 takes a noticeably longer amount of time to apply than v1 does. I was going to look into this some more before releasing v2. However, it does fix this issue. I'll look into it a bit today, and then release if I don't see an easy solution.

tholinka commented 5 years ago

Okay, rewrote how the theme gets applied, it's much faster now.

This should be fixed, as soon as v2 is approved by Firefox, but let me know if it's not.