User:Void/common.js: Difference between revisions
Content deleted Content added
and comment that right back out because I don't want to test this on my main account |
add testing script for later |
||
Line 4: | Line 4: | ||
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js'); |
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js'); |
||
//mw.loader.load('//publictestwiki.com/w/index.php?title=User:Void/testing.js&action=raw&ctype=text/javascript'); |
//mw.loader.load('//publictestwiki.com/w/index.php?title=User:Void/testing.js&action=raw&ctype=text/javascript'); |
||
//Testing js to automate finding inactive sysops |
|||
/* var testlink = mw.util.addPortletLink( |
|||
'p-personal', |
|||
'#', |
|||
'Test Script', |
|||
'pt-testscript', |
|||
'Test this piece of JS', |
|||
null, |
|||
'#pt-adminlinks' |
|||
); |
|||
$( testlink ).click( function () { |
|||
var doThis = confirm('Do you want to run the script?'); |
|||
if( doThis ){ |
|||
$.getJSON( |
|||
//Get userlist |
|||
mw.util.wikiScript('api'), |
|||
{ |
|||
format: 'json', |
|||
action: 'query', |
|||
list: 'allusers', |
|||
augroup: 'sysop', |
|||
aulimit: 50, //Set limit to 50 as there are no more than 50 sysops |
|||
titles: "Wikipedia:Edit filter/False positives/Reports" |
|||
} |
|||
).done( function ( data ) { |
|||
try { |
|||
var users = data.query.allusers; |
|||
var userlist = []; |
|||
users.forEach(function(object){ |
|||
userlist.push(object.name); |
|||
}); |
|||
console.log(userlist); |
|||
} |
|||
catch ( e ) { |
|||
console.log( "Content request error: " + e.message ); |
|||
console.log( "Content request response: " + JSON.stringify( data ) ); |
|||
} |
|||
} ).fail( function () { |
|||
console.log( "While getting the wikitext, there was an AJAX error." ); |
|||
} ); |
|||
} |
|||
} ); |
|||
*/ |