MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
Character voice preview, init player on click instead of page ready to avoid TMH meddling
No edit summary
(Character voice preview, init player on click instead of page ready to avoid TMH meddling)
Line 129:
var voice = $(".character td.character-voice");
if (voice.length && voice.attr('data-voice').length) {
$(".character td.character-voice-preview").on("click", functionplayCharacterVoice(){ voice.find('audio')[0].play(); })
}
}
 
function playCharacterVoice(){
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');
Line 134 ⟶ 141:
voice.append('<audio class="voice-clip" src="'+voice.attr('data-voice')+'"></audio>').addClass('character-voice-preview');
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 */
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu