MediaWiki:Gadgets-Orange.js
Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.
- Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
- Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
- Internet Explorer / Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5
- Opera: premi Ctrl-F5.
$(document).ready(function()
{
var HTML_CHAR_MAP = {
'<': '<',
'>': '>',
'&': '&',
'"': '"',
"'": '''
};
function escapeHtml (s) {
return s.replace(/[<>&"']/g, function (ch) {
return HTML_CHAR_MAP[ch];
});
}
if(mw.config.get('wgUserNewMsgRevisionId') != null)
{
var orangeBarDiv = document.createElement("div"), userName = mw.config.get('wgUserName'), userNewMsgRevisionId = mw.config.get('wgUserNewMsgRevisionId');
orangeBarDiv.innerHTML = 'شما از یک کاربر دیگر <a href="/wiki/User_talk:' + encodeURIComponent(userName) + '" title="User talk:'+escapeHtml(userName)+'">پیام جدید دارید</a> (<a href="/w/index.php?title=User_talk:'+encodeURIComponent(userName)+'&diff=cur&old='+userNewMsgRevisionId+'">۱ تغییر اخیر</a>).';
orangeBarDiv.className = "usermessage";
if($("#contentSub").length == 0) //No #contentSub in CologneBlue, so handle it specially (possibly adding multiple orange bars but oh well)
{
$(".tagline").after(orangeBarDiv);
}
else //all other skins
{
$("#contentSub").after(orangeBarDiv);
}
//default styling, in case the CSS stylesheet fails to load (keeping the className the same allows for user customization)
$(orangeBarDiv).css({"background-color": "#ffce7b","border": "1px solid #ffa500","color": "black","font-weight": "bold","margin": "2em 0 1em","padding": ".5em 1em","vertical-align": "middle"})
}
});