MediaWiki:Gadget-CategoryAdder.js

// // BEGIN MW GADGET // ********* // Easy way to add a single category // Made by Callofduty4 // *********

function CategoryAdderTwo { var cat2html = '' + category + ''; $('#filetoc').append(cat2html); $('#categorySubmitTwo').click(function(event) {		newCat = $("#Category").val;		this.innerHTML = '';		$.getJSON("/api.php", {action: "query", prop: "info", titles: wgPageName, intoken: "edit", format: "json", indexpageids: 1}, function(json) { var pageid = json.query.pageids[0]; var tk = json.query.pages[pageid].edittoken; $.post("/api.php", {action: "edit", title: wgPageName, token: tk, appendtext: "" + "\n"}, function (result) {$(".CategoryAdderTwo").remove;}); });	}); } if (wgCanonicalNamespace == 'File') { addOnloadHook(CategoryAdderTwo); }

// END MW GADGET //