MediaWiki:Common.js: Difference between revisions

Disabled Minerva-specific styles workaround
m (Birthdays formatting change)
(Disabled Minerva-specific styles workaround)
 
(6 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 66 ⟶ 67:
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 115 ⟶ 122:
);
 
$('#character-birthdays').append(html_out.substring(0,html_out.length-separator.length)).css( "display", "" );
}
/* Character birthdays - end */
Line 129 ⟶ 136:
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();
}
}
Line 135 ⟶ 145:
var voice = $(".character td.character-voice");
if (voice.find('audio').length == 0) {
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>');
voice.find('audio')[0].volume=0.6;
Line 149 ⟶ 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'));});
});
})