//Dokumentatin unter ] <nowiki>
/*global mediaWiki*/
(function ($, mw) {
"use strict";
var normalMsg = {
en: ,
de: ,
'de-formal':
}, funnyMsg = {
de: ]
,
,
,
,
,
,
,
,
,
,
]
};
function getFunnyMsg () {
var chain = mw.language.getFallbackLanguageChain(), i, msgs = ;
for (i = 0; i < chain.length; i++) {
if (chain in funnyMsg) {
msgs = funnyMsg];
break;
}
}
if (msgs.length) {
return msgs;
} else {
return getNormalMsg();
}
}
function getNormalMsg () {
var chain = mw.language.getFallbackLanguageChain(), i;
for (i = 0; i < chain.length; i++) {
if (chain in normalMsg) {
return normalMsg];
}
}
return normalMsg.en; //sollte nicht passieren
}
function setMsg () {
var m = mw.user.options.get('userjs-schnark-kackbalken-irr') ? getFunnyMsg() : getNormalMsg();
mw.messages.set({
//ursprüngliche Nachrichten werden hier stark modifiziert, daher neue Namen
'schnark-kackbalken-youhavenewmessages': m + '$2' + m + '$1' + m,
'schnark-kackbalken-newmessageslink': m,
'schnark-kackbalken-newmessagesdifflink': m
});
}
function getLinks (revId) {
var d = mw.config.get('wgFormattedNamespaces') + ':' + mw.config.get('wgUserName');
return ;
}
function getNewMessage (revId) {
var l = getLinks(revId);
l = mw.html.element('a', {href: l}, mw.msg('schnark-kackbalken-newmessageslink'));
l = mw.html.element('a', {href: l}, mw.msg('schnark-kackbalken-newmessagesdifflink'));
return mw.msg('schnark-kackbalken-youhavenewmessages', l, l);
}
function showNewMessage (revId) {
var html = getNewMessage(revId);
$('#jump-to-nav').before(mw.html.element('div', {'class': 'usermessage'}, new mw.html.Raw(html)));
}
function init () {
var revId;
revId = mw.util.getParamValue('kackbalken') || //zum Testen
mw.config.get('wgUserNewMsgRevisionId');
if (
revId &&
!(
mw.config.get('wgNamespaceNumber') === 3 &&
mw.config.get('wgTitle') === mw.config.get('wgUserName')
)
) {
mw.loader.using('mediawiki.language').then(function () {
setMsg();
$(function () {
showNewMessage(revId);
});
});
}
}
mw.loader.using().then(init);
})(jQuery, mediaWiki);
//</nowiki>