MediaWiki:Quick license.js

/* * originally by User:Cakemix * Decoded, formatted, and shortened by Monchoman45 * fixed by Sactage because Monch's API query broke * migrated to mw 1.33 and fixed by Nerfie and KockaAdmiralac */

if ( mw.config.get("wgCanonicalNamespace") == 'File') { var options = { '': 'Public domain', '': 'Fair use' };	var optstr = ''; for(i in options) { optstr += '' + options[i] + ' '; }	var html = '' + optstr + ' Add license'; if($('#LicensedFile').length) { html += ' This file is licensed. ';	}	else { html += ' This file is not licensed. ';	}	$('#filetoc').append(html); $('#aSubmit').click( function(event) {		this.innerHTML = '';		$.post(mw.util.wikiScript('api'), {action: "edit", title: mw.config.get("wgPageName"), token: mw.user.tokens.get('editToken'), bot: true, appendtext: $("#QLicenseSelect").val, summary: "Licensing image."}, function (result) { window.location = mw.config.get("wgServer") + '/index.php?title=' + mw.config.get("wgPageName"); });	}); }