User:Benjaminthewill123123/log.js

var ewGedbFetching = false; var ewItemIds = []; $(function {	var refreshTimer = null;	var rcIds = [];	var loadingHtml = '';	function articleURL(article) {		return mw.config.get('wgArticlePath').replace('$1', encodeURI(article.replace(/ /g, '_')));	}	function scriptURL(article) {		return mw.config.get('wgScript') + '?title=' + encodeURIComponent(article.replace(/ /g, '_'));	}	function callAPI(data, method, callback) {		data['format'] = 'json';		$.ajax({ data: data, dataType: 'json', url: mw.config.get('wgScriptPath') + '/api.php', type: method, success: function(response) { if (response.error) { } else { callback(response); }			},			timeout: 10000 });	}	function reloadComplete {		if ($('#logAutoRefresh:checked').length) {			window.clearTimeout(refreshTimer);			refreshTimer = window.setTimeout(reloadData, 10 *1000);		}		$('#log_update img').hide;		$('#logLastUpdate').text((new Date).toUTCString);	}	function reloadData {		$('#log_update img').show;		var rcQuery = {			'action': 'query',			'list': 'logevents',			'lelimit': '1',			'leprop': 'user|timestamp|title|parsedcomment|type|details',			'letype': 'block|protect|rights|delete|upload|move|newusers',                       'format': 'JSON'		};		callAPI(rcQuery, 'GET', function(response) { var revs = []; var curDate = ''; var rc = response.query.logevents[0]; if(rcIds.length != 0) $('#logHeader').nextAll.remove; rcIds.push(rc.rcid); revs.push(rc.revid); revs.push(rc.old_revid); var next = ""; if (rc.type=="block") next = ' Block duration: ' + rc.block.duration; var prev = '(';           if (rc.type=="delete")                prev += 'Deletion log' + ') '; else if (rc.type=="upload") prev += 'Upload log' + ') ';           else if (rc.type=="move")                prev = ' ' + prev + 'Move log' + ') Moved to: ' + '' + rc.move.new_title + ''; else if (rc.type=="block") prev = ' ' + prev + 'Block log' + ') ';           else if (rc.type=="abusefilter")                prev = ' ' + prev + 'Abuse Filter log' + ') (diff)'; else if (rc.type=="newusers") prev = ' ' + prev + 'User creation log' + ')';           else if (rc.type=="useravatar")                prev = ' ' + prev + 'User avatar log' + ')'; else if (rc.type=="protect") prev = ' ' + prev + 'Protection log' + ') ' + rc[0];           else if (rc.type=="rights")                prev = ' ' + prev + 'User rights log' + ') ' + rc.rights.old + ' to ' + ((rc.rights.new=='')?'(none)':rc.rights.new); if (rc.parsedcomment) { prev += " (";               next = ")" + next; }	var date = rc.timestamp.substring(0, 10); var time = rc.timestamp.substring(11, 19); $('#logHeader').after( '' +	' ' + time + ' ' +	' ' +		'' + rc.title + '</a> ' +	' ' + '<td class="rc_user_' + rc.revid + '">' + '' + rc.user + '</a>' + ' ' + ' <tr class="rc_rev_' + rc.revid + ' rc_page_' + rc.pageid + ' rc_prev">' +	' ' + prev + ' + rc.parsedcomment + ' + next + ' ' +       ' &raquo; ' +		'talk</a> &bull; ' +		'contribs</a>' + ' '			); reloadComplete; });	} // function reloadData   var page_arr = ['User:Suppa_chuppa/Sandbox_4',                    'User:Suppa_chuppa/RecentChangesHybrid',                    'User:Thebrains222/Counter_Vandalism_Feed',                    'User:Suppa_chuppa/RCH_Lite'];    if ($.inArray(mw.config.get('wgPageName'), page_arr) > -1 && (mw.config.get('wgAction') == 'view' || mw.config.get('wgAction') == 'purge'))    {		$('#WikiaRail').remove;		$('body').addClass('oasis-one-column');		appendCSS( '.rc_cur > td, .rc_cur > th { border-top: 2px solid #333 !important; }' + '/*#log_msg { padding: 1em; margin: 1px; border: 1px solid black; }*/' );		$('#log_options').empty.append( ' ' +	' ' +		' Log Watch options ' + '<input type="checkbox" id="logAutoRefresh" checked="checked" /> <label for="logAutoRefresh">Auto-refresh table  ' + '<input type="checkbox" id="logRefresh" checked="unchecked" /> <label for="logRefresh">Click here if table gets stuck ' +	' ' + ' '		);		$('#log_update').html('Last update: ' + loadingHtml);		var $table = $(' ').addClass('wikitable').attr('id', 'ewData').css('width', '100%');		$table.append( '<tr id="logHeader">' + ' Time ' + ' Title ' + ' User ' + ' '		);		$('#log_main').empty.append($table);               $('#logRefresh').click(function { $('#logHeader').nextAll.remove;//.sleep(2500); rcIds = []; reloadData; });		reloadData;	} });