User:Blue/scripts/alertmods.js

//

function gettoken_api { var api = sajax_init_object; api.open('GET', wgServer + wgScriptPath + '/api.php?format=json&action=query&prop=info&indexpageids=1&intoken=edit&titles=Whatever', false); api.send(null); if (api.readyState == 4 && api.status == 200) { var response = eval('(' + api.responseText + ')'); var token = response['query']['pages'][response['query']['pageids'][0]]['edittoken']; }	return token; }

function createModBox { var container = document.getElementById("alertmods"); if ( container ) { container.innerHTML = "Send a message to all moderators:  Send "; } }

function sendMessage { var contents = document.getElementById("tb").value; var req = sajax_init_object; req.open("GET", wgServer + wgScriptPath + "/api.php?format=json&action=query&list=allusers&augroup=moderator", false); req.send(null); if (req.readyState == 4 && req.status == 200) { var response = eval('(' + req.responseText + ')'); //var token = response['query']['pages'][response['query']['pageids'][0]]['edittoken']; var usersResponse = response['query']['allusers'][0]; alert(usersResponse); } }

addOnloadHook(createModBox);

//