User:Shining-Armor/Unsigned.js

function addTemplates { var reason = "Marking Unsigned"; var PageName = wgPageName; $.getJSON("/api.php", {action: "query", prop: "info", titles: wgPageName, format: "json", indexpageids: 1}, function(json) {	var pageid = json.query.pageids[0];	$.getJSON("/api.php", {action: "query", prop: "revisions", titles: PageName, rvprop: "user", format: "json", indexpageids: 1}, function(json) { var user = json.query.pages[pageid].revisions[0].user; var addtexttalk = ''; var namespace = mw.config.get('wgNamespaceNumber'); if (-1 < [1,3,5,7,9,11,13,15,110].indexOf(namespace)) { $.post("/api.php", {action: "edit", title: wgPageName, token: mw.user.tokens.values.editToken, appendtext: addtexttalk, summary: reason}); }	 });    }); } $('#WikiHeader').append('Unsigned')