You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Script works fine on Greasemonkey or Tampermonkey, but it's not working (only sometimes starts, but mostly not loading) on Violentmonkey.
I think problem is wrong execution order.
Here you can find some informations about that: violentmonkey/violentmonkey#1157
For me setting "Run-At" with document-end fixes black theme, but not everything. It should be fixed inside script code.
@run-at parameter is set to document-start intentionally, please see this commit: cd1f0e8
The problem was that without such a configuration there was a white background flash before the site was loaded, so the "run-at document-end" is not a solution here.
The link provided states that document.documentElement is guaranteed to be present in "run-at document-start" configuration, and this is exactly how Tweaker inserts its own style:
Unfortunately I have never used Violentmonkey and I'm testing script mainly in Tampermonkey, so probably the easiest solution would be switching to Tampermonkey/Greasemonkey until Violentmonkey will fix this issue.
Yeah, didn't looked at whole code, it was just a dirty fix. As you can read on issue I've mentioned, Violentmonkey has "fixed" an issue with timings, so Tampermonkey/Greasemonkey should be fixed, because they are working wrong from the standards perspective 😄
I don't think this is related to timings in Tampermonkey (or Greasemonkey). The problem is that when injecting CSS via JavaScript in a userscript after the document is loaded, there is a small amount of time when the original CSS is applied. So to avoid such an issue the proper CSS would have to be loaded before the original one via document.documentElement and the "run-at document-start" configuration.
FYI setting manually run-at document-body in Violentmonkey (v2.12.14) works fine now with this script (no issues with reloading page multiple times, no issues with dark mode).
Activity
bearbyt3z commentedon Apr 23, 2021
@run-at parameter is set to document-start intentionally, please see this commit: cd1f0e8
The problem was that without such a configuration there was a white background flash before the site was loaded, so the "run-at document-end" is not a solution here.
The link provided states that document.documentElement is guaranteed to be present in "run-at document-start" configuration, and this is exactly how Tweaker inserts its own style:
Unfortunately I have never used Violentmonkey and I'm testing script mainly in Tampermonkey, so probably the easiest solution would be switching to Tampermonkey/Greasemonkey until Violentmonkey will fix this issue.
Leny1337 commentedon Apr 23, 2021
Yeah, didn't looked at whole code, it was just a dirty fix. As you can read on issue I've mentioned, Violentmonkey has "fixed" an issue with timings, so Tampermonkey/Greasemonkey should be fixed, because they are working wrong from the standards perspective 😄
bearbyt3z commentedon Apr 23, 2021
I don't think this is related to timings in Tampermonkey (or Greasemonkey). The problem is that when injecting CSS via JavaScript in a userscript after the document is loaded, there is a small amount of time when the original CSS is applied. So to avoid such an issue the proper CSS would have to be loaded before the original one via
document.documentElementand the "run-at document-start" configuration.Leny1337 commentedon Apr 28, 2021
Ok, got it. Thanks for the explanation.
FYI setting manually
run-at document-bodyin Violentmonkey (v2.12.14) works fine now with this script (no issues with reloading page multiple times, no issues with dark mode).I'm closing this issue for now.
bearbyt3z commentedon Apr 28, 2021
@Leny1996 Thanks for reporting the solution. I will add a comment to the README file.
Added reported solution to Violentmonkey issue (#1)