MediaWiki:Skin/Kamelopedia:RTRC.js
Version vom 22. Mai 2011, 12:10 Uhr von Nachteule (Diskussion | Beiträge)
Hinweis: Leere nach dem Speichern den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Internet Explorer: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Gehe zu Menü → Einstellungen (Opera → Einstellungen auf dem Mac) und dann auf Datenschutz & Sicherheit → Browserdaten löschen → Gespeicherte Bilder und Dateien.
/**
* 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 <krinklemail (at) gmail (.) com>
*
* Real-Time Recent Changes by Krinkle [1] is licensed under
* a Creative Commons Attribution-Share Alike 3.0 Unported License [2]
*
* [1] <http://commons.wikimedia.org/wiki/User:Krinkle>
* [2] <http://creativecommons.org/licenses/by-sa/3.0/>
*
* 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 = wgServer+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 = 120; // Difference UTC vs. wiki - fetched from siteinfo/timeoffset, in minutes
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 $("<div/>").text(s).html();
}
function krDencodeEntities(s){
return $("<div/>").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 = wgServer;
l += 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
d.setTime(d.getTime()+7200000); // 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 '<div class="item"><div><strong>'+time.getDate()+' '+krRTRC_Months[time.getMonth()]+'</strong></div></div>';
}
}
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 = '<span class="unpatrolled">!</span>';
} else if (krRTRC_Patrolright === true && patrolled === false){
typeSymbol = '<span class="unpatrolled">!</span>';
}
itemClass = 'rcitem';
} else if (type == 'new'){
itemClass = 'rcitem';
typeSymbol = '<span class="log">N</span>';
} else if (type == 'log'){
itemClass = 'rcitem';
typeSymbol = '<span class="newpage">L</span>';
}
// strip HTML from comment
comment = comment.replace(/<[^>]*>/g, "");
// Check if comment is AES
if( comment.indexOf("[[COM:AES|←]]") === 0 ){
itemClass += ' aes';
comment = comment.replace("[[COM:AES|←]]", "← ");
}
// Anon-attribute
if (anon){
usertypeClass = ' anoncontrib';
} else {
usertypeClass = ' usercontrib';
}
/*
Example:
<div class="item rcitem patrolled" diff="0" user="Abc">
<div diff>(<a class="diff" diff="0" rcid="0" href="http://">diff</a>)</div>
<div type><span class="unpatrolled">!</span></div>
<div timetitle>00:00 <a href="http://?rcid=0" target="_blank">Abc</a></div>
<div user><a class="user" href="http://User:Abc">Abc</a></div>
<div other><a href="http://User talk:Abc">talk</a> / <a href="http://Special:Contributions/Abc">contribs</a> <span class="comment">Abc</span></div>
<div size><span class="mw-plusminus-null">(0)</span></div>
</div>
*/
// build & return item
var item = krRTRC_RCDayHead(krRTRC_APITimeConv(timestamp));
item += '<div class="item '+itemClass+usertypeClass+'" diff="'+revid+'" rcid="'+rcid+'" user="'+user+'">';
if (type == 'edit'){
diffLink = wgServer + wgScript + "?diff="+revid+"&oldif="+old_revid+"&rcid="+rcid;
diffLink = '<a class="rcitemlink diff" diff="'+revid+'" rcid="'+rcid+'" href="'+diffLink+'">'+krRTRC_IntMsgs.diff+'</a>';
} else if (type == 'log'){
diffLink = '<a class="rcitemlink logPage" logtype="'+logtype+'">'+logtype+'</a>';
} else if (type == 'new'){
diffLink = '<a class="rcitemlink newPage" rcid="'+rcid+'">Neu</a>';
}
item += '<div first>('+diffLink+') '+typeSymbol+' ';
item += krRTRC_AdjustAPIClocktime(timestamp)+' <a class="page" href="'+krRTRC_WikiLink(title)+'?rcid='+rcid+'" target="_blank">'+title+'</a></div>';
item += '<div user> <small>· <a href="'+krRTRC_WikiLink("User talk:"+user)+'" target="_blank">D</a> · <a href="'+krRTRC_WikiLink("Special:Contributions/"+user)+'" target="_blank">B</a> </small>· <a class="user" href="'+krRTRC_WikiLink("User:"+user)+'" target="_blank">'+user+'</a></div>';
item += '<div other> <span class="comment">'+krEncodeEntities(comment)+'</span></div>';
if (diffsize > 0){
el = diffsize > 399 ? "strong" : "span";
item += '<div size><'+el+' class="mw-plusminus-pos">('+diffsize+')</'+el+'></div>';
} else if (diffsize === 0){
item += '<div size><span class="mw-plusminus-null">(0)</span></div>';
} else {
el = diffsize < -399 ? "strong" : "span";
item += '<div size><'+el+' class="mw-plusminus-neg">('+diffsize+')</'+el+'></div>';
}
item += '</div>';
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 = $("<div>"+krRTRC_FeedMemHTML+"</div>").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)</small>');
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()+' | <a href="'+krRTRC_GeneratePermalink()+'">'+krRTRC_Msg('permalinktext')+'</a></div>';
// 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 += '<h3>Downloading recent changes failed</h3><p>Please untick the "Unpatrolled only"-checkbox or request the Patroller-right on <a href="'+wgServer+'">'+wgServer+'</a>';
// Other error
} else {
krRTRC_FeedMemHTML += '<h3>Downloading recent changes failed</h3><p>Please check the settings above and try again. If you believe this is a bug, please <a href="http://meta.wikimedia.org/w/index.php?title=User_talk:Krinkle/Tools&action=edit§ion=new&editintro=User_talk:Krinkle/Tools/Editnotice&preload=User_talk:Krinkle/Tools/Preload" target="_blank"><strong>let me know</strong></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+"</div>";
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 += '<strong><em>'+krRTRC_Msg('nomatches')+'</em></strong>';
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 wgServer+wgScript+"?title="+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 = ' · <a target="_blank" title="Whois '+uid+'?" href="http://toolserver.org/~chm/whois.php?ip='+uid+'">WHOIS</a>';
} else {
links = '';
}
//links += ' · <a target="_blank" title="View cross-wiki contributions" href="http://toolserver.org/~luxo/contributions/contributions.php?user='+uid+'&blocks=true">CrossWiki</a>';
if(krRTRC_Delhistright === true){
links += ' · <a target="_blank" title="View deleted contributions" href="'+krRTRC_WikiLink('Special:DeletedContributions/'+uid)+'">Bestattete Beiträge</a>';
}
$krRTRC_Tiptext.html('<a id="krRTRC_Tip_FilterAdd" onclick="$(\'#rc-options-rcuser\').val(\''+uid+'\'); $RCOptions_submit.click();" uid="'+uid+'" title="Filter by '+uid+'">[+<small>filter</small>]</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(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="+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§ion=new&preloadtitle=RTRC-Feedback").attr("target", "_blank").find(">span").html("Feedback");
$("#footer").remove();
$("#content").addClass("krRTRC_body");
krRTRC_RCLegendHTML = '<div id="krRTRC_RCLegend">Farben: <div class="item patrolled inline-block"> '+krRTRC_IntMsgs.markedaspatrolled+' </div>, <div class="item indiff inline-block"> '+krRTRC_Msg('currentedit')+' </div>, <div class="item skipped inline-block"> '+krRTRC_Msg('skippededit')+' </div>, <div class="item aes inline-block"> Edit with an Automatic Edit Summary </div><br />'+krRTRC_Msg('abbreviations')+': D - '+krRTRC_IntMsgs.talkpagelinktext+', B - '+krRTRC_IntMsgs.contributions+'</div>';
krRTRC_RCNamespaceDropdown = '<select id="rc-options-namespace" name="rc-options-namespace">';
krRTRC_RCNamespaceDropdown += '<option value>'+krRTRC_IntMsgs.namespacesall+'</option>';
krRTRC_RCNamespaceDropdown += '<option value="0">'+krRTRC_IntMsgs.blanknamespace+'</option>';
for(var ns in wgFormattedNamespaces){
if(ns > 0){ krRTRC_RCNamespaceDropdown += '<option value="'+ns+'">'+wgFormattedNamespaces[ns]+'</option>'; }
} krRTRC_RCNamespaceDropdown += '</select>';
$("#content").html(
'<div id="content-inner"><div id="krRTRC_PageWrap" class="plainlinks">' +
'<div id="krRTRC_Topbar">Letzte Änderungen in luxuriös und Echtzeit <small class="ns">('+krRTRC_appVersion+')</small><small id="toggleHelp">[Hilfe]</small></div>' +
'<div id="krRTRC_RCForm"><fieldset id="krRTRC_RCOptions" class="nohelp"><form>' +
'<div class="panel"><label for="rc-options-limit" class="head">'+krRTRC_Msg('limit')+'</label><select id="rc-options-limit" name="rc-options-limit"><option value="10">10</option><option selected="" value="25">25</option><option value="50">50</option><option value="75">75</option><option value="100">100</option></select></div>' +
'<div class="sep"></div>' +
'<div class="panel"><label class="head">'+krRTRC_Msg('filter')+'</label><div style="text-align:left"><input type="checkbox" value="on" id="rc-options-filter-anons" name="rc-options-filter-anons"><label for="rc-options-filter-anons"> '+krRTRC_Msg('anononly')+'</label><br /><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></div></div>' +
'<div class="sep"></div>' +
'<div class="panel"><label for="rc-options-rcuser" class="head">'+krRTRC_Msg('userfilter-opt')+' <span section="Userfilter" class="helpicon"></span></label><div style="text-align:center"><input type="text" value="" size="16" id="rc-options-rcuser" name="rc-options-rcuser" /><br /><input class="button" type="button" id="RCOptions_RcuserClr" value="'+krRTRC_Msg('clear')+'" /></div></div>' +
'<div class="sep"></div>' +
'<div class="panel"><label class="head">'+krRTRC_Msg('type')+'</label><div style="text-align:left"><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')+'</label><br /><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')+'</label></div></div>' +
'<div class="sep"></div>' +
// RCTITLES DISABLED: https://bugzilla.wikimedia.org/show_bug.cgi?id=12394#c5
// '<div class="panel"><label class="head" for="rc-options-rctitle">'+krRTRC_Msg('pagefilter-opt')+' <span section="Pagefilter" class="helpicon"></span></label><div style="text-align:center"><input type="text" value="" size="16" id="rc-options-rctitle" name="rc-options-rctitle" /><br /><input class="button" type="button" id="RCOptions_RctitleClr" value="'+krRTRC_Msg('clear')+'" /></div></div>' +
//'<div class="sep"></div>' +
'<div class="panel"><label class="head">'+krRTRC_Msg('timeframe-opt')+' <span section="Timeframe" class="helpicon"></span></label><div style="text-align:right"><label for="rc-options-timeframe-rcfrom">'+krRTRC_Msg('from')+': </label><input type="text" value="" size="14" id="rc-options-timeframe-rcfrom" name="rc-options-timeframe-rcfrom"><br /><label for="rc-options-timeframe-rcuntill">'+krRTRC_Msg('untill')+': </label><input type="text" value="" size="14" id="rc-options-timeframe-rcuntill" name="rc-options-timeframe-rcuntill"></div></div>' +
'<div class="sep"></div>' +
'<div class="panel"><label for="rc-options-namespace" class="head">'+krRTRC_IntMsgs.namespaces+'</label>'+krRTRC_RCNamespaceDropdown+'</div>' +
'<div class="sep"></div>' +
'<div class="panel"><label class="head">'+krRTRC_Msg('order')+' <br /><span section="Order" class="helpicon"></span></label><div style="text-align:left"><input type="radio" name="rc-options-rcdir" value="asc"> '+krRTRC_Msg('asc')+' <br /><input type="radio" name="rc-options-rcdir" value="desc" checked="checked"> '+krRTRC_Msg('desc')+' </div></div>' +
'<div class="sep"></div>' +
'<div class="panel"><label for="rc-options-interval" class="head">R <br /><span section="Reload_Interval" class="helpicon"></span></label><input type="text" value="3" size="1" id="rc-options-interval" name="rc-options-interval"></div>' +
'<div class="sep"></div>' +
'<div class="panel"><label class="head" for="rc-options-ircbl">IRCBL<br /><span section="IRC_Blacklist" class="helpicon"></span></label><input type="checkbox" value="on" size id="rc-options-ircbl" name="rc-options-ircbl" /></div>' +
'<div class="sep"></div>' +
'<div class="panel panel-last"><input class="button" type="button" id="RCOptions_submit" value="'+krRTRC_Msg('apply')+'" /></div>' +
//'<hr style="clear:both" />' +
//'<div class="panel2"><label for="krRTRC_MassPatrol" class="head">MassPatrol <span section="MassPatrol" class="helpicon"></span></label><input id="krRTRC_MassPatrol" class="button button-off" type="button" value="Aus" /></div>' +
//'<div class="sep2"></div>' +
//'<div class="panel2"><label for="rc-options-autodiff" class="head">AutoDiff <span section="AutoDiff" class="helpicon"></span></label><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></div>' +
// '<div class="sep2"></div>' +
// '<div class="panel2"><label for="krRTRC_toggleRefresh" class="head">Pause</label><input id="krRTRC_toggleRefresh" class="button button-off" type="button" value="Aus" /></div>' +
'</fieldset></form></div>' +
'<a name="krRTRC_DiffTop" />' +
'<div id="krRTRC_DiffFrame" style="display:none"></div>' +
'<div id="krRTRC_RCOutput" class="placeholder">'+krRTRC_RCLegendHTML+'</div>' +
'<div style="clear:both"></div>' );//+
//'<div id="krRTRC_Footer"><div class="inside">' +
// '<span style="float:left"><a href="http://meta.wikimedia.org/wiki/User:Krinkle/Tools/Real-Time_Recent_Changes" class="external text" rel="nofollow">'+krRTRC_Msg('documentation')+'</a></span>' +
// 'Real-Time Recent Changes by <a href="http://commons.wikimedia.org/wiki/User:Krinkle" class="external text" rel="nofollow">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>.' +
//'<span style="float:right"><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></span>' +
//'</div></div>');
$("body").append("<div id='krRTRC_Tip'><span id='krRTRC_Tiptext'></span></div>");
$("#content-inner").css("position", "relative");
$("#krRTRC_RCOutput").prepend('<div class="feed"></div><img src="'+krRTRC_LoaderSRC+'" id="krRTRC_loader" style="display:none" />');
//EXPERIMENTAL
//$('<div class="sep2"></div><div class="errorbox"><b>Experimental:</b> <a href="javascript:krRTRC_RefreshWhois()">Refresh WhoisOnline</a> | ...</div>').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(wgServer + wgScript + '?action=render&diff='+window.currentDiff+'&diffonly=1&uselang='+wgUserLanguage, function() {
$(this).html($(this).html().replace("diffonly=", "krinkle=").replace("diffonly=", "krinkle="));
if (krInArray(window.currentDiffRcid, krRTRC_SkipDiffs)){
krRTRC_SkipButon = '<span class="tab"><a id="diffUnskip">Un-Überspringen</a></span>';
} else {
krRTRC_SkipButon = '<span class="tab"><a id="diffSkip">Überspringen</a></span>';
}
$("#krRTRC_DiffFrame").fadeIn().prepend('<h3>'+title+'</h3><div id="krRTRC_DiffTools"><span class="tab"><a id="diffClose">X</a></span><span class="tab"><a href="'+href+'" target="_blank" id="diffNewWindow">In neuem Tab öffnen</a></span>' +
( krRTRC_Patroltoken ? '<span class="tab"><a onclick="(function(){ if($(\'.patrollink a\').length){ $(\'.patrollink a\').click(); } else { $(\'#diffSkip\').click(); } })();">[Markieren]</a></span>' : '' ) +
'<span class="tab"><a id="diffNext">'+krRTRC_IntMsgs.next.ucFirst()+' »</a></span>'+krRTRC_SkipButon+'</div>');
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='+wgUserLanguage, function(){
if (krInArray(window.currentDiffRcid, krRTRC_SkipDiffs)){
krRTRC_SkipButon = '<span class="tab"><a id="diffUnskip">Unskip</a></span>';
} else {
krRTRC_SkipButon = '<span class="tab"><a id="diffSkip">Skip</a></span>';
}
$("#krRTRC_DiffFrame").fadeIn().prepend('<h3>'+title+'</h3><div id="krRTRC_DiffTools"><span class="tab"><a id="diffClose">X</a></span><span class="tab"><a href="'+href+'" target="_blank" id="diffNewWindow">Open in Wiki</a></span><span class="tab"><a onclick="$(\'.patrollink a\').click()">[mark]</a></span><span class="tab"><a id="diffNext">'+krRTRC_IntMsgs.next.ucFirst()+' »</a></span>'+krRTRC_SkipButon+'</div>');
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('<span style="color:red">'+krRTRC_IntMsgs.markedaspatrollederror+'</span>');
krLog("PatrolError: "+$(rawback).find('error').attr("code")+"; info: "+$(rawback).find('error').attr("info"));
} else {
$(".patrollink").html('<span style="color:green">'+krRTRC_IntMsgs.markedaspatrolled+'</span>');
$("#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('<span style="color:red">'+krRTRC_IntMsgs.markedaspatrollederror+'</span>');
}
});
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);
});
$("#krRTRC_list *").live("mouseover", function(e){
krLog(e); krLog(e.target);
$hovEl = false;
if ( $(e.target).is(".rcitem") ){
$hovEl = $(e.target);
} else if ( $(e.target).parents(".rcitem").is(".rcitem") ){
$hovEl = $(e.target).parents(".rcitem");
}
if($hovEl){
krRTRC_TipIn($hovEl.find(".user"), $hovEl.find(".user").text(), $hovEl.hasClass("anoncontrib"));
} else {
krRTRC_TipOut();
}
});
// 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( wgPageName=="Kamelopedia:RTRC" && 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);
$("<hr /><p style='color:red'>"+s+"</p>").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;