MediaWiki:Common.js: Difference between revisions

Disabled Minerva-specific styles workaround
mNo edit summary
(Disabled Minerva-specific styles workaround)
 
(9 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") === "A_Little_Game_Before_the_New_YearA_Game_Before_the_New_Year's_Eve_Feast!_s_Feast_~_Sudden_One-Death_Contest_and-Done_Match_~/Junby") {
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 separator = ' <span></span> ';
const months = [
'January',
Line 113 ⟶ 119:
 
data_out.forEach(
function (character) { html_out += '<a href="/wiki/'+character[0]+'">'+character[2]+'&nbsp;('+character[1].replace(' ', '&nbsp;')+')</a>'+separator; }
);
 
$('#character-birthdays').append(html_out.substring(0,html_out.length-separator.length)).css( "display", "" );
}
/* Character birthdays - end */
 
 
/* Character voice preview - start */
$( document ).ready(function() {
initCharacterVoice();
});
 
function initCharacterVoice(){
var voice = $(".character td.character-voice");
if (voice.length && voice.attr('data-voice').length) {
voice.addClass('character-voice-preview').on("click", function(){playCharacterVoice();});
voice.wrapInner('<span>');
if (voice.find("span").width() > voice.width()-36 ) voice.css('padding-right', '16px');
voice.find("span").children().unwrap();
}
}
 
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;
}
voice.find('audio')[0].play();
}
/* Character voice preview - end */
 
 
Line 126 ⟶ 156:
$( document ).ready(function() {
//if video tab is open on inital page display
if ($(".character-images #tab[data-title='Chibi-0']").attr('aria-selectedhidden') == 'truefalse' || window.location.hash == '#Chibi-0' || window.location.hash == '#Other-0' ) initCharacterVideo($('.character-images'));
 
//Tabber initializes late so events are bound at first click on parent div
$(".character-images div.tabber").oneon("click", function(){
if ($(".character-images #tab[data-title='Chibi-0']").attr('aria-selectedhidden') == 'truefalse') initCharacterVideo($('.character-images'));
$(".character-images #tab[data-title='Chibi-0']").on("click", function(){initCharacterVideo($('.character-images'));});
});
})