User:Zombot Aerostatic Gondola/basic.js

/* * http://dev.wikia.com/wiki/AVB * @author: BlackZetsu */ function undo(revid, page, summary) { $.post(mw.util.wikiScript("api"), {       action: "edit",        title: page,        summary: summary,        token: mw.user.tokens.get("editToken"),        undo: revid,        format: "json",    }); } function talk(message, sectiontitle, user) { $.post(mw.util.wikiScript('api'), {       format: 'json',        action: 'edit',        summary: 'Adding message anti-vandalism.',        title: 'User_talk:' + user,        section: 'new',        sectiontitle: sectiontitle,        text: message,        token: mw.user.tokens.get("editToken"),    }); } $(document).ready(function {   $.get(mw.util.wikiScript("api"), { action: "query", list: "recentchanges", rclimit: 1, rcdir: "older", rctype: "edit", rcprop: "ids|user|title|comment", format: "json" }, function(re) { username = re.query.recentchanges[0].user, page = re.query.recentchanges[0].title, summary = re.query.recentchanges[0].comment, revid = re.query.recentchanges[0].revid, wikiname = mw.config.get("wgSiteName"), messageundo = "Undoing revision by " + username + " for suspect of vandalism.", message = "Hello " + username + "! Please do not remove content from pages or add bad words in the articles on " + this.wikiname + ". Thank you!" if (summary == 'Removing all content from page') { undo(revid, page, messageundo) talk(message, 'Vandalism', username) }       $.get(mw.util.wikiScript('api'), {            action: 'query',            titles: page,            prop: 'info|revisions',            intoken: 'edit',            rvprop: 'content',            rvlimit: '1',            indexpageids: 'true',            format: 'json'        }, function(re) {            pages = re.query.pages[re.query.pageids[0]],            content = pages.revisions[0]['*'];            if (content.length < 200) {                undo(revid, page, messageundo)                talk(message, 'Vandalism', username)            }         }); }); }); //