Extension talk:Gadgets

Jump to: navigation, search

About this board

Previous discussion was archived at Extension talk:Gadgets/Archive on 2012-01-06.

Minilexikon (talkcontribs)

Would it be possible to add the possibility to recognize an interwiki link in MediaWiki:Gadgets-definition and load file from there?

Jeblad (talkcontribs)

See ongoing (but stalled) work on Extension:Gadgets/Gadgets 2.0. (phab:T31272)

Reply to "Possibility to load from interwiki"
Summary by Iniquity

Thanks.

Iniquity (talkcontribs)

Hello, I want to use

mw.loader.load('//en.wikipedia.org/w/load.php?modules=ext.gadget.popups&only=scripts');

instead of

mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.js&action=raw&ctype=text/javascript');

But this code doesnt work.

He7d3r (talkcontribs)

According to the code returned by https://en.wikipedia.org/w/load.php?modules=ext.gadget.popups&only=scripts, there is no module named "ext.gadget.popups" on English Wikipedia.

Indeed, on en:MediaWiki:Gadgets-definition this gadget was defined as "Navigation_popups", so this should work:

mw.loader.load('https://en.wikipedia.org/w/load.php?modules=ext.gadget.Navigation_popups&only=scripts');

Reza1615 (talkcontribs)

Is it possible to add option that we can set some of the gadgets only for IP and not confirmed and when they will registered it will dis-activated.

Subfader (talkcontribs)

For anons: make them standard JS and check for javascript globals in the DOM (above body).

קיפודנחש (talkcontribs)

close, but this won't create the desired effect exactly - what the OP asked for would allow for registered users to "opt-in", while your solution does not. however, this is the closest i can think of with a single script.

alternatively, you could play a little variation on the above: call the gadget directly from common.js under the condition "mw.user.anonymous()", and make the gadget non-default.

Subfader (talkcontribs)

He wants it active for anons and inactive for loggedin users = no gadget.

Krinkle (talkcontribs)

I'd recommend do making it as a gadget to allow optimized loading of it as well as internalization. Simply make it a normal gadget that doesn't have [default] but does have [ResourceLoader]. And from MediaWiki:Common.js (as קיפודנחש suggested), call mw.loader.load('gadget.YOUR_GADGET_ID') under a conditional:

mw.loader.using('medawiki.user', function() {
    if (mw.user.anonymous()) {
        mw.loader.load('ext.gadget.YOUR_GADGET_ID');
    }
});
He7d3r (talkcontribs)

For the record: the mw.loader.load can also be in a default gadget hidden from preferences with the "|rights=hidden" hack (example) or with the native "hidden" option from the next version of the gadgets extension.

Edokter (talkcontribs)

Someone with proper insight should properly document the [hidden] parameter.

Saper (talkcontribs)

Be aware of typos, here's a working version of the code above:

mw.loader.using('mediawiki.user').done(function() {
    if (mw.user.isAnon()) {
        mw.loader.load('ext.gadget.allinterwiki');
    }
});
Reply to "New feature"
Wargo (talkcontribs)

What is use of these two gadget namespaces (gadget and gadget_definition)? I found some informations on Gadgets 2.0 but it is not released yet.

He7d3r (talkcontribs)

It is only for Gadgets 2.0. You can subscribe to phab:T31272 and/or its subtasks to get notified of any progress on this.

Reply to "Namespaces"

Renaming a gadget while keeping its activation state for users

1
Od1n (talkcontribs)

Hi, just a feature request. It would be great to be able to rename a gadget (in MediaWiki:Gadgets-definition plus renaming the corresponding MediaWiki:Gadget-Foobar page), while keeping the users' preferences about its activation state.

Reply to "Renaming a gadget while keeping its activation state for users"
Stephan Kulla (talkcontribs)

I deleted a section about adding <nowik> in comments to the gadget code because this seems to be obsolete now. Please revert my edit, when this is still necessary. Thanks!

Reply to "<nowiki> necessary in gadget-code"
RobinHood70 (talkcontribs)

The page implies that it's possible to have one gadget dependent on another, but I can't seem to find a dependency syntax that works. Can someone give an example?

Edokter (talkcontribs)

* gadgetname[ResourceLoader|dependencies=ext.gadget.anothergadgetname]

Note that the ohter gadget must be loaded using ResourceLoader as well, otherwise it is not available as a module.

RobinHood70 (talkcontribs)

Thanks, that worked beautifully! I've added an example to the page to make it easier for future editors.

Reply to "Gadget dependent on gadget"
UksusoFF (talkcontribs)

Hi! How to enable gadgets for MobileFrontend?

Reply to "MobileFrontend"
UltimateSupreme (talkcontribs)

Does [ResourceLoader] parameter not work in MW 1.19.8? Because when I remove that my gadget starts working.

Reply to "[ResourceLoader] param"
Rmaster1200 (talkcontribs)

Someone should make a gallery of gadgets, with a link to download it. Kinda like with extensions.

He7d3r (talkcontribs)

Gadgets 3.0?

Krinkle (talkcontribs)

In addition to future plans for Gadgets 3.0. In the present there is:

Each gadget has a description, links to source code pages, and an Export feature to download it as an XML bundle that can be imported using Special:Import on another wiki.

Reply to "Browsable gallery of known gadgets"