/* --------------------------------------------- */ /* Author: http://codecanyon.net/user/CodingJack */ /* --------------------------------------------- */ (function($) { var videoSwf = "../swf/video_fallback.swf", initialVolume = 75, htmlControls = '
' + '' + '' + '
' + '
00:00/00:00
' + '
' + '' + '' + '
' + '
' + '' + '' + '
' + '
' + '' + '' + '
' + '
' + '' + '' + '
', vidOffset = null, myObject = null, isFull = false, chTimer = null, sized = false, cTimer = null, timer = null, isFF = false, usePlayPause, useVolLines, videoPlayed, waitChrome, videoTimer, onControls, canAnimate, container, totalTime, useVolBtn, playPause, volOffset, storedWid, storedVol, useStatus, htmlVideo, plusWidth, controls, vidLines, progress, volLines, fullNorm, volTotal, volWidth, winWidth, useLines, duration, isLight, oHeight, myMedia, bigPlay, useFull, volMute, volPlay, touched, oWidth, mMinus, bodies, vTotal, volume, volBtn, normal, isIE8, video, place, pause, agent, auto, mins, secs, play, full, docs, win, url, doc; $.jackboxVideo = function() { if(typeof Modernizr !== "undefined") { touched = Modernizr.touch; htmlVideo = Modernizr.video; canAnimate = Modernizr.csstransitions; } else { htmlVideo = touched = canAnimate = false; } doc = document; win = $(window); docs = $(doc); bodies = $("body"); agent = navigator.userAgent.toLowerCase(); container = $("
").addClass("cj-video-container").appendTo(bodies); initialVolume *= .01; isFF = agent.search("firefox") !== -1; isIE8 = agent.search("msie") !== -1; if(isIE8) isIE8 = parseFloat(agent.substr(agent.indexOf("msie") + 4)) < 9; var st = doc.URL.split("?")[1], pIndex = st.indexOf("poster="), pst = st.substring(pIndex + 7, st.length); auto = st.search("autoplay=true") !== -1 ? !touched ? true : false : false; url = st.substring(st.indexOf("video=") + 6, st.indexOf("&autoplay")).split(".mp4")[0]; if(htmlVideo && st.substring(st.indexOf("flashing=") + 9, st.indexOf("&width")) === "false" && !isIE8) { writeVideo(url); if(!touched) { controls = $("
").addClass("cj-vid-controls").html(htmlControls).appendTo(container); myMedia.prependTo(container); video.volume = 0; if(initialVolume === 0) initialVolume = 1; storedVol = initialVolume; video.addEventListener("canplay", onMetaData, false); video.play(); } else { if(pst !== "false") myMedia.attr("poster", pst); myMedia.attr("controls", "controls").prependTo(container); if(parent.hasOwnProperty("jackboxFrameReady")) { isLight = true; parent.jackboxFrameReady(); } else { $.jackboxVideo.fullyLoaded(); } } } else if(!touched) { var hIndex = st.indexOf("height="); oWidth = st.substring(st.indexOf("width=") + 6, hIndex); oHeight = st.substring(hIndex + 7, pIndex); if("jackboxFrameReady" in parent) { parent.jackboxFrameReady(true); } else { $.jackboxVideo.fullyLoaded(); } } else { writeVideo(url); if(pst !== "false") myMedia.attr("poster", pst); myMedia.attr("controls", "controls").prependTo(container); if(parent.hasOwnProperty("jackboxFrameReady")) { isLight = true; parent.jackboxFrameReady(); } else { $.jackboxVideo.fullyLoaded(); } } }; function objectResize() { sized = true; myObject.attr({width: win.width(), height: win.height()}); } function resizer() { sized = true; winWidth = win.width(); mMinus = winWidth - 237 + plusWidth; if(useLines) { vidLines.css("width", mMinus); vTotal.css("width", mMinus); videoTime(); } myMedia.width(winWidth); myMedia.height(win.height()); } function writeVideo(url) { myMedia = $("