Talk:OOUI/Using OOUI in MediaWiki

Jump to navigation Jump to search

About this board

Incnis Mrsi (talkcontribs)

I see an anomaly using examples of scripts from OOUI/Widgets/Buttons_and_Switches and others on this site – not all Wikimedia wikis appear to export the “OO.ui” thing to me. On some pages var btn = new OO.ui.ButtonWidget( { ⋯ } ); (in Scratchpad) runs fine, whereas others (including those from produce /* Exception: TypeError: OO.ui is undefined @Scratchpad/1:10:5 */

What is the difference?

Jdforrester (WMF) (talkcontribs)
Incnis Mrsi (talkcontribs)

Clear as for “the page happens to already be using OOUI”, but for “should run”… hey, am I looking like a person who can run anything on a production Wikimedia server? Let alone inside any of MediaWiki installations there. Scratchpad is a client-side tool for JavaScript, not a thing that generates HTML pages.

Jdforrester (WMF) (talkcontribs)

Oh, if you're writing a user script or gadget, you should read the gadget-specific instructions.

You'll want to wrap your code in:

mw.loader.using( 'oojs-ui-core' ).done( function () {
    // …
Reply to "OO.ui"
There are no older topics