Differenze tra le versioni di "MediaWiki:Common.js"

m
Moving Sitenotice to its own file
m (This should get the job done, but I'm not sure)
m (Moving Sitenotice to its own file)
/***************************************************
 
Dynamic sitenotice
 
***************************************************/
 
mw.loader.using( ['jquery.cookie'] ).then( function () {
var sitenotice = {
cookieName: 'sitenotice-displayed-count',
HTML: '<div class="sitenotice width-xl-80 width-lg-90 width-md-100" style="position: relative;"><a href="/Pok%C3%A9mon:_Let\'s_Go,_Pikachu!_e_Let\'s_Go,_Eevee!" target="_blank">Pokémon: Let\'s Go, Pikachu! e Let\'s Go, Eevee!</a> sono ora disponibili! <span style="font-weight: bold;">Scopri come puoi aiutarci con l\'aggiornamento <a href="//forum.pokemoncentral.it/threads/27188/" target="_blank">sul forum</a></span>!</div>',
maxDisplayCount: 5,
 
getCookie: function() {
return parseInt($.cookie(this.cookieName) || 0);
},
 
updateCookie: function(currValue) {
$.cookie(this.cookieName, currValue + 1, {path: '/'});
return this;
},
 
display: function() {
$(this.HTML).prependTo('#content');
return this;
}
};
 
if (sitenotice.HTML !== '') {
var displayedCount = sitenotice.getCookie();
 
if (displayedCount < sitenotice.maxDisplayCount) {
sitenotice.updateCookie(displayedCount).display();
}
}
} );
 
/***************************************************
 
mw.loader.load('/index.php?title=MediaWiki:Magnific-Popup.js&action=raw&ctype=text/javascript');
mw.loader.load('https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css', 'text/css');
// Dynamic sitenotice
mw.loader.load('/index.php?title=MediaWiki:Sitenotice.js&action=raw&ctype=text/javascript');
});