Kamel:Nachteule/RTRC-dev.js

/** * Real-Time Recent Changes * Created on April 25th, 2010 * * version: 0.8.2-dev * url: http://meta.wikimedia.org/wiki/User:Krinkle/Tools/Real-Time_Recent_Changes * * Copyright (c) 2010 Krinkle  * * Real-Time Recent Changes by Krinkle [1] is licensed under * a Creative Commons Attribution-Share Alike 3.0 Unported License [2] * * [1]  * [2]  * * kamelopedierte Fassung (basierend auf v0.8.2-beta) * - * Global variables: wgVars, jQuery */ $ = jQuery; /** * Configuration * - */	var krRTRC_appVersion = "v0.1 berta"; var krRTRC_appDate = "November 10, 2010"; var krRTRC_APIURL = mw.config.get( 'wgServer' )+mw.config.get( 'wgScriptPath' )+"/api.php"; var krRTRC_LoaderSRC = "http://kamelopedia.mormo.org/images/c/ce/Bufferingbuffering.gif"; // 32x32px var krRTRC_BliconSRC = "http://kamelopedia.mormo.org/images/a/ae/18px-Achtung.svg.png"; // 18x15 var krRTRC_HelpURL = "http://kamelopedia.mormo.org/index.php/Kamelopedia:RTRC/Hilfe"; var krRTRC_Debug = 0; // Debug on or off if ( typeof krRTRC_Disabled == 'undefined' || krRTRC_Disabled !== true ) { var krRTRC_Disabled = false; } else { var krRTRC_Disabled = true; }	var krRTRC_MarkPatrolCacheMax = 20;

// Are used later: var krRTRC_Patrolright = false; var krRTRC_Patroltoken = false; var krRTRC_Delhistright = false; var krRTRC_RCDataURL = false; var krRTRC_optLimit = "25"; var krRTRC_optFiltAnon = false; var krRTRC_optFiltPatrol = false; var krRTRC_optUser = ""; var krRTRC_optTypeEdit = true; var krRTRC_optTypeNewpage = true; var krRTRC_optPage = ""; var krRTRC_optRctype = ""; var krRTRC_optFrom = false; var krRTRC_optUntill = false; var krRTRC_optRcshow = ""; var krRTRC_optRcprop = ""; var krRTRC_optRcstart = ""; var krRTRC_optNS = ""; var krRTRC_optOrder = "desc"; var krRTRC_optRcend = ""; var krRTRC_optRInt = 3000; var krRTRC_optIRCBL = false; var krRTRC_RCTimeout = false; var krRTRC_RCEnabled = null; var krRTRC_IntMsgs = {}; var krRTRC_RCLegendHTML = ""; var krRTRC_MassPatrol = false; var krRTRC_AutoDiff = false; var krRTRC_AutoDiffTop = false; var krRTRC_DayHeadPrev = false; var krRTRC_SkipDiffs = []; var krRTRC_MarkPatrolCache = []; var krRTRC_Months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"];

var krRTRC_SkipButon = ""; var krRTRC_FeedMemHTML = ""; var krRTRC_FeedMemUidArr = []; var krRTRC_TimeDiff = 0; // Difference UTC vs. wiki - fetched from siteinfo/timeoffset, in minutes funzt net var krRTRC_WikiID = "unknown"; // wgDBname var krRTRC_Updating = false; // Messages if( typeof window.krMsgs !== 'object' ) { $.getScript('http://kamelopedia.mormo.org/index.php?title=MediaWiki:Skin/Kamelopedia:RTRC&action=raw', function{			krRTRC_Months = krRTRC_Msg('months').split(',');		}); }

/** * Tool Functions * - */	// Logs a message if debugging is enabled function krLog(s,o){ if (krRTRC_Debug===1){ console.log(s); if(o){console.log(o);}} return true; }

if ( typeof String.prototype.ucFirst === 'undefined' ) { String.prototype.ucFirst = function{ return this.substr(0,1).toUpperCase + this.substr(1,this.length); };	}	if ( typeof String.prototype.escapeRE === 'undefined' ) { String.prototype.escapeRE = function { return this.replace(/([\\{}|.?*+^$\[\]])/g, "\\$1"); };	}

// Encode/decode htmlentities function krEncodeEntities(s){ return $(" ").text(s).html; }	function krDencodeEntities(s){ return $(" ").html(s).text; }	// Get interface message function krRTRC_Msg(key){ if(krMsgs[key]){ return krMsgs[key]; } else { return key.ucFirst; }

}

// Returns a GET-parameter as string function krGetUrlParam(s,url){ url = url ? url : document.location.href; // Get last match, stop at hash var re = new RegExp( '[^#]*[&?]' + s.escapeRE + '=([^&#]*)' ); var m = re.exec( url ); if ( m && m.length > 1 ) { return decodeURIComponent( m[1] ); }		return null; }

// Returns all GET-parameters as array function krParseUrlParams(l) { var url = l ? l : document.location.href; var match = url.match(/\?[^#]*/); if (match === null) return null; var query = match[0]; var ret = {}; var pattern = /[&?]([^&=]*)=?([^&]*)/g; match = pattern.exec(query); for (match !== null; match = pattern.exec(query)) { var key = decodeURIComponent(match[1]); var value = decodeURIComponent(match[2]); ret[key] = value; }		return ret; }

// Check if a variable is 'empty' function krEmpty(v){ var key;

if (v === "" || v === 0 || v === "0" || v === null || v === false || typeof v === 'undefined'){ return true; }

if (typeof v == 'object'){ for (key in v){ return false; }			return true; }

return false; }

// Trim whitespace // Thanks to http://blog.stevenlevithan.com/archives/faster-trim-javascript function krTrim(v){ return v.replace(/^\s*((?:[\S\s]*\S)?)\s*$/, '$1'); }

// Prepends a leading zero if value is under 10 function krRTRC_leadZ(i){ if (i<10){ i="0" + i;} return i;	}

// Construct a URL to a page on the wiki function krRTRC_WikiLink(s){ var l = mw.config.get( 'wgServer' ); l += mw.config.get( 'wgArticlePath' ).replace("$1", encodeURIComponent(s).replace(/\%3A/g, ":").replace(/\%2F/g, "/").replace(/\%3F/g, "?")); return l;	}

// Adjust API-timestamp to local timezone time // Convert API-timestamp to Date-readable // Example: "2010-04-25T23:24:02Z" => "2010/04/25 23:24:02" // Convert to UNIX Epoch - amount of ms to adjust function krRTRC_APITimeConv(s){ s = s.toString; // Possible number/integer to string s = s.replace("-","/").replace("-","/").replace("T"," ").replace("Z",""); // Convert to Date-readable return new Date(s); }

// Adjust API-timestamp to local timezone time // Convert API-timestamp to Date-readable // Example: "2010-04-25T23:24:02Z" => "2010/04/25 23:24:02" // Convert to UNIX Epoch - amount of ms to adjust function krRTRC_AdjustAPIClocktime(s){ d = krRTRC_APITimeConv(s); //msd = krRTRC_TimeDiff*60*1000; // Get difference in miliseconds funzt net msd = 120*60*1000; // sollte funzen d.setTime(d.getTime+msd); // Adjust object to difference return krRTRC_leadZ(d.getHours)+':'+krRTRC_leadZ(d.getMinutes); // Return clocktime with leading zeros }

// Adjust long timestamp to local timezone // - Converts from LongTime to Date-readable // - Example: "20100424013000" => "20100424011000" // - Convert to UNIX Epoch - amount of ms to adjust // - Returns new LongTime function krRTRC_AdjustLongTime(s){ s = s.toString; // Possible number/integer to string s = s.substr(0,4)+'/'+s.substr(4,2)+'/'+s.substr(6,2)+' '+s.substr(8,2)+':'+s.substr(10,2)+':'+s.substr(12,2); // Convert to Date-readable d = new Date(s); if(d=='Invalid Date'){ krLog("krRTRC_AdjustLongTime: d-var: Invalid Date"); return false; } msd = krRTRC_TimeDiff*60*1000; // Get difference in miliseconds d.setTime(d.getTime-msd); // Adjust object to difference return d.getFullYear++krRTRC_leadZ(d.getMonth+1)++krRTRC_leadZ(d.getDate)++krRTRC_leadZ(d.getHours)++krRTRC_leadZ(d.getMinutes)+''+krRTRC_leadZ(d.getSeconds); // Return longtime with leading zeros }

// Returns whether the given variable is an integer function krRTRC_isInt(i){ return parseInt(i,10)===i; }

// Searches an array for the giving string function krInArray(s, array){ for (i = 0; i < array.length; i++){ if (array[i] == s){ return true; }		}		return false; }

/** * App Main Functions * - */

function krRTRC_RCDayHead(time) { var current = time.getDate; if(current == krRTRC_DayHeadPrev){ return ''; } else { krRTRC_DayHeadPrev = current; return ' '+time.getDate+' '+krRTRC_Months[time.getMonth]+' '; }	}

function krRTRC_BuildItem(type,title,rcid,revid,old_revid,user,timestamp,comment,patrolled,anon,oldlen,newlen,logtype){

// Get size difference in bytes (can be negative, zero or positive) diffsize = (+newlen) - (+oldlen);

//patrolled-var is empty string if edit is patrolled, else undefined patrolled = patrolled === '' ? true : false;

//anon-var is empty string if edit is by anon, else undefined anon = anon === '' ? true : false;

// typeSymbol, diffLink & itemClass var typeSymbol = " "; var itemClass = ""; var diffLink = krRTRC_IntMsgs.diff; if (type == 'edit'){

if (krRTRC_Patrolright === true && krRTRC_optFiltPatrol == 'on'){ typeSymbol = ' ! ';			} else if (krRTRC_Patrolright === true && patrolled === false){ typeSymbol = ' ! ';			}

itemClass = 'rcitem';

} else if (type == 'new'){

itemClass = 'rcitem';

typeSymbol = ' N ';

} else if (type == 'log'){

itemClass = 'rcitem';

typeSymbol = ' L ';

}

// strip HTML from comment comment = comment.replace(/<&#91;^>&#93;*>/g, "");

// Check if comment is AES if( comment.indexOf("←") === 0 ){ itemClass += ' aes'; comment = comment.replace("←", "← "); }		// Anon-attribute if (anon){ usertypeClass = ' anoncontrib'; } else { usertypeClass = ' usercontrib'; } /*	Example:

(diff) ! 		 00:00 Abc Abc talk / contribs Abc (0) 		// build & return item var item = krRTRC_RCDayHead(krRTRC_APITimeConv(timestamp)); item += '';

if (type == 'edit'){ diffLink = mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + "?diff="+revid+"&oldif="+old_revid+"&rcid="+rcid; diffLink = ''+krRTRC_IntMsgs.diff+''; } else if (type == 'log'){ diffLink = ''+logtype+'</a>'; } else if (type == 'new'){ diffLink = 'Neu</a>'; }		item += ' ('+diffLink+') '+typeSymbol+' '; item += krRTRC_AdjustAPIClocktime(timestamp)+' '+title+'</a> '; item += ' &middot; D</a> &middot; B</a> &middot; '+user+'</a> '; item += ' '+krEncodeEntities(comment)+'  ';

if (diffsize > 0){ el = diffsize > 399 ? "strong" : "span"; item += ' <'+el+' class="mw-plusminus-pos">('+diffsize+')</'+el+'> '; } else if (diffsize === 0){ item += ' (0)  '; } else { el = diffsize < -399 ? "strong" : "span"; item += ' <'+el+' class="mw-plusminus-neg">('+diffsize+')</'+el+'> '; }

item += ' '; return item; }

function krRTRC_GetRCOptions{

krRTRC_optLimit = $("#rc-options-limit").val;

krRTRC_optFiltAnon = $("#rc-options-filter-anons:checked").val; krRTRC_optRcshow = krRTRC_optFiltAnon == 'on' ? "|anon" : "";

krRTRC_optFiltPatrol = $("#rc-options-filter-unpatrolled:checked").val; if (krRTRC_optFiltPatrol == 'on'){ krRTRC_optRcshow += "|!patrolled"; }

if (krRTRC_Patrolright === true){ krRTRC_optRcprop = "|patrolled";}

krRTRC_optUser = $("#rc-options-rcuser").val === '' ? false : krTrim($("#rc-options-rcuser").val); if (!krEmpty(krRTRC_optUser)){ krRTRC_optUser = "&rcuser="+krRTRC_optUser; } else { krRTRC_optUser = ""; } krRTRC_optTypeEdit = $("#rc-options-type-edit:checked").val == 'on' ? true : false; krRTRC_optTypeNewpage = $("#rc-options-type-newpage:checked").val == 'on' ? true : false; krRTRC_optRctype = []; if (krRTRC_optTypeEdit){ krRTRC_optRctype.push('edit'); } if (krRTRC_optTypeNewpage){ krRTRC_optRctype.push('new'); } krRTRC_optRctype = krRTRC_optRctype.join("|"); if (krRTRC_optRctype === ""){ // If all of, enable all $("#rc-options-type-edit").click; $("#rc-options-type-newpage").click; krRTRC_optRctype = 'edit|new'; }		/* RCTITLES DISABLED: krRTRC_optPage = $("#rc-options-rctitle").val === '' ? false : krTrim($("#rc-options-rctitle").val); if (!krEmpty(krRTRC_optPage)){ krRTRC_optPage = "&rctitles="+krRTRC_optPage; } else { krRTRC_optPage = ""; } */

krRTRC_optFrom = krEmpty(krTrim($("#rc-options-timeframe-rcfrom").val)) ? false : krTrim($("#rc-options-timeframe-rcfrom").val); krRTRC_optUntill = krEmpty(krTrim($("#rc-options-timeframe-rcuntill").val)) ? false : krTrim($("#rc-options-timeframe-rcuntill").val);

if (krRTRC_optOrder == 'older'){ if ( krRTRC_isInt(parseInt(krRTRC_optUntill, 10)) && krRTRC_AdjustLongTime(krRTRC_optUntill) ){ krRTRC_optRcstart = "&rcstart="+krRTRC_AdjustLongTime(krRTRC_optUntill); } else { krRTRC_optRcstart = "";} if ( krRTRC_isInt(parseInt(krRTRC_optFrom, 10)) && krRTRC_AdjustLongTime(krRTRC_optFrom) ){ krRTRC_optRcend = "&rcend="+krRTRC_AdjustLongTime(krRTRC_optFrom); } else { krRTRC_optRcend = "";} } else if (krRTRC_optOrder == 'newer'){ if ( krRTRC_isInt(parseInt(krRTRC_optFrom, 10)) && krRTRC_AdjustLongTime(krRTRC_optFrom) ){ krRTRC_optRcstart = "&rcstart="+krRTRC_AdjustLongTime(krRTRC_optFrom); } else { krRTRC_optRcstart = "";} if ( krRTRC_isInt(parseInt(krRTRC_optUntill, 10)) && krRTRC_AdjustLongTime(krRTRC_optUntill)){ krRTRC_optRcend = "&rcend="+krRTRC_AdjustLongTime(krRTRC_optUntill); } else { krRTRC_optRcend = "";} }		krRTRC_optNS = $("#rc-options-namespace").val;

krRTRC_optRcdir = $("input[name='rc-options-rcdir']:checked").val; krRTRC_optOrder = krRTRC_optRcdir == 'asc' ? 'newer' : 'older';

krRTRC_optRInt = parseInt($("#rc-options-interval").val, 10)*1000;

krRTRC_optIRCBL = $("#rc-options-ircbl:checked").val == 'on' ? true : false;

krRTRC_optAutoDiff = $("#rc-options-autodiff").val; krRTRC_AutoDiff = krRTRC_optAutoDiff == 'On' ? true : false; krRTRC_optAutoDiffTop = $("#rc-options-autodiff-top:checked").val; krRTRC_AutoDiffTop = krRTRC_optAutoDiffTop == 'on' ? true : false;

krRTRC_RCDataURL = krRTRC_APIURL+"?action=query&format=xml&list=recentchanges"+krRTRC_optUser+""+krRTRC_optPage+"&rctype="+krRTRC_optRctype+"|log&rcshow=!bot"+krRTRC_optRcshow+"&rcprop=flags|timestamp|user|title|comment|sizes|ids"+krRTRC_optRcprop+"|loginfo&rcnamespace="+krRTRC_optNS+"&rclimit="+krRTRC_optLimit+"&rcdir="+krRTRC_optOrder+krRTRC_optRcstart+krRTRC_optRcend; return krRTRC_RCDataURL; }

function krRTRC_RebindElements { //called when the list is refreshed

// Re-apply "skipped" and "patrolled" classes $("#krRTRC_RCOutput>.feed div.rcitem").each(function{

// Compare each diff-attribute to the array, if match mark item with the class

if(krInArray($(this).attr("rcid"), krRTRC_SkipDiffs)){ $(this).addClass("skipped"); } else if(krInArray($(this).attr("rcid"), krRTRC_MarkPatrolCache)){ $(this).addClass("patrolled"); }		});

// The current diff in diff-view stays marked $("#krRTRC_RCOutput>.feed div[rcid="+window.currentDiffRcid+"]").addClass("indiff");

// All http-links within the diff-view open in a new window $("#krRTRC_DiffFrame>table.diff a[href^=http://]").attr("target", "_blank");

}

function krRTRC_PushFrontend{ $("#krRTRC_RCOutput").removeClass("placeholder"); $("#krRTRC_RCOutput>.feed").html(krRTRC_FeedMemHTML);

krRTRC_RebindElements;// rebind elements krRTRC_DayHeadPrev = "";// reset day krRTRC_RCTimeout = setTimeout(krRTRC_Refresh, krRTRC_optRInt); $("#krRTRC_loader").hide; }

function krRTRC_ApplyIRCBL{ if (krRTRC_Updating === true){ // Only run if there's an update going on		krRTRC_FeedMemUidArr = [];

$(krRTRC_FeedMemHTML).find("div.item").each(function(index, el){			krRTRC_FeedMemUidArr.push($(el).attr("user"));		}); krRTRC_FeedMemUidArr.shift;

try { // Parsing json could cause fatal error if url is not HTTP 200 OK (ie. HTTP 404 Error) $.ajax({			url: "http://toolserver.org/~krinkle/CVN/API/?raw=0&format=json&uid="+krRTRC_FeedMemUidArr.join("|")+"&jsoncallback=?",			timeout: 500,			dataType: 'json',			success: function(data){

// If none of the users appear in the database at all, then data.users is null if(data.users){

// Loop through all users $.each(data.users, function(i, val){ // i=username, val=object

// Only if blacklisted, otherwise dont highlight if(val.usertype == 'bl'){

var tooltip = "";

// Get blacklist reason if(val.reason){ tooltip += krRTRC_Msg('reason')+': '+val.reason+". "; } else { tooltip += krRTRC_Msg('noreasonfound'); }

// Get blacklist adder if(val.adder){ tooltip += krRTRC_Msg('adder')+": "+val.adder; } else { tooltip += krRTRC_Msg('adder')+": "+krRTRC_Msg('unknown'); }

// Apply blacklisted-class, and insert icon with tooltip krRTRC_FeedMemHTML = $(" "+krRTRC_FeedMemHTML+" ").find("div.item[user="+i+"] .user").addClass("blacklisted").prepend('<img src="'+krRTRC_BliconSRC+'" alt="" title="'+tooltip+'" />').attr("title", tooltip).end.html; }

});				}

// Either way, push the feed to the frontend krRTRC_PushFrontend; $("#krRTRC_RCOutput>.feed").append('<small id="krRTRC_Dumpdate">CVN DB '+krRTRC_Msg('lastupdate')+': '+data.dumpdate+' (UTC) '); krRTRC_Updating = false; },			error: function(data, txtstatus, error){ // Ignore errors, just push to frontend krRTRC_PushFrontend; krRTRC_Updating = false; }		});		} catch(e){ // Ignore errors, just push to frontend			krRTRC_PushFrontend;			krRTRC_Updating = false;		}

} }

function krRTRC_Refresh{ if(krRTRC_RCEnabled === true & krRTRC_Updating === false){

// Indicate updating $("#krRTRC_loader").show; krRTRC_Updating = true; // Download recent changes $.ajax({				type: "GET",				url: krRTRC_RCDataURL,				dataType: "xml",				success: function(rawback){					// Last-update heading						// Get current time + localtime adjustment							lastupdate = new Date;							msd = krRTRC_TimeDiff*60*1000;							lastupdate.setTime(lastupdate.getTime+msd);						krRTRC_FeedMemHTML = '<div id="krRTRC_lastupdate">'+krRTRC_Msg('lastupdate')+': '+lastupdate.toUTCString+' | '+krRTRC_Msg('permalinktext')+'</a> ';

// API errors ? if( $(rawback).find('error').length > 0 ){

krLog("krRTRC_GetRCData-> "+$(rawback).find('rc').length+" errors"); $("#krRTRC_RCOutput").removeClass("placeholder");

// Account doesnt have patrol flag if($(rawback).find('error').attr("code") == "rcpermissiondenied"){ krRTRC_FeedMemHTML += ' Downloading recent changes failed Please untick the "Unpatrolled only"-checkbox or request the Patroller-right on '+mw.config.get( 'wgServer' )+'</a>';

// Other error } else {

krRTRC_FeedMemHTML += ' Downloading recent changes failed Please check the settings above and try again. If you believe this is a bug, please  let me know </a>.'; }						krRTRC_PushFrontend; krRTRC_Updating = false; // Everything is OK - with results } else if( $(rawback).find('rc').length > 0 ){

var htmloutput = '<div id="krRTRC_list">'; $(rawback).find('rc').each(function(i){							htmloutput += krRTRC_BuildItem($(this).attr("type"),$(this).attr("title"),$(this).attr("rcid"),$(this).attr("revid"),$(this).attr("old_revid"),$(this).attr("user"),$(this).attr("timestamp"),$(this).attr("comment"),$(this).attr("patrolled"),$(this).attr("anon"),$(this).attr("oldlen"),$(this).attr("newlen"),$(this).attr("logtype"));						}); krRTRC_FeedMemHTML += htmloutput+" "; if(krRTRC_optIRCBL===true){ krRTRC_ApplyIRCBL; //krRTRC_Updating is set to false within krRTRC_ApplyIRCBL } else { krRTRC_PushFrontend; krRTRC_Updating = false; }

// Everything is OK - no results } else { krRTRC_FeedMemHTML += ' '+krRTRC_Msg('nomatches')+' '; krRTRC_PushFrontend; krRTRC_Updating = false; }

$RCOptions_submit.removeAttr("disabled").css("opacity","1.0"); }

});		}	}

function krRTRC_hardRefresh{

krRTRC_RCEnabled = true; $("#krRTRC_toggleRefresh").val("Aus").removeClass("button-on"); var x = krRTRC_GetRCOptions; clearTimeout(krRTRC_RCTimeout); krRTRC_Refresh;

}	// Checks the GET-parameters and manipulates #krRTRC_RCOptions // Also initiates jumpstart function krRTRC_ProcesPermalink(l){ var get = krGetUrlParam('rclimit',l); $("#rc-options-limit option[value="+get+"]").attr("selected", "selected"); get = krGetUrlParam('rcshow_anon',l); if (get=="on"){ $("#rc-options-filter-anons").attr("checked", "checked");} get = krGetUrlParam('rcshow_patrol',l); if (get=="on"){ $("#rc-options-filter-unpatrolled").attr("checked", "checked");} get = krGetUrlParam('rcuser',l); $("#rc-options-rcuser").val(get); get = krGetUrlParam('typeedit',l); if (get=="off"){ $("#rc-options-type-edit").removeAttr("checked");} get = krGetUrlParam('typenewpage',l); if (get=="off"){ $("#rc-options-type-newpage").removeAttr("checked");} /* RCTITLES DISABLED: get = krGetUrlParam('rctitles',l); $("#rc-options-rctitle").val(get); */				get = krGetUrlParam('rcfrom',l); $("#rc-options-timeframe-rcfrom").val(get); get = krGetUrlParam('rcuntill',l); $("#rc-options-timeframe-rcuntill").val(get); get = krGetUrlParam('rcnamespace', l);//krRTRC_optNS $("#rc-options-namespace option[value="+get+"]").attr("selected", "selected"); get = krGetUrlParam('rcdir',l); if (get=="asc"){ $("#krRTRC_RCOptions input[name=rc-options-rcdir][value=asc]").attr("checked", "checked"); $("#krRTRC_RCOptions input[name=rc-options-rcdir][value=desc]").removeAttr("checked"); }				get = krGetUrlParam('ajaxint',l); if (get !== "" && get !== " " && get !== null && get !== false){ $("#rc-options-interval").val(get);} get = krGetUrlParam('ircbl',l); if (get=="on"){ $("#rc-options-ircbl").attr("checked", "checked");} get = krGetUrlParam('autodiff'); if (get=="on"){ $("#rc-options-autodiff").val("An").addClass("button-on");} get = krGetUrlParam('autodiff_top',l); if (get=="on"){ $("#rc-options-autodiff-top").attr("checked", "checked");} get = krGetUrlParam('jumpstart',l); if (get=="on"){ get = krRTRC_GetRCOptions; krRTRC_hardRefresh; /* EXPERIMENTAL: krRTRC_RefreshWhois;*/ window.location.hash = '';window.location.hash = 'toggleHelp'; } }	// Checks the settings and returns a the permalink that would reproduce these settings manipulates #krRTRC_RCOptions function krRTRC_GeneratePermalink{ var a = '&rclimit='+krRTRC_optLimit; a += krRTRC_optFiltAnon == 'on' ? '&rcshow_anon=on' : ''; a += krRTRC_optFiltPatrol == 'on' ? '&rcshow_patrol=on' : ''; a += krRTRC_optUser ? krRTRC_optUser : ''; a += krRTRC_optTypeEdit ? '' : '&typeedit=off'; a += krRTRC_optTypeNewpage ? '' : '&typenewpage=off'; a += krRTRC_optPage ? krRTRC_optPage : ''; a += krRTRC_optFrom === false ? '' : '&rcfrom='+krRTRC_optFrom; a += krRTRC_optUntill === false ? '' : '&rcuntill='+krRTRC_optUntill; a += krRTRC_optNS === "" ? '' : '&rcnamespace='+krRTRC_optNS; a += '&rcdir='; a += krRTRC_optRcdir == 'asc' ? 'asc' : 'desc'; a += Math.round(krRTRC_optRInt/1000) !== 3 ? '&ajaxint='+Math.round(krRTRC_optRInt/1000) : ''; a += krRTRC_optIRCBL ? '&ircbl=on' : ''; a += krRTRC_AutoDiff ? '&autodiff=on' : ''; a += krRTRC_AutoDiffTop ? '&autodiff_top=on' : ''; return mw.config.get( 'wgServer' )+mw.config.get( 'wgScript' )+"?title="+mw.config.get( 'wgPageName' )+a+'&jumpstart=on'; }

function krRTRC_NextDiff { var $lis = $("#krRTRC_RCOutput>.feed div.rcitem:not(.indiff,.patrolled,.skipped)"); if(krRTRC_AutoDiffTop === true) { $lis.eq(0).find("a.rcitemlink").click; } else { // eq(-1) doesn't work somehow.. $lis.eq($lis.length-1).find(" a.rcitemlink").click; }	}	function krRTRC_TipIn($targetEl, uid, is_anon){ krLog("krRTRC_TipIn"); var o = $targetEl.offset; if(is_anon){ links = ' · WHOIS</a>'; } else { links = ''; }		//links += ' · CrossWiki</a>'; if(krRTRC_Delhistright === true){ links += ' · Bestattete Beiträge</a>'; }		$krRTRC_Tiptext.html('[+ filter ]</a>'+links); $krRTRC_Tip.css({"left" : o.left+"px", "top" : (o.top-23)+"px", "display" : "block"/*, "width" : $krRTRC_Tiptext.width+"px"*/}).fadeIn('fast'); window.krRTRC_TipTime = setTimeout(krRTRC_TipOut,9000); }	function krRTRC_TipOut{ if(typeof krRTRC_TipTime !== 'undefined'){ clearTimeout(krRTRC_TipTime); }		$krRTRC_Tip.fadeOut; }	function krRTRC_RefreshWhois{ $.ajax({			type: "GET",			url: "http://secure.grizzdesign.nl/RTRC-whoisonline.php?wiki_user=" + encodeURIComponent(mw.config.get( 'wgUserName' ) + "@" + krRTRC_WikiID) + "&rtrc_hideme=0&rtrc_url=" + encodeURIComponent(window.location.href) + "&debug=0&jsoncallback=?",			timeout: 500,			dataType: 'json',			success: function(data){				krLog("Whosonline data",data);				$("#krwhosonline").html(data);			}		}); }	function krRTRC_ToggleMassPatrol(b){ if(b === true){ krRTRC_MassPatrol = true; $krRTRC_MassPatrol.val("An").addClass("button-on"); $(".patrollink a").click; } else { krRTRC_MassPatrol = false; $krRTRC_MassPatrol.val("Aus").removeClass("button-on"); }	}	function krRTRC_GetPatroltoken{ $.ajax({			type: "GET",			url: krRTRC_APIURL+"?action=query&format=xml&list=recentchanges&rctoken=patrol&rclimit=1&rctype=new", //added rctype=new because several wikis only do newpages, by getting all rcs changes are it'll return an edit and thus error instead of token. Unless there are wikis with RC-patrol but no NP-patrol (as supposed to both or the opposite), this will be just fine. If there are wikis without NP-patrol but with RC-patrol, we'll have to split up somewhere around here.			dataType: "xml",			success: function(rawback){				krRTRC_Patroltoken = $(rawback).find('rc').attr("patroltoken");				if(krRTRC_Patroltoken){					krRTRC_Patroltoken = krRTRC_Patroltoken.replace("+","%2B").replace("\\","%5C");				} else {					krRTRC_Patroltoken = false;				}			}		}); }

// Init Phase 1 : When the DOM is ready function krRTRC_init1{ krLog("Init Phase 1 started"); while (krRTRC_initFuncs.length > 0) { (krRTRC_initFuncs.shift); }		krLog("Init Phase 1 done"); }

// Init Phase 2 : Called in GetIntMsgs function krRTRC_init2{ krLog("Init Phase 2 started"); while (krRTRC_initFuncs2.length > 0) { (krRTRC_initFuncs2.shift); }		krLog("Init Phase 2 done"); }

/** * App Initiate Functions (Phase 1, pre IntMsg) * - */	// CheckRights, GetPatrol, GetSiteinfo, GetIntMsg window.krRTRC_initFuncs = [];

// function CheckRights //	// Checks the userrights of the current user via the API window.krRTRC_initFuncs[0] = function{ $.ajax({			type: "GET",			url: krRTRC_APIURL+"?action=query&meta=userinfo&uiprop=rights&format=xml",			dataType: "xml",			success: function(rawback){				if ($(rawback).find("r:contains('patrol')").length > 0){					$(rawback).find("r:contains('patrol')").each(function{ if ($(this).text == 'patrol' && krRTRC_Patrolright === false){ krRTRC_Patrolright = true; }					});				}				if ($(rawback).find("r:contains('deletedhistory')").length > 0){					$(rawback).find("r:contains('deletedhistory')").each(function{ if ($(this).text == 'deletedhistory' && krRTRC_Delhistright === false){ krRTRC_Delhistright = true; }					});				}			}		});	};

// function GetPatroltoken //	// Requests a patroltoken via the API window.krRTRC_initFuncs[1] = function{ krRTRC_GetPatroltoken; };

// function GetSiteInfo //	// Downloads siteinfo via the API window.krRTRC_initFuncs[2] = function{ $.ajax({			type: "GET",			url: krRTRC_APIURL+"?action=query&meta=siteinfo&format=xml",			dataType: "xml",			success: function(rawback){				krRTRC_TimeDiff = $(rawback).find('general').attr("timeoffset");				krRTRC_WikiID = $(rawback).find('general').attr("wikiid");				document.title = "RTRC: "+krRTRC_WikiID;			}		}); };

// function GetIntMsgs //	// Downloads interface messages via the API window.krRTRC_initFuncs[3] = function{

$.getJSON(krRTRC_APIURL+"?action=query&format=json&meta=allmessages&amlang="+mw.config.get( 'wgUserLanguage' )+"&ammessages=show|hide|ascending abbrev|descending abbrev|markaspatrolleddiff|markedaspatrolled|markedaspatrollederror|next|diff|talkpagelinktext|contributions|recentchanges-label-legend|recentchanges-label-bot|recentchanges-label-minor|recentchanges-label-newpage|recentchanges-label-unpatrolled|recentchanges-legend-bot|recentchanges-legend-minor|recentchanges-legend-newpage|recentchanges-legend-unpatrolled|namespaces|namespacesall|blanknamespace&callback=?", function(data) {			krLog("GetIntMsgs->"+data); krLog(data);			data = data.query.allmessages;			for(i = 0; i < data.length; i++){				krRTRC_IntMsgs[data[i].name] = data[i]['*'];			}

// Interface messages ready, excecute init phase 2 krRTRC_init2; });	};

/** * App Initiate Functions (Phase 2, post IntMsg) * - */	// Buildpage, ProcesPermalink, Bindevent window.krRTRC_initFuncs2 = [];

// function BuildPage //	// Prepares the page window.krRTRC_initFuncs2[0] = function{ $("#p-namespaces>ul>li").removeClass("new").find(">a>span").eq(0).html("Tool"); $("#ca-talk").removeClass("new").find(">a").attr("href", "http://kamelopedia.mormo.org/index.php?title=Kamel_Diskussion:Nachteule&action=edit&section=new&preloadtitle=RTRC-Feedback").attr("target", "_blank").find(">span").html("Feedback"); $("#footer").remove; $("#content").addClass("krRTRC_body"); krRTRC_RCLegendHTML = '<div id="krRTRC_RCLegend">Farben: '+krRTRC_IntMsgs.markedaspatrolled+', '+krRTRC_Msg('currentedit')+' , '+krRTRC_Msg('skippededit')+' , Edit with an Automatic Edit Summary '+krRTRC_Msg('abbreviations')+': D - '+krRTRC_IntMsgs.talkpagelinktext+', B - '+krRTRC_IntMsgs.contributions+' '; krRTRC_RCNamespaceDropdown = '<select id="rc-options-namespace" name="rc-options-namespace">'; krRTRC_RCNamespaceDropdown += ' '+krRTRC_IntMsgs.namespacesall+' '; krRTRC_RCNamespaceDropdown += ' '+krRTRC_IntMsgs.blanknamespace+' '; for(var ns in mw.config.get( 'wgFormattedNamespaces' )){ if(ns > 0){ krRTRC_RCNamespaceDropdown += '<option value="'+ns+'">'+mw.config.get( 'wgFormattedNamespaces' )[ns]+' '; } } krRTRC_RCNamespaceDropdown += ' '; $("#content").html(		' <div id="krRTRC_PageWrap" class="plainlinks">' +			'<div id="krRTRC_Topbar">Letzte Änderungen in luxuriös und Echtzeit ('+krRTRC_appVersion+') <small id="toggleHelp">[Hilfe] ' +			'<div id="krRTRC_RCForm"><fieldset id="krRTRC_RCOptions" class="nohelp"> ' +				' <label for="rc-options-limit" class="head">'+krRTRC_Msg('limit')+' <select id="rc-options-limit" name="rc-options-limit"> 10 <option selected="" value="25">25 50  75  100  ' +				' ' +				' '+krRTRC_Msg('filter')+' <input type="checkbox" value="on" id="rc-options-filter-anons" name="rc-options-filter-anons"><label for="rc-options-filter-anons"> '+krRTRC_Msg('anononly')+' <input type="checkbox" value="on" id="rc-options-filter-unpatrolled" name="rc-options-filter-unpatrolled"><label for="rc-options-filter-unpatrolled"> '+krRTRC_Msg('unpatrolledonly')+'  ' +				' ' +				' <label for="rc-options-rcuser" class="head">'+krRTRC_Msg('userfilter-opt')+' <input type="text" value="" size="16" id="rc-options-rcuser" name="rc-options-rcuser" /> <input class="button" type="button" id="RCOptions_RcuserClr" value="'+krRTRC_Msg('clear')+'" /> ' + ' ' +				' '+krRTRC_Msg('type')+' <input type="checkbox" value="on" id="rc-options-type-edit" name="rc-options-type-edit" checked="checked"><label for="rc-options-type-edit"> '+krRTRC_Msg('edits')+' <input type="checkbox" checked="checked" value="on" id="rc-options-type-newpage" name="rc-options-type-newpage"><label for="rc-options-type-newpage"> '+krRTRC_Msg('newpages')+' ' + ' ' +				// RCTITLES DISABLED: https://bugzilla.wikimedia.org/show_bug.cgi?id=12394#c5 // ' <label class="head" for="rc-options-rctitle">'+krRTRC_Msg('pagefilter-opt')+' <input type="text" value="" size="16" id="rc-options-rctitle" name="rc-options-rctitle" /> <input class="button" type="button" id="RCOptions_RctitleClr" value="'+krRTRC_Msg('clear')+'" /> ' + //' ' +				' '+krRTRC_Msg('timeframe-opt')+' <label for="rc-options-timeframe-rcfrom">'+krRTRC_Msg('from')+': <input type="text" value="" size="14" id="rc-options-timeframe-rcfrom" name="rc-options-timeframe-rcfrom"> <label for="rc-options-timeframe-rcuntill">'+krRTRC_Msg('untill')+': <input type="text" value="" size="14" id="rc-options-timeframe-rcuntill" name="rc-options-timeframe-rcuntill"> ' + ' ' +				' <label for="rc-options-namespace" class="head">'+krRTRC_IntMsgs.namespaces+' '+krRTRC_RCNamespaceDropdown+' ' + ' ' +				' '+krRTRC_Msg('order')+' <input type="radio" name="rc-options-rcdir" value="asc"> '+krRTRC_Msg('asc')+' <input type="radio" name="rc-options-rcdir" value="desc" checked="checked"> '+krRTRC_Msg('desc')+' ' + ' ' +				' <label for="rc-options-interval" class="head">R <span section="Reload_Interval" class="helpicon"> <input type="text" value="3" size="1" id="rc-options-interval" name="rc-options-interval"> ' + ' ' +				' <label class="head" for="rc-options-ircbl">IRCBL <span section="IRC_Blacklist" class="helpicon"> <input type="checkbox" value="on" size id="rc-options-ircbl" name="rc-options-ircbl" /> ' + ' ' +				' <input class="button" type="button" id="RCOptions_submit" value="'+krRTRC_Msg('apply')+'" /> ' + //'<hr style="clear:both" />' + //' <label for="krRTRC_MassPatrol" class="head">MassPatrol <input id="krRTRC_MassPatrol" class="button button-off" type="button" value="Aus" /> ' + //' ' +				//' <label for="rc-options-autodiff" class="head">AutoDiff <input type="button" class="button button-off" value="Aus" id="rc-options-autodiff" /> <input type="checkbox" value="on" id="rc-options-autodiff-top" /> <label for="rc-options-autodiff-top"> '+krRTRC_Msg('loadfromtop')+' ' + //	' ' +			//	' <label for="krRTRC_toggleRefresh" class="head">Pause <input id="krRTRC_toggleRefresh" class="button button-off" type="button" value="Aus" /> ' + ' ' +			'' + '<div id="krRTRC_DiffFrame" style="display:none"> ' + '<div id="krRTRC_RCOutput" class="placeholder">'+krRTRC_RCLegendHTML+' ' + ' ' );//+			//'<div id="krRTRC_Footer"> ' +			//	' '+krRTRC_Msg('documentation')+'</a> ' +			//	'Real-Time Recent Changes by Krinkle</a> is licensed under a <a href="http://creativecommons.org/licenses/by-sa/3.0" class="external text" rel="nofollow">Creative Commons Attribution-Share Alike 3.0 Unported License</a>.' +				//' <a href="http://meta.wikimedia.org/wiki/User:Krinkle/Tools/Real-Time_Recent_Changes#Changelog" id="krwhosonline" class="external text" rel="nofollow">'+krRTRC_Msg('whatsnew')+'</a> ' +			//' '); $("body").append("<div id='krRTRC_Tip'><span id='krRTRC_Tiptext'> ");

$("#content-inner").css("position", "relative"); $("#krRTRC_RCOutput").prepend(' <img src="'+krRTRC_LoaderSRC+'" id="krRTRC_loader" style="display:none" />'); //EXPERIMENTAL //$(' Experimental: <a href="javascript:krRTRC_RefreshWhois">Refresh WhoisOnline</a> | ... ').appendTo("#krRTRC_RCOptions > form"); };

// function ProcesPermalink window.krRTRC_initFuncs2[1] = function{ krRTRC_ProcesPermalink; };

// function Bindevents //	// Binds events to the user interface window.krRTRC_initFuncs2[2] = function{

$RCOptions_submit = $("#RCOptions_submit");

// Apply button $RCOptions_submit.click(function{			$RCOptions_submit.attr("disabled", "disabled").css("opacity","0.5");			a = krRTRC_GetRCOptions;			krRTRC_hardRefresh;			return false;		});

// Close Diff $("#diffClose").live("click", function{			$("#krRTRC_DiffFrame").fadeOut('fast');		});

// Load diffview on (diff)-link click window.currentDiff = "unknown"; window.currentDiffRcid = "unknown"; $("a.diff").live("click", function {			window.currentDiff = $(this).attr("diff");			window.currentDiffRcid = $(this).attr("rcid");			var title = $(this).parent.find(">a.page").text;			var href = $(this).parent.find(">a.diff").attr('href');			$("#krRTRC_DiffFrame").removeAttr('style'/* this resets style="max-height:400" from a.newPage below */).load(mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + '?action=render&diff='+window.currentDiff+'&diffonly=1&uselang='+mw.config.get( 'wgUserLanguage' ), function { $(this).html($(this).html.replace("diffonly=", "krinkle=").replace("diffonly=", "krinkle=")); if (krInArray(window.currentDiffRcid, krRTRC_SkipDiffs)){ krRTRC_SkipButon = ' <a id="diffUnskip">Un-Überspringen</a> '; } else { krRTRC_SkipButon = ' <a id="diffSkip">Überspringen</a> '; }			$("#krRTRC_DiffFrame").fadeIn.prepend(' '+title+' <div id="krRTRC_DiffTools"> <a id="diffClose">X</a> <a href="'+href+'" target="_blank" id="diffNewWindow">In neuem Tab öffnen</a> ' + 			( krRTRC_Patroltoken ? ' <a onclick="(function{ if($(\'.patrollink a\').length){ $(\'.patrollink a\').click; } else { $(\'#diffSkip\').click; } });">[Markieren]</a> ' : '' ) +			' <a id="diffNext">'+krRTRC_IntMsgs.next.ucFirst+' &raquo;</a> '+krRTRC_SkipButon+' '); if(krRTRC_MassPatrol === true){ $(".patrollink a").click; }				$("#krRTRC_RCOutput>.feed div.indiff").removeClass("indiff"); krRTRC_RebindElements; });			return false;		}); $("a.newPage").live("click", function {			window.currentDiffRcid = $(this).attr("rcid");			var title = $(this).parent.find(">a.page").text;			var href = $(this).parent.find(">a.page").attr('href');			$("#krRTRC_DiffFrame").css("max-height", "400px").load(href + '&action=render&uselang='+mw.config.get( 'wgUserLanguage' ), function{ if (krInArray(window.currentDiffRcid, krRTRC_SkipDiffs)){ krRTRC_SkipButon = ' <a id="diffUnskip">Unskip</a> '; } else { krRTRC_SkipButon = ' <a id="diffSkip">Skip</a> '; }				$("#krRTRC_DiffFrame").fadeIn.prepend(' '+title+' <div id="krRTRC_DiffTools"> <a id="diffClose">X</a> <a href="'+href+'" target="_blank" id="diffNewWindow">Open in Wiki</a> <a onclick="$(\'.patrollink a\').click">[mark]</a> <a id="diffNext">'+krRTRC_IntMsgs.next.ucFirst+' &raquo;</a> '+krRTRC_SkipButon+' '); if(krRTRC_MassPatrol === true){ $(".patrollink a").click; }				$("#krRTRC_RCOutput>.feed div.indiff").removeClass("indiff"); krRTRC_RebindElements; });			return false;		});

// Mark as patrolled $(".patrollink").live("click", function{			$(".patrollink>a").html(krRTRC_IntMsgs.markaspatrolleddiff+'...');			$.ajax({ type: "GET", url: krRTRC_APIURL+'?action=patrol&format=xml&list=recentchanges&rcid='+currentDiffRcid+'&token='+krRTRC_Patroltoken, dataType: "xml", success: function(rawback){ if( $(rawback).find('error').length > 0 ){ $(".patrollink").html(' '+krRTRC_IntMsgs.markedaspatrollederror+' '); krLog("PatrolError: "+$(rawback).find('error').attr("code")+"; info: "+$(rawback).find('error').attr("info")); } else { $(".patrollink").html(' '+krRTRC_IntMsgs.markedaspatrolled+' '); $("#krRTRC_RCOutput>.feed div[rcid="+window.currentDiffRcid+"]").addClass("patrolled");

// Patrolling/Refreshing sometimes overlap eachother causing patrolled edits to show up in an 'unpatrolled only' feed. // Make sure that any patrolled edits stay marked as such to prevent AutoDiff from picking a patrolled edit // See also krRTRC_RebindElements krRTRC_MarkPatrolCache.push(window.currentDiffRcid);

while(krRTRC_MarkPatrolCache.length > krRTRC_MarkPatrolCacheMax){ krLog('MarkPatrolCache -> Cache array is bigger then cachemax, shifting array('+krRTRC_MarkPatrolCache.length+' vs. '+krRTRC_MarkPatrolCacheMax+'). Current array:'); krLog(krRTRC_MarkPatrolCache); krRTRC_MarkPatrolCache.shift; krLog('MarkPatrolCache -> Cache array is shifted. New array:'); krLog(krRTRC_MarkPatrolCache); }

if (krRTRC_AutoDiff === true) { krRTRC_NextDiff;} }				},				error: function{ $(".patrollink").html(' '+krRTRC_IntMsgs.markedaspatrollederror+' '); }			});			return false;		});

// Trigger NextDiff $("#diffNext").live("click", function {			krRTRC_NextDiff;		});

// SkipDiff $("#diffSkip").live("click", function{			$("#krRTRC_RCOutput>.feed div[rcid="+window.currentDiffRcid+"]").addClass("skipped"); // Add class			krRTRC_SkipDiffs.push(window.currentDiffRcid); // Add to array, to reAddClass after refresh in krRTRC_RebindElements			krRTRC_NextDiff; // Load next		});

// UnskipDiff $("#diffUnskip").live("click", function{			$('#krRTRC_RCOutput>.feed div[rcid='+window.currentDiffRcid+']').removeClass("skipped"); // Remove class			krRTRC_SkipDiffs.splice(krRTRC_SkipDiffs.indexOf(window.currentDiffRcid), 1); // Remove from array, to no longer reAddClass after refresh			//krRTRC_NextDiff; // Load next ?		});

// Show helpicons $("#toggleHelp").live("click", function{			$("#krRTRC_RCOptions").toggleClass('nohelp');		});

// Link helpicons $("#krRTRC_RCForm .helpicon").attr("title", krRTRC_Msg('clickforinfo')); $("#krRTRC_RCForm .helpicon").live("click", function{			window.open(krRTRC_HelpURL+'#'+$(this).attr("section"), "_blank");			return false;		});

// Clear rcuser-field // If MassPatrol is active, warn that clearing rcuser will automatically disable MassPatrol f		$("#RCOptions_RcuserClr").live("click", function{			if(krRTRC_MassPatrol === true){				var a = window.confirm(krRTRC_Msg('masspatrol_userfilterconfirm'));				if(a){					$("#rc-options-rcuser").val("");					krRTRC_ToggleMassPatrol(false);				}			} else {				$("#rc-options-rcuser").val("");			}			$RCOptions_submit.click;		});

// Clear rctitle-field /* RCTITLES DISABLED: $("#RCOptions_RctitleClr").live("click", function{			if(krRTRC_MassPatrol === true){				var a = window.confirm(krRTRC_Msg('masspatrol_userfilterconfirm'));				if(a){					krRTRC_ToggleMassPatrol(false);				}			}			$("#rc-options-rctitle").val("");			$RCOptions_submit.click;		}); */

// Tip $krRTRC_Tip = $("#krRTRC_Tip"); $krRTRC_Tiptext = $("#krRTRC_Tiptext"); $("#krRTRC_Tip,#krRTRC_Tiptext").live("click", function{			krRTRC_TipOut;		}); $("#krRTRC_Tip,#krRTRC_Tiptext").live("mouseover", function{			clearTimeout(window.krRTRC_TipTime);		}); $("#krRTRC_Tip,#krRTRC_Tiptext").live("mouseleave", function{			window.krRTRC_TipTime = setTimeout(krRTRC_TipOut,9000);		}); // Mark as patrolled when rollbacking // Note: As of MediaWiki r(unknown) rollbacking does already automatically patrol all reverted revisions. But by doing it anyway it saves a click for the AutoDiff-users $(".mw-rollback-link a").live("click", function{			$(".patrollink a").click;		}); // Button: MassPatrol $krRTRC_MassPatrol = $("#krRTRC_MassPatrol"); $krRTRC_MassPatrol.live("click", function{			if(krRTRC_MassPatrol === true){				krRTRC_ToggleMassPatrol(false);			} else if(krRTRC_AutoDiff === true) {				krRTRC_ToggleMassPatrol(true);			} else {				var a = window.confirm(krRTRC_Msg('masspatrol_autodiffneeded'));				if(a){					krRTRC_AutoDiff = true;					$("#rc-options-autodiff").val("An").addClass("button-on");					krRTRC_ToggleMassPatrol(true);				}			}		}); // Button: AutoDiff $("#rc-options-autodiff").live("click", function{			if(krRTRC_AutoDiff === true){				if(krRTRC_MassPatrol === true){					var a = window.confirm(krRTRC_Msg('autodiff_masspatrolneeds'));					if(a){						$("#rc-options-autodiff").val("Aus").removeClass("button-on");						krRTRC_AutoDiff = false;						krRTRC_ToggleMassPatrol(false);					}				} else {					$(this).val("Aus").removeClass("button-on");					krRTRC_AutoDiff = false;				}			} else {				$(this).val("An").addClass("button-on");				krRTRC_AutoDiff = true;					}		}); // Checkbox: AutoDiff from top $("#rc-options-autodiff-top").live("click", function{			if(krRTRC_AutoDiffTop === true){				$(this).removeAttr("checked");				krRTRC_AutoDiffTop = false;			} else {				$(this).attr("checked", "checked");				krRTRC_AutoDiffTop = true;					}		});

// Button: Pause $("#krRTRC_toggleRefresh").live("click", function{			krLog("#krRTRC_toggleRefresh clicked");			if(krRTRC_RCEnabled === true){				krRTRC_RCEnabled = false;				$(this).val("An").addClass("button-on");				clearTimeout(krRTRC_RCTimeout);			} else if(krRTRC_RCEnabled === false){				krRTRC_RCEnabled = true;				$(this).val("Aus").removeClass("button-on");				krRTRC_hardRefresh;			} else {				$(this).val("An").addClass("button-on");				clearTimeout(krRTRC_RCTimeout);			}			return false;		});

};

/** * Fire it off when the DOM is ready... * - */ // If on the right page in the right action... if( mw.config.get( 'wgPageName' )=="Kamelopedia:RTRC" && mw.config.get( 'wgAction' )=='view' && !krRTRC_Disabled ){

importStylesheetURI('http://kamelopedia.mormo.org/index.php?title=MediaWiki:Skin/Kamelopedia:RTRC.css&action=raw&ctype=text/css'); //importStylesheetURI('http://secure.grizzdesign.nl/RTRCdev.css'); importStylesheetURI('http://kamelopedia.mormo.org/skins/common/diff.css');

$(function{	if ( $("html").hasClass("msie") ){		var s = "Internet Explorer wird nicht unterstützt. Bitte Firefox, Chrome oder Safari nutzen.";		alert(s);		$(" <p style='color:red'>"+s+" ").insertBefore("#catlinks");		return true;	} else if ( $("html").hasClass("opera") ){		alert("Opera wird nicht unterstützt. Auf eigens Risiko nutzen, oder Firefox, Chrome oder Safari nutzen.");	}	krRTRC_init1; });

}//endif;