Hinweis: Leere nach dem Veröffentlichen 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
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
importScript('Benutzer:TMg/cleanDiff.js');
importScript('Benutzer:Nightfly85/viewerInfo.js');
/**
* Mehrspaltigkeit für Einzelnachweise getreu der EN-WP
* (siehe dazu auch die common.css @ .multi-column)
*/
if($('body').hasClass('ns-0') && $('ol.references').find('li').length > 8) {
$('ol.references').addClass('multi-column');
}
/**
* historyCombine:
*
* fasst in der Versionsgeschichte Einträge zusammen, wenn sie
* aufeinanderfolgend vom gleichen Author stammen.
* Sinnvoll ist (m)eine angepasste common.css
*
* merges sequenced edits from the same author in
* the history list
* A modified common.css is recommened (like mine)
*
*
* Author: Benutzer:Nightfly85
*/
$(document).ready(function() {
// determines how many sequenced edits are required to stack them
var minStackCount = 3;
if(mw.config.get('wgAction') != "history" || minStackCount < 2)
return; // nothing to do here...
// cache the history list and its count
var $listItems = $('ul#pagehistory').find('li');
var listItemsLength = $listItems.length - 1;
// prepare the iterator compare elements
var currentAuthorName = '', lastAuthorName = '';
var $lastRow, $rootRow;
// this array contains grouped elements and will be
// resetted when a new author name is found
var stack = [];
// combine counter
var combinedStacks = 0;
// start the loop, iterate every row
$listItems.each(function(index, rowEl) {
// cache the current row (don't know if this is necessary :)
var $row = $(rowEl);
// cache the found author name
currentAuthorName = $row.find('.history-user a.mw-userlink').text();
if(currentAuthorName === lastAuthorName) {
// Yes, this author does more than one sequenced entry
if(stack.length === 0) {
// stack is empty, so the last row was the first item of the stack
$rootRow = $lastRow;
}
stack.push($row);
}
if(currentAuthorName !== lastAuthorName || index === listItemsLength) {
// a new author was found or this is the last iteration
var stacklength = stack.length;
if((stacklength + 1) >= minStackCount) {
// there is a stack we have to translate first
var ctText = (stacklength >= 1) ? stacklength.toString() + ' weitere Beiträge' : 'einen weiteren Beitrag';
$rootRow
.addClass('mw-historycombine-rootRow mw-historycombine-rootRow-folded')
.append(' <a href="#" class="mw-historycombine-autoBundleInfo"><span class="mw-historycombine-foldaction">zeige</span> ' + ctText + ' von ' + mw.html.escape(lastAuthorName));
for(var i = 0; i < stacklength; ++i ) {
// hide the stack items
// stack[i] = jQuery object
stack[i].addClass('mw-historycombine-hiddenChild mw-historycombine-hiddenChildIndex-' + $rootRow.index()).fadeOut();
}
++combinedStacks;
}
// reset the stack
stack = [];
// Save this author name for the next iteration
lastAuthorName = currentAuthorName;
$lastRow = $(rowEl);
}
});
if(combinedStacks) {
// If combined stacks exists, generate anchors to expand/collapse all
$('.mw-historycombine-unfoldAll').live('click', function(e) {
e.preventDefault();
$('.mw-historycombine-rootRow-folded').each(function(i, el) {
toggleStackVisibility($(el));
});
});
$('.mw-historycombine-foldAll').live('click', function(e) {
e.preventDefault();
$('.mw-historycombine-rootRow-unfolded').each(function(i, el) {
toggleStackVisibility($(el));
});
});
$('input.historysubmit').parent().append('Zusammengefasste Beiträge: <a href="#" class="mw-historycombine-unfoldAll">ausklappen</a> | <a href="#" class="mw-historycombine-foldAll">zuklappen</a>');
}
$('a.mw-historycombine-autoBundleInfo').live('click', function(e) {
e.preventDefault();
toggleStackVisibility($(this).closest('li'));
});
function toggleStackVisibility($row) {
// first, adjust the text from clicked link...
var $foldAction = $row.find('span.mw-historycombine-foldaction');
$foldAction.text($foldAction.text() == 'zeige' ? 'verstecke' : 'zeige');
// ...and second, look for linked stack items to expand or collapse them
$row
.toggleClass('mw-historycombine-rootRow-folded')
.toggleClass('mw-historycombine-rootRow-unfolded')
.parent()
.find('.mw-historycombine-hiddenChildIndex-' + $row.index())
.slideToggle('fast');
};
});