-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FireMonkey] 4chan-x help? #507
Comments
Hi. This is the right place. You can also post to #429
If a userscript is enabled it should run every time you go to the page. Let me ask other users and see if they are having issues with it. |
I see. The script does not run automatically for me (despite it saying "enabled" in Scripts & CSS > [JS] 4chan X). I did not do any configuration other than installing FM and the script. |
Try this.....
Above shows that script is injected. If the userscript does not seem to run. Actually, I found an error .... in Browser Console.I have posted Update API type verification in userscript. |
For the time being, try removing these line from the userscript and see: Test 1:
Test 2:
|
Doing this seems to make the script work. |
Test 3: Change line 5549 (keep metadata block as original) if (typeof GM_setValue !== "undefined" && typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) {
$.setValue = GM_setValue;
$.deleteValue = GM_deleteValue;
} |
This works great and it feels like the userscript runs better than the Test 2 solution. |
Hopefully they will update the script. I remember we had a mod script in YaBB & phpBB long time. I might be able to create a process to make changes to the script but that is fair amount of work and depends on how popular the feature would be. There is also MV3 (manifest v3) coming up which will change the way userscripting work. The code might have to be altered for MV3. |
I apologize for the delayed response. I did the changes you suggested in Test 2. I am not doing Test 3's changes, as I reset FF's data upon restart which would facilitate my settings-being-reset issue. The script now runs automatically and remembers settings through restarts. Thank you so much, you have been more than helpful and incredibly punctual. |
I had to do this to make the script work. If GM_* works just fine, wouldn't prioritising GM_* in 4chan X code make it work? FM disables GM_* when GM.* is supported, so I can't try it out. |
The main issue of the old (pre-Firefox 57) GM3 type API is the sync storage API .e.g. Strangely, the script uses if (typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) {
$.setValue = GM_setValue;
$.deleteValue = GM_deleteValue;
}
GM_* is supported but the support has drawbacks and it is not 100%.
You can test by removing GM.* from the metadata block. |
Actually, I don't think the code should resort to those in the first place. L5433: Also, the FM editor says that the |
Sorry, I don't. It might be something that is defined in the webpage.
My guess is that it is related to the webpage. GM|TM|CM use You can try: window.BroadcastChannel = unsafeWindow.BroadcastChannel; |
I also forgot to mention, the actual code uses
That didn't work. The Mozilla page says that this API is for workers, I don't know what that is. |
TBH, it is way too large to try and debug. The userscript developer is more familiar with the userscript code. |
Thanks, I'll try asking in the 4chan X issue tracker tommorow. |
I figured it out. Although FM disables
What would be the best solution for this? |
The reason is that the main difference is in the storage API and there is no difference between As I mentioned earlier: "Strangely, the script uses
The change of the argument in the conditional makes no difference in execution speed. The result of the conditional however, depends on how the code handles it.
$.syncChannel = new window.BroadcastChannel(g.NAMESPACE + 'sync'); or... $.syncChannel = new unsafeWindow.BroadcastChannel(g.NAMESPACE + 'sync'); |
The code resorts to using Broadcast Channel when I assume this is because GreaseMonkey removed
I know, I meant that the
I don't see any errors about |
It is true that the GM_* storage API is async and slower than the sync GM_* storage API, however the difference should in milliseconds. (async() => {
let t;
const n = 10;
t = performance.now();
for (let i = 0; i < n; i++) {
await browser.storage.local.get('_0 API');
}
console.log(`Operation took ${performance.now() - t} milliseconds`); // 4 millisecond
})(); It uses a loop to get/set values and I don't know how many get/set are done in that loop. Did you try removing the GM_* from the metadata block to force the sync GM_*? |
Yes, the script runs completely fine when I do that. |
Then, I guess that way would be best for the time being. |
Hello, apologies if this is the wrong place to post this.
I'm no expert in programming/userscript writing so a lot of the "Help" page is overly-technical jargon.
I am having trouble getting 4chan X to work with Firefox and the latest version of FireMonkey. My 4chan X settings are not being saved upon reopening 4chan(nel). I saw issue #408 and read through it, but don't see
@grant
or@disable-synchGM
under User Metadata.additionally, how would I get this script to run automatically rather than needing to manually go in and click "run" each time the page loads?
thanks for any help.
The text was updated successfully, but these errors were encountered: