User:AuroratheCat/Controller.js

function ApiQuery(parameters) { httpget = null; httpget = new XMLHttpRequest; httpget.open("GET", wgServer+"/api.php?action=query&" + parameters + "&format=json", false); httpget.send( null ); httpresult = $.parseJSON(httpget.responseText); return httpresult }

function ApiEdit(action, targetpage, reason) { var xhr = new XMLHttpRequest; token = mw.user.tokens.get("editToken"); url = wgServer + "/api.php?action=" + action + "&title=" + encodeURIComponent(targetpage) + "&reason=" + encodeURIComponent(reason) + "&format=json&token=" + encodeURIComponent(token); xhr.open("POST", url); xhr.send; }

function ApiLog(message,color) { $("#log",controller.document).append(""+message+" "); //Post message to log div $("#log",controller.document)[0].scrollTop = $("#log",controller.document)[0].scrollHeight; //Scroll to bottom of div }

importScriptPage("User:"+wgUserName+"/Functions.js");