MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Disabled Minerva-specific styles workaround
mNo edit summary |
(Disabled Minerva-specific styles workaround) |
||
(13 intermediate revisions by the same user not shown) | |||
Line 5:
window.location.replace("https://bluearchive.wiki" + window.location.pathname);
}
// Common styles are currently loaded through an @import statement in MediaWiki:Mobile.css. I do not know what calls mw.loader.using('mobile.site.styles') currently, but it appears to happen. This code is preserved in case something breaks after caches expire.
// if (mw.config.get("skin") === "minerva") {
// // This hack is required to get custom css to load in mobile view. See https://phabricator.wikimedia.org/T270845
// loadMobileStylesheet();
}▼
// }
function initCountdown() {
var reset = new Date();
Line 63 ⟶ 64:
mw.loader.load( '/w/index.php?title=MediaWiki:Mitcher.js&action=raw&ctype=text/javascript' );
}
if (mw.config.get("wgPageName") === "
mw.loader.load( '/w/index.php?title=MediaWiki:Junby.js&action=raw&ctype=text/javascript' );
}
const title_split = mw.config.get('wgTitle').toLowerCase().split("/");
if (mw.config.get('wgNamespaceNumber') === 0 && title_split.length === 2 && title_split[1] === 'momotalk') {
mw.loader.load( '/w/index.php?title=MediaWiki:MomotalkChoice.js&action=raw&ctype=text/javascript' );
}
}
});
Line 76 ⟶ 83:
/* Character birthdays - start */
function initBirthdays(){
const months = [
'January',
Line 113 ⟶ 119:
data_out.forEach(
function (character) { html_out += '<a href="/wiki/'+character[0]+'">'+character[2]+' ('+character[1].replace(' ', ' ')+')</a>'
);
$('#character-birthdays').append(html_out
}
/* Character birthdays - end */
Line 129 ⟶ 135:
var voice = $(".character td.character-voice");
if (voice.length && voice.attr('data-voice').length) {
voice.wrapInner('<span>');
if (voice.find("span").width() > voice.width()-36 ) voice.css('padding-right', '16px');
voice.find("span").children().unwrap();
▲ }
voice.append('<audio class="voice-clip" src="'+voice.attr('data-voice')+'"></audio>').addClass('character-voice-preview');▼
}
function playCharacterVoice(){
var voice = $(".character td.character-voice");
if (voice.find('audio').length == 0) {
▲ voice.append('<audio class="voice-clip" src="'+voice.attr('data-voice')+'"></audio>
voice.find('audio')[0].volume=0.6;
▲ $(".character td.character-voice-preview").on("click", function(){ voice.find('audio')[0].play(); })
}
voice.find('audio')[0].play();
}
/* Character voice preview - end */
Line 142 ⟶ 155:
/* Character video preview - start */
$( document ).ready(function() {
//if video tab is open on inital page display
if ($(".character-images
$(".character-images div.tabber").one("click", function(){ ▼
if ($(".character-images #tab-Chibi-0").attr('aria-selected') == 'true') initCharacterVideo($('.character-images'));▼
//Tabber initializes late so events are bound at first click on parent div
$(".character-images #tab-Chibi-0").on("click", function(){initCharacterVideo($('.character-images'));}); ▼
▲ if ($(".character-images
▲ $(".character-images
});
})
Line 165 ⟶ 181:
}
/* Character video preview - end */
/* XP tables */
mw.loader.load( '/w/index.php?title=MediaWiki:XPtable.js&action=raw&ctype=text/javascript' );
|