User:K6ka/javascript/licenseadder.js

/* SCRIPT ORIGINALLY CREATED BY User:Lost Labyrinth for The Sims Wiki w:c:sims */ /* w:c:sims:User:Lost_Labyrinth/general/quicklicenseoasis.js */ /* Quick image license - contains the most commonly used licensing criteria - fixed for Oasis */ function QLicenseUI { var options = { : ,		'\n== Licensing ==\n': 'CC-BY-SA', '\n== Licensing ==\n': 'CC-BY-SA 3.0', '\n== Licensing ==\n': 'Fair Use', '\n== Licensing ==\n': 'From Wikimedia', '\n== Licensing ==\n': 'Other free', '\n== Licensing ==\n': 'Public Domain', '\n== Licensing ==\n': 'Copyrighted — used with permission', '\n== Licensing ==\n': 'Self', };	var optstr = ''; for ( i in options ) { if ( options.hasOwnProperty( i ) ) { optstr += '' + options[i] + ' '; }	}	var html = '' + optstr + ' Add license'; if($('#LicensedFile').length || $('#Licensing').length) { html += ' '; } else { html += ' '; }	$('#WikiaPageHeader').append(html); $('#aSubmit').click( function(event) {		this.innerHTML = '';		$.post("/api.php", {action: "edit", title: mw.config.get("wgPageName"), token: mw.user.tokens.values.editToken, bot: true, appendtext: $("#QLicenseSelect").val, summary: "Adding file license."}, function (result) { window.location = wgServer + '/index.php?title=' + mw.config.get("wgPageName") + '&action=purge'; });	}); } if (wgCanonicalNamespace == 'File') { addOnloadHook(QLicenseUI); }