User:Kerri Amber/wikia.js

/* * QLicense by User:Cakemix, decoded and formatted. */ var QLicensebuttonFirst = false; //Adds the button before the selector var QLicenseDebug = false; //Debug to console [You need firebug if firefox, else just press ctrl + shift + J at chrome] var QLicenseUseOutGoingLayout = false; //adds the thing outside of the layout [Oasis pl0x] $(document).ready(function {	if(wgCanonicalNamespace == 'File') {		if(typeof (window.teabag) != 'undefined') {			$('#filetoc').append('The new QLicense is here, uninstall this and install the new at Cakemix/Install');			return;		}		var V =  + wgUserName + ;		var FileName = wgPageName;		var U = V;		function callAPI(data, method, callback) {			data.format = 'json';			$.ajax({ data: data, dataType: 'json', url: wgScriptPath + '/api.php', type: method, success: function(response) { if(response.error) { alert('API error: ' + response.error.info); }					else { callback(response); }				},				error: function(xhr, error) { alert('AJAX error: ' + error); },				timeout: 10000 });		};		var SelectOption = [];		var SelectOptions = ;		SelectOption[] = 'Public domain';		SelectOption[] = 'Game Screenshot';		SelectOption[] = 'Fair use';		for(i in SelectOption) {			SelectOptions += '' + SelectOption[i] + ' ';		}		var licensedImage = 'Loading...';		var selects = '' + SelectOptions + ' ';		var buttons = ' Add license ';		if(QLicensebuttonFirst){			var buttonAndStuff = buttons + selects;		}		else {			var buttonAndStuff = selects + buttons;		}		if($('#LicensedFile').length != 0 || $('#Copyright').length != 0) {			licensedImage = ' This file is licensed. ';		}		else {			licensedImage = ' This file is not licensed. '; }		if(QLicenseUseOutGoingLayout) { $('footer#WikiaFooter.WikiaFooter').before(' ' + buttonAndStuff + licensedImage + '   '); }		else { $('#filetoc').append(buttonAndStuff + licensedImage); }		$('#aSubmit').click(function {			if(QLicenseDebug) {				console.log('Submit clicked on page: ' + FileName);				console.log($('QLicenseSelect').val + ':' + $('#QLicenseSelect :selected').text + ' is selected');			}			var ts = Math.round((new Date).getTime / 1000);			callAPI({ action: 'query', prop: 'info|revisions', intoken: 'edit', titles: FileName, rvprop: 'content', rvlimit: 1 }, 'GET', function(response) { console.log('It took '+(Math.round(( new Date).getTime / 1000) -ts) + ' second(s) to get the data'); var pages = response.query.pages; var page = null; for(var i in pages) { page = pages[i]; }				var pageText = page.revisions[0]['*']; console.log(pageText); pageText += '\n' + $('#QLicenseSelect').val; ts = Math.round(( new Date).getTime / 1000); callAPI({					minor: 'yes',