User:Martin Urbanec/enableipinfo-global.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
function processArray(items, process) {
var todo = items.concat();
setTimeout(function() {
process(todo.shift());
if(todo.length > 0) {
setTimeout(arguments.callee, 25);
}
}, 25);
}
new mw.Api().get({
"action": "sitematrix",
"format": "json",
"smtype": "language",
"smstate": "all",
"smlangprop": "code|name|site|dir|localname",
"smsiteprop": "url|dbname|code|sitename"
}).then( function ( data ) {
processArray(Object.keys( data.sitematrix ), function ( key ) {
if ( key !== "count" ) {
data.sitematrix[key].site.forEach( function ( site ) {
if ( site.closed === undefined ) {
console.log( 'Processing ' + site.url );
new mw.ForeignApi(site.url + mw.util.wikiScript( 'api' )).saveOptions( {
'ipinfo-beta-feature-enable': 1,
'ipinfo-enable': 1,
'ipinfo-use-agreement': 1
} );
}
} );
}
});
} );