lethak / LTKDIFMU-userscript

No more Audio and Visual ads. Allows AFK, Allows AdBlock, on all radios from AudioAddict including www.di.fm and more.
111 stars 8 forks source link

Script issues/breakage [Firefox only][Violentmonkey latest update v2.12.8][incl. workaround] #48

Closed bunkhub closed 3 years ago

bunkhub commented 3 years ago

What is the problem?

Just noticed with the latest update (v2.12.8) for ViolentMonkey in Firefox, that the LTKDIFMU-userscript is not functioning correctly (with default settings). There are no issues in Chromium based browsers as far as I can tell. I verified this on multiple versions of Windows using the latest Firefox ESR channel.

Note: Suggested workaround included at the end of this post. I felt it should be appropriate to note the issue here, for anyone else that might be experiencing the same issue.

At first I was under the presumption that maybe the issue was due to ViolentMonkey, and I opened an issue with the associated developer/github page here. However, @tophf suggested that ViolentMonkey is working appropriately, and instead suggested some further explanations which might give some insight towards LTKDIFMU-userscript compatibility: response 1, response 2

How to reproduce it?

  1. Install Firefox ESR http://www.mozilla.org/en-US/firefox/organizations/all.html
  2. Install or update ViolentMonkey to v2.12.8 (in Firefox), grant the extension whatever permissions it needs
  3. Install LTKDIFMU-userscript
  4. Navigate the internet, with Firefox, to any of the destination sites supported from the LTKDIFMU userscript (all are affected).

What is the expected result?

When the script has been initialized, any trial banners are removed from the page, new buttons/functions are added on the control bar at the bottom of the page, and it prompts with a short notification (in page) that says "DIUserscript: Enjoy free uninterrupted music and enhanced features"

What is the actual result?

The script basically does not load nor function. No functions of the script appear to be injected. The 'Start Free Premium Trial' banner remains in the header, none of the buttons/functions the script adds are loaded, and there is no notification from the script that it has even initialized.

As noted above, everything appears to be functioning correctly in Chromium based browsers (with the latest version of ViolentMonkey using default settings), AND when downgrading to the previous v2.12.7 release (in Firefox only) everything appears to be functioning correctly as well.

Workaround

Following suggestion from @tophf, per response 2 manually changing the 'run-at' settings for the userscript in ViolentMonkey to 'document-end' appears to resolve the issue for the time being.

Edit note: originally stated that manually setting the 'document-start' variable, OR 'document-end' both worked - this is incorrect, as I lost track of which version of the extension I was working with across different browser installations (my mistake). ONLY 'document-end' works with v2.18.8. So I edited this post to reflect that change. However, I have not tested all features - it appears to mostly be working correctly albeit a minor GUI issue with the volume slider. I might try the latest beta of ViolentMonkey soon for the run at 'document-body' variable (also suggested by @tophf)

Environment

lethak commented 3 years ago

Hi, thanks for pointing this out. Will take a look at it before next release. No date tho

The only thing I am sure at the moment is that some features won't work as intended if the userscript's code is not injected before anything else.

lethak commented 3 years ago

The only feature I found not working when starting as "document-end" with VM/FF

Workaround

I am going to say the only 100% working workaround now is to use Tempermonkey and not Violentmonkey until this is fixed.

Also Tempermonkey has to be setup with "Inject Mode: Default"

lethak commented 3 years ago

Investigation

It appears @tophf was right and the way I instantiated some Vue components had Webpack inject styles and code into the DOM prior to the DOM existing at all.

A fix is ready and will be in the next release. Tested with Chrome, FF, VM, and TM with and without 'Instant' mode.

Therefore, 'document-start' should be used again after that !

lethak commented 3 years ago

Released version v2021.4.43 fixed this. Therefore, 'document-start' should be used again.