User:Callofduty4/FileTemplateAdder.js

function FileTemplateAdder { var options = { '': '.JPG', '': 'Needs trans', '': 'Poor quality' };	var optstr = ''; for(i in options) { optstr += '' + options[i] + ' '; }	var html = '' + optstr + ' Add template'; $('#filetoc').append(html); $('#aSubmit').click( function(event) {		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, prependtext: $("#FileTemplateAdder").val + "\n"}, function (result) { }); });	}); } if (wgCanonicalNamespace == 'File') { addOnloadHook(FileTemplateAdder); }