MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(Basic character video support) |
(Improved character video playback) |
||
Line 138: | Line 138: | ||
} |
} |
||
/* Character voice preview - end */ |
/* Character voice preview - end */ |
||
/* Character video preview - start */ |
/* Character video preview - start */ |
||
$( document ).ready(function() { |
$( document ).ready(function() { |
||
if ($(".character-images #tab-Chibi-0").attr('aria-selected') == 'true') initCharacterVideo($('#Chibi-0')); |
|||
$(".character-images #tab-Chibi-0").on("click", function(){initCharacterVideo($('#Chibi-0'));}); |
$(".character-images #tab-Chibi-0").on("click", function(){initCharacterVideo($('#Chibi-0'));}); |
||
}) |
}) |
||
Line 146: | Line 148: | ||
function initCharacterVideo(element) { |
function initCharacterVideo(element) { |
||
var container = element.find('div.video'); |
var container = element.find('div.video'); |
||
if (!container.attr('data-video-initialized')) { |
|||
var video_src = container.attr('data-videosrc'); |
|||
container.html('<video autoplay loop playsinline><source src="'+video_src+'" type="video/webm" /></video>'); |
container.html('<video autoplay loop playsinline><source src="'+video_src+'" type="video/webm" /></video>'); |
||
container.on("click", function(){playToggle(container)}); |
|||
container.attr('data-video-initialized', true); |
|||
} |
|||
} |
|||
function playToggle(element) { |
|||
var video = element.find('video').get(0); |
|||
if (video.paused) video.play(); |
|||
else video.pause(); |
|||
} |
} |
||
/* Character video preview - end */ |
/* Character video preview - end */ |