MediaWiki:Wikia.js

$(function {  YouTubeRemote.init; });

YouTubeRemote = { init: function { //YouTube videos YouTubeRemote.videos = $("#WikiaArticle").find("embed[src*=youtube]");

//Find remote controls $(".YouTubeRemote").click(function {        //Parameters         var time = $(this).attr("title");         //var video = $(this).attr("data-video");

//Default variables var seconds = 0; var videoIndex = 0;

//Time handling timeArray = time.split(":"); timeMultiplier = Array(3600,60,1); while(timeArray.length > 0) { seconds += timeArray.pop * timeMultiplier.pop; }

//Video identification if (video) { videoIndex = parseInt(video) - 1; }        //Stop videos YouTubeRemote.pause;

//Control video var video = YouTubeRemote.videos.get(videoIndex); video.seekTo(seconds, true); video.playVideo; });  },   pause: function {      YouTubeRemote.videos.each(function { $(this).get(0).pauseVideo; });  } };