Topic on Extension talk:GlobalCssJs

Import local script globally

6
Can I Log In (talkcontribs)

I've noticed that you can apparently import a local script and make it global. How do you do that?

Pppery (talkcontribs)

You can pass the raw URL of the script to mw.loader.load in your global JavaScript. For example, I load in m:User:Pppery/global.js using mw.loader.load("https://en.wikipedia.org/w/index.php?action=raw&title=User:Pppery/no-ooui-contribs.js&ctype=text/javascript").

This post was hidden by Pppery (history)
Can I Log In (talkcontribs)

So what I'm seeing here is that you need the "&action=raw" and "&ctype=text/javascript". Is this how it's done?

Pppery (talkcontribs)

Well, that's how I do it at least, and it works for me. If you want a more detailed explanation, you should probably ask at Project:Support desk or w:Wikipedia:Village pump (technical), since this talk page is fairly low traffic and I only noticed your post via recent changes patrol.

Quiddity (talkcontribs)
Reply to "Import local script globally"