mirror of
https://github.com/lubuntu-team/lubuntu.me.git
synced 2025-02-23 16:21:07 +00:00
8 lines
16 KiB
JavaScript
8 lines
16 KiB
JavaScript
|
/********************************************
|
||
|
* REVOLUTION 5.0 EXTENSION - VIDEO FUNCTIONS
|
||
|
* @version: 1.0.0 (03.08.2015)
|
||
|
* @requires jquery.themepunch.revolution.js
|
||
|
* @author ThemePunch
|
||
|
*********************************************/
|
||
|
|
||
|
!function(){function e(e){return void 0==e?-1:jQuery.isNumeric(e)?e:e.split(":").length>1?60*parseInt(e.split(":")[0],0)+parseInt(e.split(":")[1],0):e}var t=jQuery.fn.revolution,a=t.is_mobile();jQuery.extend(!0,t,{resetVideo:function(t){switch(t.data("videotype")){case"youtube":{t.data("player")}try{if("on"==t.data("forcerewind")&&!a){var i=e(t.data("videostartat"));i=-1==i?0:i,t.data("player").seekTo(i),t.data("player").pauseVideo()}}catch(o){}0==t.find(".tp-videoposter").length&&punchgs.TweenLite.to(t.find("iframe"),.3,{autoAlpha:1,display:"block",ease:punchgs.Power3.easeInOut});break;case"vimeo":var d=$f(t.find("iframe").attr("id"));try{if("on"==t.data("forcerewind")&&!a){var i=e(t.data("videostartat"));i=-1==i?0:i,d.api("seekTo",i),d.api("pause")}}catch(o){}0==t.find(".tp-videoposter").length&&punchgs.TweenLite.to(t.find("iframe"),.3,{autoAlpha:1,display:"block",ease:punchgs.Power3.easeInOut});break;case"html5":if(a&&1==t.data("disablevideoonmobile"))return!1;var n=t.find("video"),r=n[0];if(punchgs.TweenLite.to(n,.3,{autoAlpha:1,display:"block",ease:punchgs.Power3.easeInOut}),"on"==t.data("forcerewind")&&!t.hasClass("videoisplaying"))try{var i=e(t.data("videostartat"));r.currentTime=-1==i?0:i}catch(o){}"mute"==t.data("volume")&&(r.muted=!0)}},stopVideo:function(e){switch(e.data("videotype")){case"youtube":try{var t=e.data("player");t.pauseVideo()}catch(a){}break;case"vimeo":try{var i=$f(e.find("iframe").attr("id"));i.api("pause")}catch(a){}break;case"html5":var o=e.find("video"),d=o[0];d.pause()}},playVideo:function(o,n){switch(clearTimeout(o.data("videoplaywait")),o.data("videotype")){case"youtube":if(0==o.find("iframe").length)o.append(o.data("videomarkup")),d(o,n,!0);else if(void 0!=o.data("player").playVideo){o.data("player").playVideo();var r=e(o.data("videostartat"));-1!=r&&o.data("player").seekTo(r)}else o.data("videoplaywait",setTimeout(function(){t.playVideo(o,n)},50));break;case"vimeo":if(0==o.find("iframe").length)o.append(o.data("videomarkup")),d(o,n,!0);else if(o.hasClass("rs-apiready")){var s=o.find("iframe").attr("id"),p=$f(s);void 0==p.api("play")?o.data("videoplaywait",setTimeout(function(){t.playVideo(o,n)},50)):setTimeout(function(){p.api("play");var t=e(o.data("videostartat"));-1!=t&&p.api("seekTo",t)},510)}else o.data("videoplaywait",setTimeout(function(){t.playVideo(o,n)},50));break;case"html5":if(a&&1==o.data("disablevideoonmobile"))return!1;var l=o.find("video"),v=l[0],u=l.parent();if(1!=u.data("metaloaded"))i(v,"loadedmetadata",function(a){t.resetVideo(a,n),v.play();var i=e(a.data("videostartat"));-1!=i&&(v.currentTime=i)}(o));else{v.play();var r=e(o.data("videostartat"));-1!=r&&(v.currentTime=r)}}},isVideoPlaying:function(e,t){var a=!1;return void 0!=t.playingvideos&&jQuery.each(t.playingvideos,function(t,i){e.attr("id")==i.attr("id")&&(a=!0)}),a},prepareCoveredVideo:function(e,t,a){var i=a.find("iframe"),o=e.split(":")[0],d=e.split(":")[1],n=t.width/t.height,r=o/d,s=n/r*100,p=r/n*100;n>r?punchgs.TweenLite.to(i,.001,{height:s+"%",width:"100%",top:-(s-100)/2+"%",left:"0px",position:"absolute"}):punchgs.TweenLite.to(i,.001,{width:p+"%",height:"100%",left:-(p-100)/2+"%",top:"0px",position:"absolute"})},checkVideoApis:function(e,t,a){var i="https:"===location.protocol?"https":"http";if((void 0!=e.data("ytid")||e.find("iframe").length>0&&e.find("iframe").attr("src").toLowerCase().indexOf("youtube")>0)&&(t.youtubeapineeded=!0),(void 0!=e.data("ytid")||e.find("iframe").length>0&&e.find("iframe").attr("src").toLowerCase().indexOf("youtube")>0)&&0==a.addedyt){a.addedyt=1;var o=document.createElement("script");o.src="https://www.youtube.com/iframe_api";var d=document.getElementsByTagName("script")[0],n=!0;jQuery("head").find("*").each(function(){"htps://www.youtube.com/iframe_api"==jQuery(this).attr("src")&&(n=!1)}),n&&d.parentNode.insertBefore(o,d)}if((void 0!=e.data("vimeoid")||e.find("iframe").length>0&&e.find("iframe").attr("src").toLowerCase().indexOf("vimeo")>0)&&(t.vimeoapineeded=!0),(void 0!=e.data("vimeoid")||e.find("iframe").length>0&&e.find("iframe").attr("src").toLowerCase().indexOf("vime
|