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
// Zeigt bei Diffs auf nachzusichtenden Seiten eine Übersicht über
// ungesichtete Versionen an.
var diffHistory = {
maxrows : 10,
addHistoryBox : function () {
var d = diffHistory,
wgStableRevisionId = mw.config.get( 'wgStableRevisionId' ),
wgCurRevisionId = mw.config.get( 'wgCurRevisionId' ),
wgArticleId = mw.config.get( 'wgArticleId' );
//Check if old reviewed page
if (!wgStableRevisionId || wgStableRevisionId == wgCurRevisionId) return;
var oldid = document.getElementById('mw-diff-otitle1').firstChild.firstChild.href.match(/&oldid=([^&]*)/)[1];
var curid = document.getElementById('mw-diff-ntitle1').firstChild.firstChild.href.match(/&oldid=([^&]*)/)[1];
if (wgStableRevisionId == oldid && wgCurRevisionId == curid) {
//Check if multi diff
if (! $( 'table.diff td.diff-multi' )[0] ) return; //all revisions shown
}
//Create history box above the review form
d.box = document.createElement('fieldset');
var legend = d.el('legend', 'Ungesichtete Versionen');
legend.style.padding = 0;
d.box.appendChild(legend);
d.createToggle();
d.box.appendChild(d.history = document.createElement('ul'));
d.history.appendChild(d.el('li', 'Lade Versionsgeschichte …'));
d.box.className = 'portlet pBody diffhistorybox';
d.box.style.width = 'auto';
var contentSub = document.getElementById('mw-fr-diff-headeritems');
contentSub.parentNode.insertBefore(d.box, contentSub);
//Fetch history
$.getJSON(
mw.util.wikiScript( 'api' ), {
format: 'json',
action: 'query',
prop: 'revisions',
rvprop: 'user|timestamp|size|flags|ids|comment',
rvendid: wgStableRevisionId + 1,
rvlimit: d.maxrows,
pageids: wgArticleId,
'continue': ''
}, diffHistory.show );
},
tsToLocal : function (ts) {
var m = ts.match(/^(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z$/);
var d = new Date(Date.UTC(m[1],m[2]-1,m[3],m[4],m[5],m[6]));
var tzdiff = d.getTimezoneOffset() - (new Date()).getTimezoneOffset();
if (tzdiff) d.setTime(d.getTime() + tzdiff * 60 * 1000);
var hour = d.getHours() < 10 ? '0' + d.getHours() : d.getHours();
var min = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes();
var month = ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'][d.getMonth()];
return d.getDate() + '. ' + month + '. ' + d.getFullYear() + ', ' + hour + ':' + min;
},
show : function (res) {
var i, j, p;
diffHistory.history.removeChild(diffHistory.history.firstChild);
try {
for (i in res.query.pages) {
p = res.query.pages[i];
if (p.revisions) for (j=0; j<p.revisions.length; j++)
diffHistory.addEntry(p.revisions[j]);
}
if (res['continue']) {
diffHistory.history.appendChild(diffHistory.el('li', '...'));
}
}
catch (e) {
diffHistory.history.appendChild(diffHistory.el('li', 'Fehler beim Laden der Versionen.'));
}
},
addLink : function (node, text, target, postfix) {
var link = diffHistory.el('a', text);
link.href = target;
node.appendChild(link);
node.appendChild(document.createTextNode(postfix));
},
addEntry : function (rev) {
var li = diffHistory.el('li', '(');
diffHistory.addLink(li, 'Aktuell', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) )
+ '&diff=cur&oldid=' + rev.revid, ') (');
diffHistory.addLink(li, 'Vorherige', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) )
+ '&diff=prev&oldid=' + rev.revid, ') . . ');
diffHistory.addLink(li, diffHistory.tsToLocal(rev.timestamp), mw.config.get( 'wgScript' ) + '?title='
+ mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&oldid=' + rev.revid, ' . . ');
diffHistory.addLink(li, rev.user, mw.util.getUrl( 'User:' + rev.user ), ' (');
diffHistory.addLink(li, 'Diskussion', mw.util.getUrl( 'User talk:' + rev.user ), ' | ');
diffHistory.addLink(li, 'Beiträge', mw.util.getUrl( 'Special:Contributions/' + rev.user ), ') ');
if (rev.minor === '') {
var span = diffHistory.el('span', 'K ');
span.className = 'minor';
li.appendChild(span);
}
if (rev.size) li.appendChild(document.createTextNode('(' + rev.size + ' Bytes) '));
var span = diffHistory.el('span', '(' + (rev.comment || '') + ')');
span.className = 'comment';
li.appendChild(span);
diffHistory.history.appendChild(li);
},
toggle : function () {
var t = diffHistory.history.style.display == 'none';
diffHistory.history.style.display = t ? 'block' : 'none';
diffHistory.togglelink.firstChild.nodeValue = mw.msg( t ? 'collapsible-collapse' : 'collapsible-expand' );
return false;
},
createToggle : function () {
var span = diffHistory.el('span', '[');
diffHistory.togglelink = diffHistory.el('a', mw.msg( 'collapsible-collapse' ) );
diffHistory.togglelink.href = '#';
diffHistory.togglelink.onclick = diffHistory.toggle;
span.appendChild(diffHistory.togglelink);
span.appendChild(document.createTextNode(']'));
span.style.fontSize = 'x-small';
span.style.cssFloat = 'right';
span.style.styleFloat = 'right';
diffHistory.box.appendChild(span);
},
el : function (tag, text) {
var el = document.createElement(tag);
el.appendChild(document.createTextNode(text));
return el;
}
};
mw.loader.using( [ 'mediawiki.util', 'jquery.makeCollapsible' ], function () {
if ( mw.config.get( 'wgAction' ) === 'view'
&& mw.util.getParamValue( 'diff' ) !== null ) {
$( diffHistory.addHistoryBox );
}
} );