MediaWiki:Gadget-FileTemplateAdder.js

// // BEGIN MW GADGET // ********* // File Template Adder // Easy way to add file maintenance template // Written by Callofduty4 // *********

function FileTemplateAdder { var tempOptions = { '': '.JPG', '': 'Needs trans', '': 'Poor quality' };	var tempOptStr = ''; for(i in tempOptions) { tempOptStr += '' + tempOptions[i] + ' '; } 	var html = '' + tempOptStr + ' 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 pageIdentification = json.query.pageids[0]; var pageToken = json.query.pages[pageIdentification].edittoken; $.post("/api.php", {action: "edit", title: wgPageName, token: pageToken, prependtext: $('#FileTemplateAdder').val + "\n"}, function (result) {$(".TemplateAdder").remove;}); });	} } // END MW GADGET //