User:Kerri Amber/qlic.js

/* * QLicense.js, [originally] by User:Cakemix, decoded and formatted. * Decoded, formatted, and shortened by Monchoman45. */ function QLicenseUI { var options = { '': 'Category:Images', '': 'Episode Screenshot', '': 'Category:Fanmade images' };	var optstr = ''; for(i in options) {optstr += '' + options[i] + ' ';} var html = '' + optstr + ' Add license'; if(document.getElementById('LicensedFile') || document.getElementById('Copyright')) {html += ' This file is licensed. ';}	else {html += ' This file is not licensed. ';}	$('#filetoc').append(html); document.getElementById('aSubmit').onclick = function(event) { api.send(new api.Query(api, 'POST', 'action=edit&title=' + wgPageName + '&appendtext=' + document.getElementById('QLicenseSelect').value + '&summary=Licensing image', function(result) { if(result.edit.result == 'Success') {window.location = wgServer + '/index.php?title=' + wgPageName + '&action=purge';} else {alert('An error occurred while submitting the edit.');} }));		this.innerHTML = ''; } } if(wgCanonicalNamespace == 'File') { addOnloadHook(QLicenseUI); importScriptPage('MediaWiki:APIQuery.js', 'monchbox'); }