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.
Topic on Extension talk:Gadgets
For anons: make them standard JS and check for javascript globals in the DOM (above body).
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.
He wants it active for anons and inactive for loggedin users = no gadget.
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');
}
});
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.
Someone with proper insight should properly document the [hidden] parameter.
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');
}
});