MediaWiki:Wikia.js: diferència entre les revisions

Mpuj (discussió | contribucions)
crear notificació
 
Mpuj (discussió | contribucions)
BORRAR-HO PERQUÈ NO FUNCIONA
Línia 1: Línia 1:
/* Agrega una notificació a Oasis. - Obtingut de Wikidex, per [[w:c:es.pokemon:User:Ciencia Al Poder]] */
window.SkinNotification = {
article: 'El Detectiu Conan Català Wiki:Portal de la Comunitat',
key: 'NfSkin',
init: function() {
if (!document.cookie || document.cookie.length == 0) return;
var pref = $.cookies.get(SkinNotification.key);
if (pref) return;
SkinNotification.render();
},
render: function() {
var tb = $('#WikiaFooter').children('div.toolbar');
if (!tb.exists()) return;
var nf = $('#WikiaNotifications');
if (!nf.exists()) {
tb.prepend('<ul id="WikiaNotifications" class="WikiaNotifications"><li></li></ul>');
nf = $('#WikiaNotifications');
$(document.body).addClass('notifications');
$(document.body).addClass('notifications');
}
var sn = $('<div data-type="100"><a class="sprite close-notification"></a>Ajudans a fer créixer la wiki<a href="'+wgServer+wgArticlePath.replace('$1',SkinNotification.article.replace(/\s/g,'_'))+'" title="'+SkinNotification.article+'"></a>!</div>');
nf.children().eq(0).append(sn);
sn.children().eq(0).click(SkinNotification.dismiss);
},
dismiss: function(e) {
$(e.target).parent().remove();
$.cookies.set(SkinNotification.key,'1');
}
};


function One_Piece_Català_WikiaSkinLoad() {
var ug = '';
if (window.wgUserGroups) {
ug = wgUserGroups.join(',').toLowerCase();
}
if (ug.indexOf('s'+'taf'+'f') == -1 && ug.indexOf('h'+'elp'+'er') == -1) {
$(SkinNotification.init);
$(agregarEnlaceSkin);
}
}
One_Piece_Català_WikiaSkinLoad();