MediaWiki:Gadget-Quicklicence.js

// // BEGIN MW GADGET /* * QLicense.js, [originally] by User:Cakemix, decoded and formatted. * Decoded, formatted, and shortened by Monchoman45. * (Then fixed by Sactage because Monch's API query broke) */

function QLicenseUI { var options = { '': 'Public domain', '': 'Game Screenshot', '': 'Fair use' };	var optstr = ''; for(i in options) { optstr += '' + options[i] + ' '; }

var html = '' + optstr + ' Add license'; if($('#LicensedFile').length || $('#Copyright').length) { html += ' This file is licensed. ';	} else { html += ' This file is not licensed. ';	}	$('#filetoc').append(html); $('#aSubmit').click( function(event) {		this.innerHTML = '';		$.post("/api.php", {action: "edit", title: wgPageName, token: mw.user.tokens.values.editToken, appendtext: $("#QLicenseSelect").val, summary: "Licensing image."}, function (result) { window.location = wgServer + '/index.php?title=' + wgPageName + '&action=purge'; });	}); }

if (wgCanonicalNamespace == 'File') { addOnloadHook(QLicenseUI); } // END MW GADGET //