Jump to content

User talk:SD0001/Making user scripts load faster

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Qwerfjkl (talk | contribs) at 20:05, 13 June 2021 (Conflict with scriptManager). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Further issue with spihelper

This script seemingly does not work with spihelper again. It worked for a bit, but now does not work again. The error from the console is "Uncaught (in promise) ReferenceError: displayMessage is not defined". This seemingly seems to be the script not working well with importing scripts from cached scripts. The displayMessage function is in a imported javascript file in spihelper. When adding "?nocache=yes" to the URL it does not cause the error. I also manually called "displayMessage" with and without the cache and confirmed that with cache the javascript console does not have the function defined. However, the network tab shows that regardless of cache being enabled or not enabled the displayMessage javascript file is still downloaded or has loaded the cached result (and using the api method if caching is enabled). I'm using Firefox. Dreamy Jazz talk to me | my contributions 22:07, 3 June 2021 (UTC)[reply]

@Dreamy Jazz Thanks for the note. Just seeing this now. Should be fixed. I replaced use of eval with inserting a <script> tag, which seems to make the behaviour more like the uncached method.
Going by the book, if User:Timotheus Canens/displaymessage.js wants displayMessage to be globally exposed, it should really be doing window.displayMessage = function() {...}. I'm surprised that it even works. – SD0001 (talk) 16:55, 13 June 2021 (UTC)[reply]

Conflict with scriptManager

@SD0001: I think this has a conflict with scriptManager, meaning it ignores scriptManager-installed scripts. Also, the text to be copied and pasted could be replaced with {{subst:User:SD0001/userscript-load-caching.min.js}} and {{subst:User:SD0001/userscript-load-caching.js}}, respectively. ― Qwerfjkl | 𝕋𝔸𝕃𝕂  (please use {{reply to|Qwerfjkl}} on reply)Template:Z181 13:56, 13 June 2021 (UTC)[reply]