MediaWiki:Common.js: Difference between revisions
From the Kingdom Hearts Wiki, the Kingdom Hearts encyclopedia
Jump to navigationJump to search
No edit summary |
m (cleanup) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on | /* Any JavaScript here will be loaded for all users on desktop */ | ||
/* Alternating wiki logo */ | /* Alternating wiki logo */ | ||
$(function() { | $(function() { | ||
var logos = [' | var logos = ['b/bc/Wiki.png', 'd/d7/Wiki_2.png', '9/97/Wiki_3.png', '6/6a/Wiki_4.png', '7/79/Wiki_5.png']; | ||
$('#p-logo a').css('background-image', 'url(https://kh.wiki.gallery/images/' + logos[Math.floor(Math.random() * logos.length)] + ')'); | |||
$('#p-logo a').css('background-image', 'url(' + logos[Math.floor(Math.random() * logos.length)] + ')'); | |||
}); | }); | ||
/* | /* Add user subpages toolbox link */ | ||
$(function() { | $(function() { | ||
if (mw.config.get(' | if (mw.config.get('wgCanonicalNamespace') === 'User' && mw.config.get('skin') !== 'timeless') { | ||
var subpagesLink = '/Special:PrefixIndex/User:' + mw.config.get('wgTitle').split('/')[0] + '/'; | |||
mw.util.addPortletLink('p-tb', subpagesLink, 'User subpages', 't-subpages', 'Subpages for this user'); | |||
} | } | ||
}); | }); | ||
/* | /* Hide page previews when portals are used */ | ||
$(function() { | $(function() { | ||
if (document.getElementsByClassName('nav')[0] && document.getElementsByClassName('dropdown')[0]) | |||
if ( | $('head').append('<style type="text/css">.mwe-popups { display: none !important; }</style>'); | ||
}); | }); |
Latest revision as of 14:07, 7 August 2024
/* Any JavaScript here will be loaded for all users on desktop */
/* Alternating wiki logo */
$(function() {
var logos = ['b/bc/Wiki.png', 'd/d7/Wiki_2.png', '9/97/Wiki_3.png', '6/6a/Wiki_4.png', '7/79/Wiki_5.png'];
$('#p-logo a').css('background-image', 'url(https://kh.wiki.gallery/images/' + logos[Math.floor(Math.random() * logos.length)] + ')');
});
/* Add user subpages toolbox link */
$(function() {
if (mw.config.get('wgCanonicalNamespace') === 'User' && mw.config.get('skin') !== 'timeless') {
var subpagesLink = '/Special:PrefixIndex/User:' + mw.config.get('wgTitle').split('/')[0] + '/';
mw.util.addPortletLink('p-tb', subpagesLink, 'User subpages', 't-subpages', 'Subpages for this user');
}
});
/* Hide page previews when portals are used */
$(function() {
if (document.getElementsByClassName('nav')[0] && document.getElementsByClassName('dropdown')[0])
$('head').append('<style type="text/css">.mwe-popups { display: none !important; }</style>');
});