Jump to content

Manual talk:Force preview

Add topic
From mediawiki.org
Latest comment: 15 years ago by Michael Daly2 in topic Isn't wgUserGroups an array?

How do you implement this?

The easiest way I can see is to copy the code for the appropriate option into MediaWiki:Common.js on your wiki. Each option may require tweaking to meet your specific desires. — Tuvok[Talk/Contribs] 06:33, 19 October 2007 (UTC)Reply

Did I forget something?

[edit]

I'm working with mediawiki 1.10 as said above i edited the common.js, but nothing is happening! did i forget to edit something somewhere else!?

thx for help and ideas Moonlight 08:11, 25 October 2007 (UTC)Reply

Firefox support

[edit]

Media:Example.ogg

The script only works in IE, any fix to support firefox?

Works fine with with MediaWiki 1.11

[edit]

I copied the top block of code into MediaWiki:Common.js and report that the function works exactly as hoped for. Thanks for posting this.

Works for me too, even on firefox - Markus
Curiously, not working for me in vo.wikibooks but working on vo.wikipedia. Malafaya 17:54, 13 April 2008 (UTC)Reply

Hello. I copied this code to MediaWiki 1.12, but it does not works. I look at source of page and there is no link to commons.js. Must I set it somewhere else? --Lukas

Please see the $wgUseSiteJs config variable to enable sitewide javascript. --Skizzerz talk - contribs 00:14, 19 April 2008 (UTC)Reply

Tried, but not working. Isn't there any problem with non-English site? I am using Czech localisation. --Lukas

Isn't wgUserGroups an array?

[edit]

Is wgUserGroups an array or not?

If so, the code should be something like:

if (isArray(wgUserGroups)) {
    if (wgUserGroups.Contains('bureaucrat')) {
    ...
    }
}

or does JS do something funny with:

if (wgUserGroups == 'bureaucrat') {...}

so that the array characteristics are irrelevant? --Michael Daly2 17:47, 14 April 2009 (UTC)Reply

To answer my own question, that code will not work with 1.14. I have added a new version for MW1.14 or newer that will handle the array correctly. I don't know if older versions of MW used an array for wgUserGroups, so the other code for older version may or may not work. YMMV

--Michael Daly2 21:38, 17 April 2009 (UTC)Reply