(function ($){
$.fn.theiaStickySidebar=function (options){
var defaults={
'containerSelector': '',
'additionalMarginTop': 0,
'additionalMarginBottom': 0,
'updateSidebarHeight': true,
'minWidth': 0,
'disableOnResponsiveLayouts': true,
'sidebarBehavior': 'modern',
'defaultPosition': 'relative',
'namespace': 'TSS'
};
options=$.extend(defaults, options);
options.additionalMarginTop=parseInt(options.additionalMarginTop)||0;
options.additionalMarginBottom=parseInt(options.additionalMarginBottom)||0;
tryInitOrHookIntoEvents(options, this);
function tryInitOrHookIntoEvents(options, $that){
var success=tryInit(options, $that);
if(!success){
console.log('TSS: Body width smaller than options.minWidth. Init is delayed.');
$(document).on('scroll.' + options.namespace, function (options, $that){
return function (evt){
var success=tryInit(options, $that);
if(success){
$(this).unbind(evt);
}};}(options, $that));
$(window).on('resize.' + options.namespace, function (options, $that){
return function (evt){
var success=tryInit(options, $that);
if(success){
$(this).unbind(evt);
}};}(options, $that))
}}
function tryInit(options, $that){
if(options.initialized===true){
return true;
}
if($('body').width() < options.minWidth){
return false;
}
init(options, $that);
return true;
}
function init(options, $that){
options.initialized=true;
var existingStylesheet=$('#theia-sticky-sidebar-stylesheet-' + options.namespace);
if(existingStylesheet.length===0){
$('head').append($(''));
}
$that.each(function (){
var o={};
o.sidebar=$(this);
o.options=options||{};
o.container=$(o.options.containerSelector);
if(o.container.length==0){
o.container=o.sidebar.parent();
}
o.sidebar.parents().css('-webkit-transform', 'none');
o.sidebar.css({
'position': o.options.defaultPosition,
'overflow': 'visible',
'-webkit-box-sizing': 'border-box',
'-moz-box-sizing': 'border-box',
'box-sizing': 'border-box'
});
o.stickySidebar=o.sidebar.find('.theiaStickySidebar');
if(o.stickySidebar.length==0){
var javaScriptMIMETypes=/(?:text|application)\/(?:x-)?(?:javascript|ecmascript)/i;
o.sidebar.find('script').filter(function (index, script){
return script.type.length===0||script.type.match(javaScriptMIMETypes);
}).remove();
o.stickySidebar=$('
').addClass('theiaStickySidebar').append(o.sidebar.children());
o.sidebar.append(o.stickySidebar);
}
o.marginBottom=parseInt(o.sidebar.css('margin-bottom'));
o.paddingTop=parseInt(o.sidebar.css('padding-top'));
o.paddingBottom=parseInt(o.sidebar.css('padding-bottom'));
var collapsedTopHeight=o.stickySidebar.offset().top;
var collapsedBottomHeight=o.stickySidebar.outerHeight();
o.stickySidebar.css('padding-top', 1);
o.stickySidebar.css('padding-bottom', 1);
collapsedTopHeight -=o.stickySidebar.offset().top;
collapsedBottomHeight=o.stickySidebar.outerHeight() - collapsedBottomHeight - collapsedTopHeight;
if(collapsedTopHeight==0){
o.stickySidebar.css('padding-top', 0);
o.stickySidebarPaddingTop=0;
}else{
o.stickySidebarPaddingTop=1;
}
if(collapsedBottomHeight==0){
o.stickySidebar.css('padding-bottom', 0);
o.stickySidebarPaddingBottom=0;
}else{
o.stickySidebarPaddingBottom=1;
}
o.previousScrollTop=null;
o.fixedScrollTop=0;
resetSidebar();
var oldAdditionalMarginTop=options.additionalMarginTop;
o.onScroll=function (o){
if(!o.stickySidebar.is(":visible")){
return;
}
if($('body').width() < o.options.minWidth){
resetSidebar();
return;
}
if(o.options.disableOnResponsiveLayouts){
var sidebarWidth=o.sidebar.outerWidth(o.sidebar.css('float')=='none');
if(sidebarWidth + 50 > o.container.width()){
resetSidebar();
return;
}}
if(window.global_up_down_scroll==='up'&&typeof(options.stickyUpMenuHeight)==='number'){
options.additionalMarginTop=oldAdditionalMarginTop + options.stickyUpMenuHeight;
}else{
options.additionalMarginTop=oldAdditionalMarginTop;
}
var scrollTop=$(document).scrollTop();
var position='static';
if(scrollTop >=o.sidebar.offset().top + (o.paddingTop - o.options.additionalMarginTop)){
var offsetTop=o.paddingTop + options.additionalMarginTop;
var offsetBottom=o.paddingBottom + o.marginBottom + options.additionalMarginBottom;
var containerTop=o.sidebar.offset().top;
var containerBottom=o.sidebar.offset().top + getClearedHeight(o.container);
var windowOffsetTop=0 + options.additionalMarginTop;
var windowOffsetBottom;
var sidebarSmallerThanWindow=(o.stickySidebar.outerHeight() + offsetTop + offsetBottom) < $(window).height();
if(sidebarSmallerThanWindow){
windowOffsetBottom=windowOffsetTop + o.stickySidebar.outerHeight();
}else{
windowOffsetBottom=$(window).height() - o.marginBottom - o.paddingBottom - options.additionalMarginBottom;
}
var staticLimitTop=containerTop - scrollTop + o.paddingTop;
var staticLimitBottom=containerBottom - scrollTop - o.paddingBottom - o.marginBottom;
var top=o.stickySidebar.offset().top - scrollTop;
var scrollTopDiff=o.previousScrollTop - scrollTop;
if(o.stickySidebar.css('position')=='fixed'){
if(o.options.sidebarBehavior=='modern'){
top +=scrollTopDiff;
}}
if(o.options.sidebarBehavior=='stick-to-top'){
top=options.additionalMarginTop;
}
if(o.options.sidebarBehavior=='stick-to-bottom'){
top=windowOffsetBottom - o.stickySidebar.outerHeight();
}
if(scrollTopDiff > 0){
top=Math.min(top, windowOffsetTop);
}else{
top=Math.max(top, windowOffsetBottom - o.stickySidebar.outerHeight());
}
top=Math.max(top, staticLimitTop);
top=Math.min(top, staticLimitBottom - o.stickySidebar.outerHeight());
var sidebarSameHeightAsContainer=o.container.height()==o.stickySidebar.outerHeight();
if(!sidebarSameHeightAsContainer&&top==windowOffsetTop){
position='fixed';
}
else if(!sidebarSameHeightAsContainer&&top==windowOffsetBottom - o.stickySidebar.outerHeight()){
position='fixed';
}
else if(scrollTop + top - o.sidebar.offset().top - o.paddingTop <=options.additionalMarginTop){
position='static';
}else{
position='absolute';
}}
if(position=='fixed'){
var scrollLeft=$(document).scrollLeft();
o.stickySidebar.css({
'position': 'fixed',
'width': getWidthForObject(o.stickySidebar) + 'px',
'transform': 'translateY(' + top + 'px)',
'left': (o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left')) - scrollLeft) + 'px',
'top': '0px'
});
}
else if(position=='absolute'){
var css={};
if(o.stickySidebar.css('position')!='absolute'){
css.position='absolute';
css.transform='translateY(' + (scrollTop + top - o.sidebar.offset().top - o.stickySidebarPaddingTop - o.stickySidebarPaddingBottom) + 'px)';
css.top='0px';
}
css.width=getWidthForObject(o.stickySidebar) + 'px';
css.left='';
o.stickySidebar.css(css);
}
else if(position=='static'){
resetSidebar();
}
if(position!='static'){
if(o.options.updateSidebarHeight==true){
o.sidebar.css({
'min-height': o.stickySidebar.outerHeight() + o.stickySidebar.offset().top - o.sidebar.offset().top + o.paddingBottom
});
}}
o.previousScrollTop=scrollTop;
};
o.onScroll(o);
$(document).on('scroll.' + o.options.namespace, function (o){
return function (){
o.onScroll(o);
};}(o));
$(window).on('resize.' + o.options.namespace, function (o){
return function (){
o.stickySidebar.css({'position': 'static'});
resetSidebar();
o.onScroll(o);
};}(o));
$('body').on('ajaxloadpostcomplete_themeControl.' + o.options.namespace, function (o){
return function (){
o.stickySidebar.css({'position': 'static'});
resetSidebar();
o.onScroll(o);
};}(o));
if(typeof ResizeSensor!=='undefined'){
new ResizeSensor(o.stickySidebar[0], function (o){
return function (){
o.onScroll(o);
};}(o));
}
function resetSidebar(){
o.fixedScrollTop=0;
o.sidebar.css({
'min-height': '1px'
});
o.stickySidebar.css({
'position': 'static',
'width': '',
'transform': 'none'
});
}
function getClearedHeight(e){
var height=e.height();
e.children().each(function (){
height=Math.max(height, $(this).height());
});
return height;
}});
}
function getWidthForObject(object){
var width;
try {
width=object[0].getBoundingClientRect().width;
}
catch (err){
}
if(typeof width==="undefined"){
width=object.width();
}
return width;
}
return this;
}})(jQuery);
!function(){"use strict";var a="undefined"!=typeof window&&void 0!==window.document?window.document:{},b="undefined"!=typeof module&&module.exports,c="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,d=function(){for(var b,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],d=0,e=c.length,f={};d
'+mejsL10n.strings["mejs.download-video"]+""},n(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!n(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(e)}}},n(e.wp.mediaelement.initialize)}(window,jQuery);
;(function(factory){
if(typeof define==='function'&&define.amd){
define(['jquery'], factory);
}else if(typeof exports!=='undefined'){
module.exports=factory(require('jquery'));
}else{
factory(jQuery);
}}(function($){
'use strict';
var prefix='vidorev_theme';
var vidorev_theme=window.vidorev_theme||{};
vidorev_theme=(function(){
function vidorev_theme(el, options){
var _=this;
_.defaults={
}
if(typeof(options)==='object'){
_.options=$.extend({}, _.defaults, options);
}else{
_.options=_.defaults;
}
_.$el=$(el);
_.sticky_menu_on=_.$el.hasClass('sticky-menu-on');
_.sticky_behavior='down';
if(_.$el.hasClass('sticky-behavior-up')){
_.sticky_behavior='up';
}
_.sticky_sidebar_on=_.$el.hasClass('sticky-sidebar-on');
if(typeof(vidorev_jav_js_object)!=='undefined'&&typeof(vidorev_jav_js_object.query_vars)!=='undefined'&&typeof(vidorev_jav_js_object.query_vars.paged)!=='undefined'){
_.global_blog_page=vidorev_jav_js_object.query_vars.paged;
}else{
_.global_blog_page=-1;
}
if(_.global_blog_page==0){
_.global_blog_page=1;
}
_.global_blog_ajax_load=true;
_.global_video_autoplay='off';
if(typeof(vidorev_jav_js_object)!=='undefined'&&typeof(vidorev_jav_js_object.video_auto_play)!=='undefined'&&!_.getMobileOperatingSystem()){
_.global_video_autoplay=vidorev_jav_js_object.video_auto_play;
}
_.global_browser_desktop_autoplay='on';
var isBrowserNoAutoplay=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
if(!_.getMobileOperatingSystem()&&isBrowserNoAutoplay){
_.global_browser_desktop_autoplay='off';
}
_.global_muted_video=false;
if(_.global_video_autoplay==='on'&&_.global_browser_desktop_autoplay==='off'){
_.global_muted_video=true;
}
var isChromeBrowser=false;
var isChromium=window.chrome;
var winNav=window.navigator;
var vendorName=winNav.vendor;
var isOpera=typeof window.opr!=="undefined";
var isIEedge=winNav.userAgent.indexOf("Edge") > -1;
var isIOSChrome=winNav.userAgent.match("CriOS");
if(isIOSChrome){
isChromeBrowser=true;
}else if(isChromium!==null &&
typeof isChromium!=="undefined" &&
vendorName==="Google Inc." &&
isOpera===false &&
isIEedge===false
){
isChromeBrowser=true;
}else{
isChromeBrowser=false;
}
_.global_video_network_mute_for_autoplay=false;
if(_.global_video_autoplay==='on'&&isChromeBrowser){
_.global_video_network_mute_for_autoplay=true;
}
_.global_number_format='short';
if(typeof(vidorev_jav_js_object)!=='undefined'&&typeof(vidorev_jav_js_object.number_format)!=='undefined'){
_.global_number_format=vidorev_jav_js_object.number_format;
}
_.global_video_lightbox_items=[];
_.global_video_lightbox_suggested_posts=[];
_.global_video_lightbox_live_comments=null;
_.global_click_added_live_comment=null;
_.global_video_auto_next=typeof(Cookies.get('vpautonextvideo'))!=='undefined'&&Cookies.get('vpautonextvideo')=='true';
_.default_ads_otps={
'vid_ads_m_video_ads': 'no',
'vid_ads_m_video_ads_type': 'google_ima',
'vid_ads_m_group_google_ima': [],
'vid_ads_m_group_image': [],
'vid_ads_m_group_html': [],
'vid_ads_m_time_to_show_ads': '0',
'vid_ads_m_time_skip_ads': '5',
'vid_ads_m_time_to_hide_ads': '10'
}
if(typeof(vidorev_jav_plugin_video_ads_object)==='object'){
_.ads_opts=$.extend({}, _.default_ads_otps, vidorev_jav_plugin_video_ads_object);
}else{
_.ads_opts=_.default_ads_otps;
}
if(typeof(vidorev_jav_plugin_video_ads_object_post)==='object'){
if(typeof(vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads_type)!=='undefined'&&$.trim(vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads_type)!=''){
_.ads_opts=$.extend({}, _.default_ads_otps, vidorev_jav_plugin_video_ads_object_post);
}
if(typeof(vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads)!=='undefined'&&$.trim(vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads)!=''){
_.ads_opts.vid_ads_m_video_ads=vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads;
}else{
if(typeof(vidorev_jav_plugin_video_ads_object)==='object'&&typeof(vidorev_jav_plugin_video_ads_object.vid_ads_m_video_ads)!=='undefined'&&$.trim(vidorev_jav_plugin_video_ads_object.vid_ads_m_video_ads)!=''){
_.ads_opts.vid_ads_m_video_ads=vidorev_jav_plugin_video_ads_object.vid_ads_m_video_ads;
}}
}
_.get_ads_params(_.ads_opts, true);
_.is_ad_appeared=[];
_.is_ad_google_ima_control=[];
_.is_ad_google_ima_stated_event=[];
_.global_player_playing=[];
_.you_rel=0,
_.you_modestbranding=1,
_.you_showinfo=1;
if(typeof(vidorev_jav_plugin_js_object)!=='undefined'){
if(typeof(vidorev_jav_plugin_js_object.youtube_rel)!=='undefined'&&vidorev_jav_plugin_js_object.youtube_rel==='yes'){
_.you_rel=1;
}
if(typeof(vidorev_jav_plugin_js_object.youtube_modestbranding)!=='undefined'&&vidorev_jav_plugin_js_object.youtube_modestbranding==='no'){
_.you_modestbranding=0;
}
if(typeof(vidorev_jav_plugin_js_object.youtube_showinfo)!=='undefined'&&vidorev_jav_plugin_js_object.youtube_showinfo==='no'){
_.you_showinfo=0;
}}
_.init();
}
return vidorev_theme;
}());
vidorev_theme.prototype.get_ads_params=function(ads_opts, global){
var _=this;
var ads_enable=ads_opts.vid_ads_m_video_ads==='yes'?true:false,
ads_network=ads_opts.vid_ads_m_video_ads_type,
time_to_show_ads=(typeof(ads_opts.vid_ads_m_time_to_show_ads)!=='undefined'&&$.trim(ads_opts.vid_ads_m_time_to_show_ads)!='')?(ads_opts.vid_ads_m_time_to_show_ads).split(','):[0],
time_skip_ads=(typeof(ads_opts.vid_ads_m_time_skip_ads)!=='undefined'&&_.isNumber(ads_opts.vid_ads_m_time_skip_ads))?parseFloat(ads_opts.vid_ads_m_time_skip_ads):5,
time_to_hide_ads=(typeof(ads_opts.vid_ads_m_time_to_hide_ads)!=='undefined'&&_.isNumber(ads_opts.vid_ads_m_time_to_hide_ads))?parseFloat(ads_opts.vid_ads_m_time_to_hide_ads):10;
var time_to_show_ads_arr=[];
if(!Array.isArray(time_to_show_ads)){
time_to_show_ads_arr=[0];
}else{
var new_time_to_show_ads=[];
$.each(time_to_show_ads, function(i, value){
var new_val=$.trim(value);
if(_.isNumber(new_val)){
new_time_to_show_ads[i]=parseFloat(new_val);
}});
time_to_show_ads_arr =
($.grep(new_time_to_show_ads, function(n){
return n==0||n;
})).slice()
.sort(function(a,b){
return a > b;
})
.reduce(function(a,b){
if(a.slice(-1)[0]!==b) a.push(b);
return a;
},[]);
}
var va_google_ima_source='',
va_image_source='',
va_image_link='',
va_video_source='',
va_video_link='',
va_html_source='';
if(ads_opts.vid_ads_m_group_google_ima!=null&&Array.isArray(ads_opts.vid_ads_m_group_google_ima)&&typeof(ads_opts.vid_ads_m_group_google_ima[0])==='object'){
var adsIMARand='';
if(!_.getMobileOperatingSystem()){
if(typeof(ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source)!=='undefined'&&Array.isArray(ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source)&&ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source.length > 0){
adsIMARand=ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source[Math.floor(Math.random() * ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source.length)];
}}else{
if(window.innerWidth>767){
if(typeof(ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_tablet)!=='undefined'&&Array.isArray(ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_tablet)&&ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_tablet.length > 0){
adsIMARand=ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_tablet[Math.floor(Math.random() * ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_tablet.length)];
}}else{
if(typeof(ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_mobile)!=='undefined'&&Array.isArray(ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_mobile)&&ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_mobile.length > 0){
adsIMARand=ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_mobile[Math.floor(Math.random() * ads_opts.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_mobile.length)];
}}
}
va_google_ima_source=adsIMARand;
}
if(ads_opts.vid_ads_m_group_image!=null&&Array.isArray(ads_opts.vid_ads_m_group_image)&&ads_opts.vid_ads_m_group_image.length > 0){
var adsImageRand=ads_opts.vid_ads_m_group_image[Math.floor(Math.random() * ads_opts.vid_ads_m_group_image.length)],
adsImageSource=$.trim(adsImageRand.vid_ads_m_image_source),
adsImageLink=$.trim(adsImageRand.vid_ads_m_image_link);
if(typeof(adsImageSource)!=='undefined'&&adsImageSource!=''){
va_image_source=adsImageSource;
va_image_link=adsImageLink;
}}
if(ads_opts.vid_ads_m_group_html5_video!=null&&Array.isArray(ads_opts.vid_ads_m_group_html5_video)&&ads_opts.vid_ads_m_group_html5_video.length > 0){
var adsVideoRand=ads_opts.vid_ads_m_group_html5_video[Math.floor(Math.random() * ads_opts.vid_ads_m_group_html5_video.length)],
adsVideoSource=adsVideoRand.vid_ads_m_video_source,
adsVideoLink=$.trim(adsVideoRand.vid_ads_m_video_link);
if(typeof(adsVideoSource)==='object'){
va_video_source=adsVideoSource;
va_video_link=adsVideoLink;
}}
if(ads_opts.vid_ads_m_group_html!=null
&& Array.isArray(ads_opts.vid_ads_m_group_html)
&& typeof(ads_opts.vid_ads_m_group_html[0])==='object'
&& typeof(ads_opts.vid_ads_m_group_html[0].vid_ads_m_html_source)!=='undefined'
&& Array.isArray(ads_opts.vid_ads_m_group_html[0].vid_ads_m_html_source)
&& ads_opts.vid_ads_m_group_html[0].vid_ads_m_html_source.length > 0
){
var adsHTMLRand=ads_opts.vid_ads_m_group_html[0].vid_ads_m_html_source[Math.floor(Math.random() * ads_opts.vid_ads_m_group_html[0].vid_ads_m_html_source.length)];
va_html_source=adsHTMLRand;
}
if(global){
_.ads_enable=ads_enable;
_.ads_network=ads_network;
_.time_to_show_ads=time_to_show_ads_arr;
_.time_skip_ads=time_skip_ads;
_.time_to_hide_ads=time_to_hide_ads;
_.va_google_ima_source=va_google_ima_source;
_.va_image_source=va_image_source;
_.va_image_link=va_image_link;
_.va_video_source=va_video_source;
_.va_video_link=va_video_link;
_.va_html_source=va_html_source;
}else{
return {
'ads_enable': ads_enable,
'ads_network': ads_network,
'time_to_show_ads': time_to_show_ads,
'time_skip_ads': time_skip_ads,
'time_to_hide_ads': time_to_hide_ads,
'va_google_ima_source': va_google_ima_source,
'va_image_source': va_image_source,
'va_image_link': va_image_link,
'va_video_source': va_video_source,
'va_video_link': va_video_link,
'va_html_source': va_html_source,
};}}
vidorev_theme.prototype.init=function(){
var _=this;
scrollDir({
attribute: 'data-vp-scroll-direction'
});
_.mobile_menu_open();
_.mobile_menu_items();
_.fading_slide_control();
_.clone_nav();
_.top_search_dropdown();
_.blog_switch_view();
_.ajax_load_post();
_.ajax_infinite_scroll();
_.single_slider();
_.video_light_off();
_.video_share_toolbar();
_.create_single_video_player();
_.close_video_player_floating();
_.auto_next_control();
_.open_lightbox_video();
_.close_lightbox_video();
_.add_scroll_bar_for_playlist();
_.watch_later();
_.archive_sort_button();
_.scroll_control();
_.alphabet_filter_action();
_.sticky_menu();
_.sticky_sidebar();
_.popular_slider();
_.megamenu_control();
_.open_lightbox_image();
_.video_repeat();
_.amazon_product_link_action();
_.download_lightbox();
_.window_load();
_.window_resize();
_.window_scroll();
_.document_control();
_.$el.trigger(prefix+'init', []);
}
vidorev_theme.prototype.window_load=function(){
var _=this;
$(window).on('load', function(){
});
}
vidorev_theme.prototype.window_resize=function(){
var _=this,
default_width=window.innerWidth;
$(window).on('resize', function(){
if(default_width===window.innerWidth){
return;
}
default_width=window.innerWidth;
});
}
vidorev_theme.prototype.window_scroll=function(){
var _=this;
$(window).on('scroll', function(){
_.sticky_menu();
_.ajax_infinite_scroll();
_.video_player_floating();
_.scroll_to_top_button();
});
}
vidorev_theme.prototype.document_control=function(){
var _=this;
$(document).on('click', function(e){
});
}
vidorev_theme.prototype.scroll_to_top_button=function(){
var _=this;
var $scroll_to_top_button=$('.scroll-to-top-button-control');
if($scroll_to_top_button.length===0){
return;
}
if(document.body.scrollTop > window.innerHeight||document.documentElement.scrollTop > window.innerHeight){
$scroll_to_top_button.addClass('active-item').find('a').on('click.scrollToTop', function(){
$('html, body').stop().animate({scrollTop:0}, {duration:500}, function(){});
return false;
});
}else{
$scroll_to_top_button.removeClass('active-item').find('a').off('.scrollToTop');
}}
vidorev_theme.prototype.megamenu_control=function(){
var _=this;
_.$el.off('.megamenuControl').on('hover.megamenuControl', '.megamenu-item-control', function(e){
var $t=$(this),
$parent=$t.parents('.megamenu-wrapper-control');
$parent.find('.megamenu-item-control').addClass('hidden-item').removeClass('active-item');
$t.addClass('active-item').removeClass('hidden-item');
var attrID=$.trim($t.attr('data-id'));
if(typeof(attrID)!=='undefined'&&attrID!=''){
$parent.find('.blog-wrapper-control').addClass('hidden-item').removeClass('active-item');
$parent.find('.blog-wrapper-control[data-id="'+(attrID)+'"]').addClass('active-item').removeClass('hidden-item');
}})
}
vidorev_theme.prototype.mobile_menu_open=function(){
var _=this;
_.$el.off('.mobileMenuOpen').on('click.mobileMenuOpen', '.button-menu-mobile-control', function(e){
_.$el.toggleClass('active-mobile-menu');
})
}
vidorev_theme.prototype.mobile_menu_items=function(){
var _=this;
_.$el.find('.vp-mobile-menu-items-control > ul > li.menu-item-has-children').each(function(index, element){
var $t=$(this),
btn_control_class='open-submenu-'+(index);
$t.append('').find('.'+(btn_control_class)).on('click', function(){
$t.toggleClass('active-sub-menu').children('ul').slideToggle({duration:368});
});
});
}
vidorev_theme.prototype.fading_slide_control=function(){
var _=this;
$('.fading-slide-control', _.$el).each(function(index, element){
var $t=$(this);
if($t.find('li').length<2){
return;
}
if($t.find('.active-item').length===0){
$t.find('li:first-child').addClass('active-item');
}
setInterval(function(){
var $next_item=$t.find('.active-item').next('li');
if($next_item.length===0){
$next_item=$t.find('li:first-child');
}
$t.find('.active-item').removeClass('active-item').css({'display':'none'});
$next_item.addClass('active-item').fadeIn('slow');
}, 5000);
});
}
vidorev_theme.prototype.clone_nav=function(){
var _=this;
if(!_.sticky_menu_on||$('.main-nav-control', _.$el).length===0){
return;
}
$('.main-nav-control', _.$el).clone(true).addClass('sticky-menu-control sticky-menu').insertAfter('#site-header');
}
vidorev_theme.prototype.sticky_menu=function(){
var _=this;
var $nav_wrap_control=$('.nav-wrap-control', _.$el),
$sticky_menu_control=$('.sticky-menu-control', _.$el);
if(!_.sticky_menu_on||$sticky_menu_control.length===0){
return;
}
if(_.sticky_behavior==='down'){
if($(window).scrollTop() > $nav_wrap_control.offset().top+$nav_wrap_control.height()+10&&!$sticky_menu_control.hasClass('active-item')){
$sticky_menu_control.addClass('active-item setTransit');
_.$el.trigger(prefix+'stickyMenuShow', [_]);
}else if($(window).scrollTop() <=$nav_wrap_control.offset().top&&$sticky_menu_control.hasClass('active-item')){
$sticky_menu_control.removeClass('active-item setTransit').find('a.top-search-dropdown-control').removeClass('active-item');
_.$el.trigger(prefix+'stickyMenuHide', [_]);
}
return;
}
if(window.global_up_down_scroll==='up'){
if($(window).scrollTop() > $nav_wrap_control.offset().top+$nav_wrap_control.height()+10&&!$sticky_menu_control.hasClass('active-item')){
$sticky_menu_control.addClass('active-item setTransit');
_.$el.trigger(prefix+'stickyMenuShow', [_]);
}else if($(window).scrollTop() <=$nav_wrap_control.offset().top&&$sticky_menu_control.hasClass('active-item')){
$sticky_menu_control.removeClass('active-item setTransit').find('a.top-search-dropdown-control').removeClass('active-item');
_.$el.trigger(prefix+'stickyMenuHide', [_]);
}}else if(window.global_up_down_scroll==='down'){
$sticky_menu_control.removeClass('active-item');
_.$el.trigger(prefix+'stickyMenuHide', [_]);
}}
vidorev_theme.prototype.top_search_dropdown=function(){
var _=this;
_.$el.off('.topSearchDropdown').on('click.topSearchDropdown', 'a.top-search-dropdown-control', function(e){
_.$el.trigger(prefix+'topSearchDropdownBefore', [_]);
var $t=$(this),
$textfield=$t.parents('.top-search-elm-control').find('.search-terms-textfield-control');
$t.toggleClass('active-item');
if($t.hasClass('active-item')){
setTimeout(function(){
$textfield.focus();
}, 200);
$textfield.focus();
}
_.$el.trigger(prefix+'topSearchDropdownAfter', [_]);
return false;
});
}
vidorev_theme.prototype.blog_switch_view=function(){
var _=this;
_.$el.off('.blogSwitchView').on('click.blogSwitchView', '.switch-control', function(e){
var $t=$(this),
$blog_items=_.$el.find('.blog-items-control');
var $parent=$t.parents('.series-heading-control');
if($parent.length > 0&&$parent.next('.blog-items-control').length > 0){
$blog_items=$parent.next('.blog-items-control');
}
if($blog_items.length > 0&&($blog_items.hasClass('grid-default')||$blog_items.hasClass('list-default'))){
if($parent.length > 0){
$parent.find('.switch-control').removeClass('active-item');
}else{
$('.switch-control').removeClass('active-item');
}
$t.addClass('active-item');
if($t.hasClass('grid-icon')){
$blog_items.addClass('grid-default').removeClass('list-default');
}else if($t.hasClass('list-icon')){
$blog_items.addClass('list-default').removeClass('grid-default');
}}
});
}
vidorev_theme.prototype.ajax_post_action=function($t){
var _=this;
if(_.global_blog_page===-1||!_.global_blog_ajax_load){
$t.blur();
return false;
}
_.global_blog_ajax_load=false;
var template=$t.attr('data-template'),
style=$t.attr('data-style'),
$parent=$t.parents('.blog-wrapper-control'),
$apply_html=$parent.find('.blog-items-control'),
data={
'action': 'blog_ajax_load_post',
'blog_page': _.global_blog_page,
'template': template,
'query_vars': vidorev_jav_js_object.query_vars,
'style': style,
'archive_query':(typeof(vidorev_jav_js_object.archive_query)!=='undefined')?vidorev_jav_js_object.archive_query:'',
'alphabet_filter':(typeof(vidorev_jav_js_object.alphabet_filter)!=='undefined')?vidorev_jav_js_object.alphabet_filter:'',
'theme_image_ratio':(typeof(vidorev_jav_js_object.theme_image_ratio)!=='undefined')?vidorev_jav_js_object.theme_image_ratio:'',
'security': (typeof(vidorev_jav_js_object.security)!=='undefined')?vidorev_jav_js_object.security:'',
};
$t.addClass('ajax-loading active-item');
$.ajax({
type: 'POST',
url: vidorev_jav_js_object.admin_ajax,
cache: false,
data: data,
dataType: 'html',
success: function(data, textStatus, jqXHR){
if(data!=''){
$apply_html.append(data);
_.global_blog_page=_.global_blog_page + 1;
if(typeof(vidorev_builder_control)!=="undefined"&&vidorev_builder_control!==null){
vidorev_builder_control.imdb_rating_jsonp();
}
if(typeof(window.vidorev_visible_image_opacity)!=='undefined'){
window.vidorev_visible_image_opacity();
}
if($apply_html.find('.blog-last-page-control').length>0){
$parent.find('.blog-last-page-control').remove();
$parent.find('.blog-pagination-control').remove();
}
_.$el.trigger('ajaxloadpostcomplete_themeControl', [_]);
}else{
_.global_blog_page=-1;
}
_.global_blog_ajax_load=true;
$t.removeClass('ajax-loading active-item').blur();
},
error: function(jqXHR, textStatus, errorThrown){
_.global_blog_ajax_load=true;
$t.removeClass('ajax-loading active-item').blur();
}});
}
vidorev_theme.prototype.ajax_load_post=function(){
var _=this;
_.$el.off('.ajaxLoadPost').on('click.ajaxLoadPost', 'a.loadmore-btn-control', function(e){
var $t=$(this);
_.ajax_post_action($t);
return false;
});
}
vidorev_theme.prototype.ajax_infinite_scroll=function(){
var _=this;
var $infinite=_.$el.find('.infinite-scroll-control');
if($infinite.length===0){
return;
}
$infinite.each(function(index, element){
var $t=$(this),
ajaxVisible=$t.offset().top,
ajaxScrollTop=$(window).scrollTop()+$(window).height();
if(ajaxVisible <=(ajaxScrollTop)&&(ajaxVisible + $(window).height()) > ajaxScrollTop){
_.ajax_post_action($t);
};});
}
vidorev_theme.prototype.single_slider=function(){
var _=this;
_.$el.find('.is-single-slider').each(function(index, element){
var $t=$(this),
$parent_wg=$t.parents('.vidorev-post-extensions');
var options={
arrows:true,
dots: true,
infinite: true,
speed: 500,
slidesToShow: 1,
adaptiveHeight: true,
focusOnSelect: false,
prevArrow: '',
nextArrow: '',
};
if($t.hasClass('effect-fade')){
options['fade']=true;
}
$t.on('init', function(event, slick){
if($parent_wg.length > 0){
var $arrow_prev=$parent_wg.find('.widget-arrow-prev-control');
var $arrow_next=$parent_wg.find('.widget-arrow-next-control');
$arrow_prev.on('click', function(){
slick.slickPrev();
});
$arrow_next.on('click', function(){
slick.slickNext();
});
}});
$t.find('img.ul-normal-effect').addClass('img-effect-setup img-loaded');
$t.slick(options);
});
}
vidorev_theme.prototype.video_light_off=function(){
var _=this;
_.$el.off('.videoLightOffBTN').on('click.videoLightOffBTN', '.turn-off-light-control', function(e){
var $t=$(this);
$t.toggleClass('active-item');
_.$el.toggleClass('light-off-enabled');
});
}
vidorev_theme.prototype.video_share_toolbar=function(){
var _=this;
_.$el.off('.videoShareToolbar').on('click.videoShareToolbar', '.share-control', function(e){
var $t=$(this);
$t.toggleClass('active-item');
_.$el.find('.social-share-toolbar-control').toggleClass('active-item');
});
}
vidorev_theme.prototype.alphabet_filter_action=function(){
var _=this;
_.$el.off('.alphabetFilterAction').on('click.alphabetFilterAction', '.alphabet-filter-control', function(e){
_.$el.toggleClass('active-alphabet-filter');
});
}
vidorev_theme.prototype.getMobileOperatingSystem=function(){
return navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/);
}
vidorev_theme.prototype.setYoutubeAPIReady=function(vid_id){
var _=this,
prefix_vid_id='';
if(typeof(vid_id)!=='undefined'){
prefix_vid_id=vid_id;
}
setTimeout(function(){
if($('script[src*="youtube.com/iframe_api"]').length>0||$('script[src*="www-widgetapi.js"]').length>0){
var triggerInterval=setInterval(function(){
if(typeof(YT)!=='undefined'&&typeof(YT.Player)!=='undefined'){
$(document).trigger(prefix+'youtubeAPIReady'+(prefix_vid_id), []);
clearInterval(triggerInterval);
}},368);
}else{
var you_API_YTdeferred=$.Deferred();
window.onYouTubeIframeAPIReady=function(){
you_API_YTdeferred.resolve(window.YT);
}
var tag=document.createElement('script');
tag.src="https://www.youtube.com/iframe_api";
var firstScriptTag=document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
you_API_YTdeferred.done(function(YT){
$(document).trigger(prefix+'youtubeAPIReady'+(prefix_vid_id), []);
});
}},368);
}
vidorev_theme.prototype.create_single_video_player=function(player_id, obj){
var _=this;
if(typeof(obj)!=='undefined'){
var player_obj=obj,
autoplay='off',
lightbox_cf=true;
}else{
if(typeof(vidorev_jav_js_object)!=='undefined'&&typeof(vidorev_jav_js_object.single_video_network)!=='undefined'&&typeof(vidorev_jav_js_object.single_video_source)!=='undefined'&&typeof(vidorev_jav_js_object.single_video_url)!=='undefined'&&typeof(vidorev_jav_js_object.single_video_network_library_setup)!=='undefined'){
var player_obj=vidorev_jav_js_object,
autoplay=_.global_video_autoplay;
}else{
return '';
}}
if(typeof(player_obj)!=='undefined'&&typeof(player_obj.single_video_network)!=='undefined'&&typeof(player_obj.single_video_source)!=='undefined'&&typeof(player_obj.single_video_url)!=='undefined'){
var single_video_network=player_obj.single_video_network,
single_video_source=player_obj.single_video_source,
single_video_url=player_obj.single_video_url;
if(typeof(player_id)==='undefined'||player_id===null){
player_id='player-api-control'
}
if($('#'+(player_id)).length===0){
return '';
}
var $partyElm=$('#'+(player_id)).parents('.player-3rdparty-control'),
player_init_id=(player_id)+'-init',
$player=null,
options={},
video_duration='',
video_current_time='',
first_create=true,
$poster_preload=$partyElm.find('.autoplay-off-elm-control'),
$playerMutedControl=$partyElm.find('.player-muted-control'),
poster_background=$poster_preload.attr('data-background-url');
if(typeof(player_obj.membership)&&$.trim(player_obj.membership)!=''&&lightbox_cf==true){
$('#'+(player_id)).html(player_obj.membership);
$partyElm.addClass('player-loaded');
return '';
}
var ads_enable=_.ads_enable,
ads_network=_.ads_network,
time_to_show_ads=_.time_to_show_ads,
time_skip_ads=_.time_skip_ads,
time_to_hide_ads=_.time_to_hide_ads,
va_google_ima_source=_.va_google_ima_source,
va_image_source=_.va_image_source,
va_image_link=_.va_image_link,
va_video_source=_.va_video_source,
va_video_link=_.va_video_link,
va_html_source=_.va_html_source;
if(typeof(player_obj.vidorev_jav_plugin_video_ads_object_post)==='object'){
if(typeof(player_obj.vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads_type)!=='undefined'&&$.trim(player_obj.vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads_type)!=''){
var new_ads_opts=$.extend({}, _.default_ads_otps, player_obj.vidorev_jav_plugin_video_ads_object_post);
var new_ads_params=_.get_ads_params(new_ads_opts, false);
ads_network=new_ads_params.ads_network;
time_to_show_ads=new_ads_params.time_to_show_ads;
time_skip_ads=new_ads_params.time_skip_ads;
time_to_hide_ads=new_ads_params.time_to_hide_ads;
va_google_ima_source=new_ads_params.va_google_ima_source;
va_image_source=new_ads_params.va_image_source;
va_image_link=new_ads_params.va_image_link;
va_video_source=new_ads_params.va_video_source;
va_video_link=new_ads_params.va_video_link;
va_html_source=new_ads_params.va_html_source;
}
if(typeof(player_obj.vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads)!=='undefined'&&$.trim(player_obj.vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads)!=''){
ads_enable=player_obj.vidorev_jav_plugin_video_ads_object_post.vid_ads_m_video_ads;
}}
var ads_object={
'ads_enable': ads_enable,
'ads_network': ads_network,
'time_to_show_ads': time_to_show_ads,
'time_skip_ads': time_skip_ads,
'time_to_hide_ads': time_to_hide_ads,
'va_google_ima_source': va_google_ima_source,
'va_image_source': va_image_source,
'va_image_link': va_image_link,
'va_video_source': va_video_source,
'va_video_link': va_video_link,
'va_html_source': va_html_source,
}
var $lib_item_control=$('#'+(player_id)).parents('.lib-item-control');
if(typeof(player_obj.player_library)!=='undefined'&&player_obj.player_library!='vp'){
switch(player_obj.player_library){
case 'jw':
if(typeof(jwplayer)!=='undefined'){
if(typeof(vidorev_jav_js_object.jwplayer_licence_key)!=='undefined'&&vidorev_jav_js_object.jwplayer_licence_key!=''){
jwplayer.key=vidorev_jav_js_object.jwplayer_licence_key;
}
var jw_pos_img=$partyElm.find('img.poster-preload').attr('src');
if(typeof(jw_pos_img)==='undefined'){
jw_pos_img='';
}
options={
'file': single_video_url,
'image': jw_pos_img,
}
if(typeof(player_obj.single_media_sources)!=='undefined'&&Array.isArray(player_obj.single_media_sources)){
var array_sources=[];
$.each(player_obj.single_media_sources, function(i, value){
if(typeof(value)==='object'){
if(typeof(value.source_file)!=='undefined'&&$.trim(value.source_file)!=''){
array_sources[i]={};
array_sources[i].file=$.trim(value.source_file);
if(typeof(value.source_label)!=='undefined'&&$.trim(value.source_label)!=''){
array_sources[i].label=$.trim(value.source_label);
}}
}});
}
if(typeof(array_sources)!=='undefined'&&Array.isArray(array_sources)&&array_sources.length>0){
options.sources=array_sources;
}
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
options.advertising={
'client': 'googima',
'tag': va_google_ima_source,
'skipoffset': 5,
}}
$player=jwplayer(player_id).setup(options);
$player.on('ready', function(){
if(_.global_muted_video){
$player.setMute(true);
}
$player.on('play', function(e){
_.global_player_playing[player_id]=true;
if(typeof($player.getMute())!=='undefined'&&$player.getMute()&&first_create){
$playerMutedControl.addClass('active-item').on('click', function(){
$player.setMute(false);
$(this).removeClass('active-item');
});
}
first_create=false;
});
setTimeout(function(){
$partyElm.addClass('player-loaded');
if(autoplay==='on'&&($lib_item_control.length===0&&!$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.play();
}else{
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}
$player.vidorev_partyLibrary='jw';
$('#'+(player_init_id)).trigger(prefix+'videoCreateFinish', [$player]);
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}}, 368);
$player.on('complete', function(e){
$playerMutedControl.removeClass('active-item');
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
});
});
$player.on('setupError', function(){
$partyElm.addClass('player-loaded');
});
return '';
}else{
$('#'+(player_id)).prepend('You need to declare the library for JWPlayer. Please refer to the documentation.
');
$partyElm.addClass('player-loaded');
}
break;
case 'videojs':
if(typeof(lightbox_cf)==='undefined'){
return '';
}
break;
case 'flow':
if(typeof(lightbox_cf)==='undefined'){
return '';
}
break;
}}
switch(single_video_network){
case 'youtube':
options={
enablejsapi: 1,
html5: 1,
wmode: 'transparent',
modestbranding: _.you_modestbranding,
iv_load_policy: 3,
autoplay: 0,
playsinline: 1,
rel: _.you_rel,
showinfo: _.you_showinfo,
}
if(typeof(player_obj.single_video_youtube_playlist_id)!=='undefined'&&player_obj.single_video_youtube_playlist_id!=''){
options.list=$.trim(player_obj.single_video_youtube_playlist_id);
options.listType='playlist';
}
$(document).on(prefix+'youtubeAPIReady'+(player_id), function(){
var intervalYoutube=null;
$player=new YT.Player(player_id, {
videoId: single_video_source,
playerVars: options,
events: {
'onReady': function(e){
$('#'+(player_id)).attr({'wmode':'Opaque'});
if(_.global_muted_video){
$player.mute();
}
setTimeout(function(){
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
_.ads_google_ima({
'player': $player,
'player_id': player_id,
'player_init_id': player_init_id,
'partyElm': $partyElm,
'fake_player': _.fake_player({
'player': $player,
'single_video_network': single_video_network,
}),
'autoplay': autoplay,
'va_google_ima_source': va_google_ima_source,
});
}else{
$partyElm.addClass('player-loaded');
if(autoplay==='on'&&($lib_item_control.length===0&&!$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.playVideo();
}else{
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.playVideo();
$(this).removeClass('active-item');
});
}
$('#'+(player_init_id)).trigger(prefix+'videoCreateFinish', [$player]);
}
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}}, 368);
},
'onStateChange':function(e){
if(e.data===1){
_.global_player_playing[player_id]=true;
}
if(e.target.isMuted()&&first_create){
$playerMutedControl.addClass('active-item').on('click', function(){
e.target.unMute();
$(this).removeClass('active-item');
});
}
first_create=false;
if(ads_enable&&e.data==YT.PlayerState.PLAYING&&ads_network!='google_ima'){
if(intervalYoutube!==null){
clearInterval(intervalYoutube);
}
intervalYoutube=setInterval(function(){
video_duration=$player.getDuration();
if(video_duration===0){
return;
}
video_current_time=$player.getCurrentTime();
_.video_ads({
'player': $player,
'single_video_network': single_video_network,
'video_duration': video_duration,
'video_current_time': video_current_time,
'player_id': player_id,
'partyElm': $partyElm,
'ads_object': ads_object,
});
}, 250);
}else{
if(intervalYoutube!==null){
clearInterval(intervalYoutube);
}}
if(e.data===0){
$playerMutedControl.removeClass('active-item');
_.reset_ads(player_id);
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
e.target.stopVideo();
}}
},
});
});
_.setYoutubeAPIReady(player_id);
break;
case 'vimeo':
options={
id: single_video_source,
autoplay: 0,
playsinline: true,
}
$player=new Vimeo.Player(player_id, options);
$player.ready().then(function(){
$('#'+(player_id)).find('iframe').attr('allow', 'autoplay; encrypted-media');
if(_.global_muted_video||_.global_video_network_mute_for_autoplay){
$player.setVolume(0);
}
$player.on('play', function(e){
_.global_player_playing[player_id]=true;
$player.getVolume().then(function(volume){
if(volume===0){
$playerMutedControl.addClass('active-item').on('click', function(){
$player.setVolume(1);
$(this).removeClass('active-item');
});
}}).catch(function(error){});
first_create=false;
});
if(ads_enable&&ads_network!='google_ima'){
$player.on('timeupdate', function(e){
Promise.all([$player.getDuration(), $player.getCurrentTime()]).then(function(dimensions){
video_duration=dimensions[0];
if(video_duration===0){
return;
}
video_current_time=dimensions[1];
_.video_ads({
'player': $player,
'single_video_network': single_video_network,
'video_duration': video_duration,
'video_current_time': video_current_time,
'player_id': player_id,
'partyElm': $partyElm,
'ads_object': ads_object,
});
});
});
}
setTimeout(function(){
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
_.ads_google_ima({
'player': $player,
'player_id': player_id,
'player_init_id': player_init_id,
'partyElm': $partyElm,
'fake_player': _.fake_player({
'player': $player,
'single_video_network': single_video_network,
}),
'autoplay': autoplay,
'va_google_ima_source': va_google_ima_source,
});
}else{
$partyElm.addClass('player-loaded');
if(autoplay==='on'&&($lib_item_control.length===0&&!$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.play();
}else{
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}
$('#'+(player_init_id)).trigger(prefix+'videoCreateFinish', [$player]);
}
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}}, 368);
$player.on('ended', function(e){
$playerMutedControl.removeClass('active-item');
_.reset_ads(player_id);
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
});
});
break;
case 'dailymotion':
options={
video: single_video_source,
params: {
'endscreen-enable': false,
autoplay: false,
'sharing-enable': false,
'ui-logo': false,
}}
$player=DM.player(document.getElementById(player_id), options);
$player.addEventListener('apiready', function(e){
if(_.global_muted_video){
$player.setMuted(true);
}
$player.addEventListener('play', function(e){
_.global_player_playing[player_id]=true;
if(typeof($player.muted)!=='undefined'&&$player.muted&&first_create){
$playerMutedControl.addClass('active-item').on('click', function(){
$player.toggleMuted();
$(this).removeClass('active-item');
});
}
first_create=false;
});
if(ads_enable&&ads_network!='google_ima'){
$player.addEventListener('timeupdate', function(e){
video_duration=$player.duration;
if(video_duration===0){
return;
}
video_current_time=$player.currentTime;
_.video_ads({
'player': $player,
'single_video_network': single_video_network,
'video_duration': video_duration,
'video_current_time': video_current_time,
'player_id': player_id,
'partyElm': $partyElm,
'ads_object': ads_object,
});
});
}
setTimeout(function(){
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
_.ads_google_ima({
'player': $player,
'player_id': player_id,
'player_init_id': player_init_id,
'partyElm': $partyElm,
'fake_player': _.fake_player({
'player': $player,
'single_video_network': single_video_network,
}),
'autoplay': autoplay,
'va_google_ima_source': va_google_ima_source,
});
}else{
$partyElm.addClass('player-loaded');
if(autoplay==='on'&&($lib_item_control.length===0&&!$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.play();
}else{
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}
$('#'+(player_init_id)).trigger(prefix+'videoCreateFinish', [$player]);
}
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}}, 368);
$player.addEventListener('ended', function(e){
$playerMutedControl.removeClass('active-item');
_.reset_ads(player_id);
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
});
});
break;
case 'facebook':
$('#'+(player_id)).addClass('fb-video').attr({'data-href':single_video_url, 'data-allowfullscreen':'true', 'data-width':'2560', 'data-height':'1440'});
FB.Event.subscribe('xfbml.ready', function(msg){
if(msg.type==='video'&&msg.id===player_id){
$player=msg.instance;
$('#'+(player_id)).find('iframe').attr('allow', 'autoplay; encrypted-media');
if(_.global_muted_video||_.global_video_network_mute_for_autoplay){
$player.mute();
}else{
$player.unmute();
}
var intervalFacebook=null;
$player.subscribe('startedPlaying', function(e){
_.global_player_playing[player_id]=true;
if($player.isMuted()&&first_create){
$playerMutedControl.addClass('active-item').on('click', function(){
$player.unmute();
$(this).removeClass('active-item');
$player.play();
});
}
first_create=false;
if(ads_enable&&ads_network!='google_ima'){
if(intervalFacebook!==null){
clearInterval(intervalFacebook);
}
intervalFacebook=setInterval(function(){
video_duration=$player.getDuration();
if(video_duration===0){
return;
}
video_current_time=$player.getCurrentPosition();
_.video_ads({
'player': $player,
'single_video_network': single_video_network,
'video_duration': video_duration,
'video_current_time': video_current_time,
'player_id': player_id,
'partyElm': $partyElm,
'ads_object': ads_object,
});
}, 250);
}
});
$player.subscribe('paused', function(e){
if(ads_enable&&intervalFacebook!==null){
clearInterval(intervalFacebook);
}});
$player.subscribe('finishedPlaying', function(e){
$playerMutedControl.removeClass('active-item');
if(ads_enable){
_.reset_ads(player_id);
if(intervalFacebook!==null){
clearInterval(intervalFacebook);
}}
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
});
$player.subscribe('error', function(e){
if(ads_enable){
_.reset_ads(player_id);
if(intervalFacebook!==null){
clearInterval(intervalFacebook);
}}
});
setTimeout(function(){
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
_.ads_google_ima({
'player': $player,
'player_id': player_id,
'player_init_id': player_init_id,
'partyElm': $partyElm,
'fake_player': _.fake_player({
'player': $player,
'single_video_network': single_video_network,
}),
'autoplay': autoplay,
'va_google_ima_source': va_google_ima_source,
});
}else{
$partyElm.addClass('player-loaded');
if(autoplay==='on'&&($lib_item_control.length===0&&!$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.play();
}else{
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}
$('#'+(player_init_id)).trigger(prefix+'videoCreateFinish', [$player]);
}
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}}, 368);
}});
if($('#parse-lightbox-control').length>0){
FB.XFBML.parse(document.getElementById('parse-lightbox-control'));
}
break;
case 'twitch':
options={
video: single_video_source,
autoplay: _.global_video_autoplay==='on' ? true:false,
playsinline: true,
muted: _.global_muted_video,
}
if(single_video_source.indexOf('channel...?><[~|~]')!==-1){
options={
channel: single_video_source.split('channel...?><[~|~]')[1],
autoplay: _.global_video_autoplay==='on' ? true:false,
playsinline: true,
muted: _.global_muted_video,
}}
$player=new Twitch.Player(player_id, options);
$player.addEventListener(Twitch.Player.READY, function(e){
var intervalTwitch=null;
$player.addEventListener(Twitch.Player.PLAY, function(e){
if((first_create&&$lib_item_control.length > 0&&!$lib_item_control.hasClass('show-video'))||($lib_item_control.length===0&&$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.pause();
$player.seek(0);
$player.pause();
}
_.global_player_playing[player_id]=true;
if($player.getMuted()&&first_create){
$playerMutedControl.addClass('active-item').on('click', function(){
$player.setMuted(false);
$(this).removeClass('active-item');
});
}
first_create=false;
if(ads_enable&&ads_network!='google_ima'){
if(intervalTwitch!==null){
clearInterval(intervalTwitch);
}
intervalTwitch=setInterval(function(){
video_duration=$player.getDuration();
if(video_duration===0){
return;
}
video_current_time=$player.getCurrentTime();
_.video_ads({
'player': $player,
'single_video_network': single_video_network,
'video_duration': video_duration,
'video_current_time': video_current_time,
'player_id': player_id,
'partyElm': $partyElm,
'ads_object': ads_object,
});
}, 250);
}
});
$player.addEventListener(Twitch.Player.PAUSE, function(e){
if(intervalTwitch!==null){
clearInterval(intervalTwitch);
}});
setTimeout(function(){
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
_.ads_google_ima({
'player': $player,
'player_id': player_id,
'player_init_id': player_init_id,
'partyElm': $partyElm,
'fake_player': _.fake_player({
'player': $player,
'single_video_network': single_video_network,
}),
'autoplay': autoplay,
'va_google_ima_source': va_google_ima_source,
});
}else{
$partyElm.addClass('player-loaded');
if(autoplay!='on'){
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}
$('#'+(player_init_id)).trigger(prefix+'videoCreateFinish', [$player]);
}
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}}, 368);
$player.addEventListener(Twitch.Player.ENDED, function(e){
$playerMutedControl.removeClass('active-item');
_.reset_ads(player_id);
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
$player.pause();
$player.seek(0);
$player.pause();
});
});
break;
case 'self-hosted': case 'drive':
var $selfHostedVideo=$partyElm.find('video.wp-video-shortcode');
if($selfHostedVideo.length > 0){
$selfHostedVideo.attr({'playsinline': '', 'webkit-playsinline': '',});
var selfHostedVideoID=$.trim($selfHostedVideo.attr('id'));
if(selfHostedVideoID!=''){
$player=document.getElementById(selfHostedVideoID);
$player.muted=_.global_muted_video;
$player.addEventListener('loadedmetadata', function(){
if($($player).hasClass('selfHosted-ready-load')){
return;
}
$($player).addClass('selfHosted-ready-load');
$player.addEventListener('playing', function(){
_.global_player_playing[player_id]=true;
if($player.muted&&first_create){
$playerMutedControl.addClass('active-item').on('click', function(){
$player.muted=false;
$player.volume=1;
$(this).removeClass('active-item');
});
}
first_create=false;
});
if(ads_enable&&ads_network!='google_ima'){
$player.addEventListener('timeupdate', function(){
video_duration=$player.duration;
if(video_duration===0){
return;
}
video_current_time=$player.currentTime;
_.video_ads({
'player': $player,
'single_video_network': single_video_network,
'video_duration': video_duration,
'video_current_time': video_current_time,
'player_id': player_id,
'partyElm': $partyElm,
'ads_object': ads_object,
});
});
}
setTimeout(function(){
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
_.ads_google_ima({
'player': $player,
'player_id': player_id,
'player_init_id': player_init_id,
'partyElm': $partyElm,
'fake_player': _.fake_player({
'player': $player,
'single_video_network': single_video_network,
}),
'autoplay': autoplay,
'va_google_ima_source': va_google_ima_source,
});
}else{
$partyElm.addClass('player-loaded');
if(autoplay==='on'&&($lib_item_control.length===0&&!$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.play();
}else{
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}}
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}}, 368);
$player.addEventListener('ended', function(){
$playerMutedControl.removeClass('active-item');
_.reset_ads(player_id);
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
});
});
return;
}}
var $vidorev_video_shortcode=$partyElm.find('video.vidorev-video-shortcode')
if((typeof(player_obj.single_video_wp_shortcode)==='undefined'&&$vidorev_video_shortcode.length===0)||typeof(mejs)==='undefined'){
return;
}
if(typeof(player_obj.single_video_wp_shortcode)!=='undefined'){
$('#'+(player_id)).append((player_obj.single_video_wp_shortcode).replace('id="video-0-1"', 'id="wpsc-'+(player_id)+'"'));
}
if($vidorev_video_shortcode.length > 0){
$vidorev_video_shortcode.addClass('wp-video-shortcode');
}
$('#'+(player_id)).find('video.wp-video-shortcode').attr({'playsinline': '', 'webkit-playsinline': '',}).mediaelementplayer({
success: function(player, node){
$player=node;
if($(player).find('video').length > 1){
var $selfHostedLGBVideo=$(player).find('video.wp-video-shortcode');
$selfHostedLGBVideo.attr({'playsinline': '', 'webkit-playsinline': '',});
var selfHostedLGBVideoID=$.trim($selfHostedLGBVideo.attr('id'));
$player=document.getElementById(selfHostedLGBVideoID);
}
if($($player).hasClass('selfHosted-ready-load')){
return;
}
$player.muted=_.global_muted_video;
$($player).addClass('selfHosted-ready-load');
$player.addEventListener('playing', function(){
_.global_player_playing[player_id]=true;
if($player.muted&&first_create){
$playerMutedControl.addClass('active-item').on('click', function(){
$player.muted=false;
$player.volume=1;
$(this).removeClass('active-item');
});
}
first_create=false;
});
if(ads_enable&&ads_network!='google_ima'){
$player.addEventListener('timeupdate', function(){
video_duration=$player.duration;
if(video_duration===0){
return;
}
video_current_time=$player.currentTime;
_.video_ads({
'player': $player,
'single_video_network': single_video_network,
'video_duration': video_duration,
'video_current_time': video_current_time,
'player_id': player_id,
'partyElm': $partyElm,
'ads_object': ads_object,
});
});
}
setTimeout(function(){
if(ads_enable&&ads_network==='google_ima'&&va_google_ima_source!=''){
_.ads_google_ima({
'player': $player,
'player_id': player_id,
'player_init_id': player_init_id,
'partyElm': $partyElm,
'fake_player': _.fake_player({
'player': $player,
'single_video_network': single_video_network,
}),
'autoplay': autoplay,
'va_google_ima_source': va_google_ima_source,
});
}else{
$partyElm.addClass('player-loaded');
if($vidorev_video_shortcode.length > 0){
if(autoplay==='on'&&($lib_item_control.length===0&&!$('#parse-lightbox-control.video-lightbox-wrapper-control').hasClass('show-lightbox'))){
$player.play();
}else{
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}}else{
if(autoplay!='on'){
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
$player.play();
$(this).removeClass('active-item');
});
}
$('#'+(player_init_id)).trigger(prefix+'videoCreateFinish', [$player]);
}}
if(player_id==='player-api-control'){
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
_.player_actions($player, single_video_network, 'pause');
});
}},368);
$player.addEventListener('ended', function(){
$playerMutedControl.removeClass('active-item');
_.reset_ads(player_id);
_.auto_next_fnc({
'player': $player,
'partyElm': $partyElm,
'player_id': player_id,
'single_video_network': single_video_network,
});
});
}});
break;
case 'embeded-code':
if(typeof(player_obj.single_video_embed)==='undefined'){
return;
}
$('#'+(player_id)).append(player_obj.single_video_embed);
var $vidorev_custom_player=$('#'+(player_id)).find('.video-js');
if(player_obj.single_video_embed.indexOf('GDPlayer')!==-1&&typeof(videojs)==='function'&&$vidorev_custom_player.length > 0&&typeof($vidorev_custom_player.attr('id'))!=='undefined'){
videojs($vidorev_custom_player.attr('id'));
console.log('Vidorev: GD Player setup');
}else if(player_obj.single_video_embed.indexOf('videojs(')===-1&&player_obj.single_video_embed.indexOf('videojs (')===-1&&typeof(videojs)==='function'&&$vidorev_custom_player.length > 0&&typeof($vidorev_custom_player.attr('id'))!=='undefined'){
videojs($vidorev_custom_player.attr('id'));
console.log('Vidorev: video js setup');
}
$partyElm.addClass('player-loaded');
}}else{
return '';
}}
vidorev_theme.prototype.video_player_floating=function(){
var _=this;
var $vidPlayerWrapper=$('#video-player-wrap-control'),
floatingClass='floating-video';
if($vidPlayerWrapper.length===0||_.$el.hasClass('disable-floating-video')||!$vidPlayerWrapper.find('.player-3rdparty-control').hasClass('player-loaded')){
return;
}
var videoOffset=$vidPlayerWrapper.offset().top + $vidPlayerWrapper.outerHeight(true);
if($(window).scrollTop() > videoOffset+20){
if(_.$el.hasClass('floating-video')){
return;
}
_.$el.addClass('floating-video');
}else{
if(!_.$el.hasClass('floating-video')){
return;
}
_.$el.removeClass('floating-video');
}}
vidorev_theme.prototype.close_video_player_floating=function(){
var _=this;
_.$el.off('.scrollUpVideoPlayerFloating').on('click.scrollUpVideoPlayerFloating', 'a.scroll-up-floating-video-control', function(e){
$('html, body').animate({scrollTop:0}, {duration:500, complete: function(){}});
return false;
});
_.$el.off('.closeVideoPlayerFloating').on('click.closeVideoPlayerFloating', 'a.close-floating-video-control', function(e){
var $t=$(this);
_.$el.addClass('disable-floating-video');
return false;
});
}
vidorev_theme.prototype.auto_next_control=function(){
var _=this;
_.$el.off('.autoNextControl').on('click.autoNextControl', '.auto-next-control', function(e){
var $t=$(this),
$icon_control=$t.find('.auto-next-icon-control');
$icon_control.toggleClass('active-item');
if($icon_control.hasClass('active-item')){
Cookies.set('vpautonextvideo', 'true', { expires: 368 });
}else{
Cookies.set('vpautonextvideo', 'false', { expires: 368 });
}
_.global_video_auto_next=typeof(Cookies.get('vpautonextvideo'))!=='undefined'&&Cookies.get('vpautonextvideo')=='true';
return false;
});
_.auto_next_check();
}
vidorev_theme.prototype.auto_next_check=function(){
var _=this;
if(_.global_video_auto_next){
$('.auto-next-icon-control').addClass('active-item');
return true;
}
return false;
}
vidorev_theme.prototype.player_actions=function($player, single_video_network, action, setCurrentTime){
var _=this;
if(typeof($player)==='undefined'||typeof(single_video_network)==='undefined'){
return;
}
if(typeof($player.vidorev_partyLibrary)!=='undefined'){
switch($player.vidorev_partyLibrary){
case 'jw':
if(action==='play'){
$player.play();
}else if(action==='pause'){
$player.pause();
}else if(action==='seek'&&typeof(setCurrentTime)!=='undefined'&&_.isNumber(setCurrentTime)){
$player.seek(setCurrentTime);
}
return;
break;
}}
switch(single_video_network){
case 'youtube':
if(action==='play'){
$player.playVideo();
}else if(action==='pause'){
$player.pauseVideo();
}else if(action==='seek'&&typeof(setCurrentTime)!=='undefined'&&_.isNumber(setCurrentTime)){
$player.seekTo(setCurrentTime, false);
}
break;
case 'vimeo':
if(action==='play'){
$player.play();
}else if(action==='pause'){
$player.pause();
}else if(action==='seek'&&typeof(setCurrentTime)!=='undefined'&&_.isNumber(setCurrentTime)){
$player.setCurrentTime(setCurrentTime);
}
break;
case 'dailymotion':
if(action==='play'){
$player.play();
}else if(action==='pause'){
$player.pause();
}else if(action==='seek'&&typeof(setCurrentTime)!=='undefined'&&_.isNumber(setCurrentTime)){
$player.seek(setCurrentTime);
}
break;
case 'facebook':
if(action==='play'){
$player.play();
}else if(action==='pause'){
$player.pause();
}else if(action==='seek'&&typeof(setCurrentTime)!=='undefined'&&_.isNumber(setCurrentTime)){
$player.seek(setCurrentTime);
}
break;
case 'twitch':
if(action==='play'){
$player.play();
}else if(action==='pause'){
$player.pause();
}else if(action==='seek'&&typeof(setCurrentTime)!=='undefined'&&_.isNumber(setCurrentTime)){
$player.seek(setCurrentTime);
}
break;
case 'self-hosted': case 'drive':
if(action==='play'){
$player.play();
}else if(action==='pause'){
$player.pause();
}else if(action==='seek'&&typeof(setCurrentTime)!=='undefined'&&_.isNumber(setCurrentTime)){
$player.currentTime=setCurrentTime;
}
break;
}}
vidorev_theme.prototype.isNumber=function(n){
var _=this;
return !isNaN(parseFloat(n))&&isFinite(n);
}
vidorev_theme.prototype.nFormatter=function(num, digits){
if(isNaN(num)){
return '0';
}
var si=[
{ value: 1E18, symbol: "E" },
{ value: 1E15, symbol: "P" },
{ value: 1E12, symbol: "T" },
{ value: 1E9, symbol: "G" },
{ value: 1E6, symbol: "M" },
{ value: 1E3, symbol: "k" }
],
rx=/\.0+$|(\.[0-9]*[1-9])0+$/,
i;
for (var i=0; i=si[i].value){
return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
}}
return num.toFixed(digits).replace(rx, "$1");
}
vidorev_theme.prototype.fake_player=function(values){
if(typeof(values)!=='object'){
return;
}
var _=this;
var $player=values.player,
single_video_network=values.single_video_network;
var action=document.createElement('video');
action.play=function(){
_.player_actions($player, single_video_network, 'play');
}
action.pause=function(){
_.player_actions($player, single_video_network, 'pause');
}
if(single_video_network==='self-hosted'||single_video_network==='drive'){
return $player;
}
return action;
}
vidorev_theme.prototype.reset_ads=function(player_id){
var _=this;
if(typeof(_.is_ad_appeared[player_id])!=='undefined'&&Array.isArray(_.is_ad_appeared[player_id])&&_.is_ad_appeared[player_id].length>0){
_.is_ad_appeared[player_id]=[];
$('.data-lightbox-content').append(player_id+'-reset
');
}}
vidorev_theme.prototype.auto_next_fnc=function(obj){
var _=this;
if(typeof(obj)!=='object'){
return;
}else{
var $player=obj.player,
$partyElm=obj.partyElm,
player_id=obj.player_id,
single_video_network=obj.single_video_network,
$playlistFrame=$partyElm.parents('.playlist-frame-control');
var $repeat_btn=null;
var action_auto_next=function(next_text, next_url, target_lightbox){
var $autoNextControl=$partyElm.find('.auto-next-elm-control');
if(next_text!==null){
$autoNextControl.find('.video-next-title-control').text(next_text);
}
if(next_url===null){
next_url=$autoNextControl.attr('data-next-url');
}
if(typeof(next_url)==='undefined'||next_url==''){
return;
}
$autoNextControl.css({'background-image': 'url(' + ($autoNextControl.attr('data-background-url')) + ')'}).addClass('active-item');
if(screenfull.isFullscreen){
$partyElm.addClass('auto-next-set-fs');
}
$(window).on('resize', function(){
if(screenfull.isFullscreen){
$partyElm.addClass('auto-next-set-fs');
}else{
$partyElm.removeClass('auto-next-set-fs');
}});
var cancel_next=null;
cancel_next=setTimeout(function(){
if(cancel_next!==null){
clearTimeout(cancel_next);
}
if(typeof(target_lightbox)!=='undefined'&&target_lightbox.length > 0){
if($partyElm.parents('.lib-item-control').hasClass('show-video')&&$partyElm.parents('.video-lightbox-wrapper-control').hasClass('show-lightbox')){
target_lightbox.trigger('click');
}}else{
window.location.href=next_url;
}}, 6800);
$autoNextControl.find('.loader-timer-control').on('click', function(){
if(cancel_next!==null){
clearTimeout(cancel_next);
}
if(typeof(target_lightbox)!=='undefined'&&target_lightbox.length > 0){
target_lightbox.trigger('click');
}else{
window.location.href=next_url;
}
return false;
});
$autoNextControl.find('.cancel-btn-control').on('click', function(){
if(cancel_next!==null){
clearTimeout(cancel_next);
}
$autoNextControl.removeClass('active-item');
$partyElm.removeClass('auto-next-set-fs');
return false;
});
_.$el.on(prefix+'closeLightBoxVideoEventTrigger', function(){
if(cancel_next!==null){
clearTimeout(cancel_next);
}
$autoNextControl.removeClass('active-item');
$partyElm.removeClass('auto-next-set-fs');
});
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
if(cancel_next!==null){
clearTimeout(cancel_next);
}
$autoNextControl.removeClass('active-item');
$partyElm.removeClass('auto-next-set-fs');
});
}
if($partyElm.parents('.video-lightbox-wrapper-control').length > 0){
$repeat_btn=$partyElm.parents('.video-lightbox-wrapper-control').find('.repeat-video-control');
if($repeat_btn.length===1&&$repeat_btn.hasClass('active-item')){
_.video_repeat_action(obj);
return false;
}
if(!_.global_video_auto_next){
return;
}
var $next_elm=$partyElm.parents('.video-lightbox-wrapper-control').find('.next-video-popup-action .check-url-control'),
next_url=$next_elm.attr('href'),
next_text=$next_elm.text();
if($next_elm.length===0){
return;
}
action_auto_next(next_text, next_url, $next_elm);
}else if($playlistFrame.length > 0){
$repeat_btn=$playlistFrame.find('.repeat-video-control');
if($repeat_btn.length===1&&$repeat_btn.hasClass('active-item')){
_.video_repeat_action(obj);
return false;
}
if(!_.global_video_auto_next){
return;
}
var $curent_player_index=$playlistFrame.find('.video-listing-item-control.current-item');
if($curent_player_index.length===0){
return;
}
var index=$curent_player_index.attr('data-index');
if(typeof(index)==='undefined'||!_.isNumber(index)){
return;
}
var next_index=parseFloat(index) + 1;
if($playlistFrame.find('.video-listing-item-control[data-index="'+(next_index)+'"]').length===0){
next_index=0;
}
var $next_elm=$playlistFrame.find('.video-listing-item-control[data-index="'+(next_index)+'"]').find('.check-url-control'),
next_url=$next_elm.attr('href'),
next_text=$next_elm.text();
action_auto_next(next_text, next_url);
}else{
$repeat_btn=_.$el.find('.single-repeat-video-control');
if($repeat_btn.length===1&&$repeat_btn.hasClass('active-item')){
_.video_repeat_action(obj);
return false;
}
if(!_.global_video_auto_next){
return;
}
action_auto_next(null, null);
}}
}
vidorev_theme.prototype.video_ads=function(values){
if(typeof(values)!=='object'){
return;
}
var _=this;
var $player=values.player,
$partyElm=values.partyElm,
single_video_network=values.single_video_network,
video_duration=parseFloat(values.video_duration),
video_current_time=parseFloat(values.video_current_time),
player_id=values.player_id;
var ads_network=values.ads_object.ads_network,
time_to_show_ads=values.ads_object.time_to_show_ads,
time_skip_ads=parseFloat(values.ads_object.time_skip_ads),
time_to_hide_ads=parseFloat(values.ads_object.time_to_hide_ads);
if(ads_network==='google_ima'){
return;
}
if(typeof(_.is_ad_appeared[player_id])==='undefined'){
_.is_ad_appeared[player_id]=[];
}
if(screenfull.isFullscreen){
$partyElm.addClass('ads-set-fs');
}
$(window).on('resize', function(){
if(screenfull.isFullscreen){
$partyElm.addClass('ads-set-fs');
}else{
$partyElm.removeClass('ads-set-fs');
}});
if(!Array.isArray(time_to_show_ads)||!_.isNumber(video_duration)||!_.isNumber(video_current_time)){
return;
}
$.each(time_to_show_ads, function(i, value){
var ct_show_ad=_.isNumber(value) ? parseFloat(value):'',
next_time_show_ad=(typeof(time_to_show_ads[i+1])!=='undefined'&&_.isNumber(time_to_show_ads[i+1])) ? parseFloat(time_to_show_ads[i+1]):video_duration;
if(ct_show_ad!==''&&ct_show_ad < video_duration&&video_current_time >=ct_show_ad&&video_current_time < next_time_show_ad&&typeof(_.is_ad_appeared[player_id][i])==='undefined'){
_.is_ad_appeared[player_id][i]=true;
_.player_actions($player, single_video_network, 'pause');
$(document).on(prefix+'adsFinish'+(player_id), function(){
_.player_actions($player, single_video_network, 'play');
});
switch(ads_network){
case 'image':
_.ads_image(values);
break;
case 'html5_video':
_.ads_html5_video(values);
break;
case 'html':
_.ads_html(values);
break;
}}
});
}
vidorev_theme.prototype.ads_google_ima=function(values){
if(typeof(values)!=='object'){
return;
}
var _=this;
var $player=values.player,
player_id=values.player_id,
adsContainerID=(player_id)+'-adContainer',
player_init_id=values.player_init_id,
$player_init_id=$('#'+(player_init_id)),
$partyElm=values.partyElm,
$textLoadAds=$partyElm.find('.text-load-ads-control'),
$ads_muted_c=$partyElm.find('.ads-muted-control'),
$fake_player=values.fake_player,
autoplay=values.autoplay,
adWidth=$partyElm.width(),
adHeight=$partyElm.height();
var va_google_ima_source=values.va_google_ima_source;
if(va_google_ima_source==''){
return;
}
$partyElm.append('');
var adsManager;
var adsLoader;
var adDisplayContainer;
var intervalTimer=null;
var videoContent=$fake_player;
var controlPlayer=function(){
$partyElm.addClass('player-loaded');
$partyElm.removeClass('ads-active-elm');
$adContainer.addClass('hide-ads');
$textLoadAds.removeClass('show-load-ad');
$ads_muted_c.removeClass('active-item');
if(autoplay==='on'){
videoContent.play();
}else{
var $poster_preload=$partyElm.find('.autoplay-off-elm-control'),
poster_background=$poster_preload.attr('data-background-url');
if(!$poster_preload.hasClass('ready-setup')){
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item')
.on('click', function(){
videoContent.play();
$(this).removeClass('active-item');
});
}else{
var $lightbox_video=$partyElm.parents('.video-lightbox-wrapper-control');
var $item_on_lightbox=$partyElm.parents('.lib-item-control');
if($lightbox_video.length > 0&&$item_on_lightbox.length > 0&&(!$lightbox_video.hasClass('show-lightbox')||!$item_on_lightbox.hasClass('show-video')||!$poster_preload.hasClass('ready-clicked'))){
return;
}
videoContent.play();
}}
$player_init_id.trigger(prefix+'videoCreateFinish', [$player]);
},
$adContainer=$('#'+(adsContainerID)),
controlIMAPreroll=function(){
var $lightbox_video=$partyElm.parents('.video-lightbox-wrapper-control');
var $item_on_lightbox=$partyElm.parents('.lib-item-control');
if($lightbox_video.length > 0&&$item_on_lightbox.length > 0&&(!$lightbox_video.hasClass('show-lightbox')||!$item_on_lightbox.hasClass('show-video'))){
adsManager.pause();
}};
var onAdError=function(adErrorEvent){
console.log('adsManager: '+(adErrorEvent.getError()));
adsManager.destroy();
controlPlayer();
}
var onContentPauseRequested=function(){
videoContent.pause();
}
var onContentResumeRequested=function(){
var $lightbox_video=$partyElm.parents('.video-lightbox-wrapper-control');
var $item_on_lightbox=$partyElm.parents('.lib-item-control');
if($lightbox_video.length > 0&&$item_on_lightbox.length > 0&&(!$lightbox_video.hasClass('show-lightbox')||!$item_on_lightbox.hasClass('show-video'))){
return;
}
videoContent.play();
}
var onAdEvent=function(adEvent){
var ad=adEvent.getAd();
switch (adEvent.type){
case google.ima.AdEvent.Type.LOADED:
if(!ad.isLinear()){
$partyElm.addClass('ads-non-linear');
videoContent.play();
}else{
$partyElm.removeClass('ads-non-linear');
}
$textLoadAds.removeClass('show-load-ad');
$player_init_id.trigger(prefix+'videoCreateFinish', [$player, adsContainerID]);
break;
case google.ima.AdEvent.Type.STARTED:
if(adsManager.getVolume()==0){
$ads_muted_c.addClass('active-item').on('click', function(){
adsManager.setVolume(1);
$(this).removeClass('active-item');
});
}
$partyElm.addClass('ads-active-elm');
$adContainer.removeClass('hide-ads');
$textLoadAds.removeClass('show-load-ad');
if(ad.isLinear()){
intervalTimer=setInterval(function(){
var remainingTime=adsManager.getRemainingTime();
if(typeof(_.global_player_playing[player_id])!=='undefined'&&_.global_player_playing[player_id]){
_.global_player_playing[player_id]=false;
videoContent.pause();
var $lightbox_video=$partyElm.parents('.video-lightbox-wrapper-control');
var $item_on_lightbox=$partyElm.parents('.lib-item-control');
if($lightbox_video.length > 0&&$item_on_lightbox.length > 0&&(!$lightbox_video.hasClass('show-lightbox')||!$item_on_lightbox.hasClass('show-video'))){
return;
}
adsManager.resume();
}},
368);
}
controlIMAPreroll();
break;
case google.ima.AdEvent.Type.COMPLETE:
$partyElm.removeClass('ads-active-elm');
$adContainer.addClass('hide-ads');
$ads_muted_c.removeClass('active-item');
if(intervalTimer!=null&&ad.isLinear()){
clearInterval(intervalTimer);
}
break;
case google.ima.AdEvent.Type.SKIPPED:
$partyElm.removeClass('ads-active-elm');
$adContainer.addClass('hide-ads');
$ads_muted_c.removeClass('active-item');
if(intervalTimer!=null&&ad.isLinear()){
clearInterval(intervalTimer);
}
break;
case google.ima.AdEvent.Type.USER_CLOSE:
$partyElm.removeClass('ads-active-elm');
$adContainer.addClass('hide-ads');
$ads_muted_c.removeClass('active-item');
if(intervalTimer!=null&&ad.isLinear()){
clearInterval(intervalTimer);
}
break;
case google.ima.AdEvent.Type.VOLUME_MUTED:
$ads_muted_c.addClass('active-item').on('click', function(){
adsManager.setVolume(1);
$(this).removeClass('active-item');
});
break;
}}
var onAdsManagerLoaded=function(adsManagerLoadedEvent){
var adsRenderingSettings=new google.ima.AdsRenderingSettings();
adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=true;
adsManager=adsManagerLoadedEvent.getAdsManager(videoContent, adsRenderingSettings);
$partyElm.addClass('player-loaded');
if(autoplay==='on'){
if(screenfull.isFullscreen){
$partyElm.addClass('ads-set-fs');
}
$(window).on('resize', function(){
if(screenfull.isFullscreen){
$partyElm.addClass('ads-set-fs');
}else{
$partyElm.removeClass('ads-set-fs');
}});
$textLoadAds.addClass('show-load-ad');
adDisplayContainer.initialize();
try {
adsManager.init(adWidth, adHeight, google.ima.ViewMode.NORMAL);
if(_.global_muted_video){
adsManager.setVolume(0);
}
_.is_ad_google_ima_control[adsContainerID]=adsManager;
_.is_ad_google_ima_stated_event[adsContainerID]=true;
adsManager.start();
} catch (adError){
console.log('adsManager-init: '+(adError));
controlPlayer();
}}else{
var $poster_preload=$partyElm.find('.autoplay-off-elm-control'),
poster_background=$poster_preload.attr('data-background-url');
$poster_preload
.css({'background-image': 'url(' + (poster_background) + ')'})
.addClass('active-item ready-setup')
.on('click', function(){
if(screenfull.isFullscreen){
$partyElm.addClass('ads-set-fs');
}
$(window).on('resize', function(){
if(screenfull.isFullscreen){
$partyElm.addClass('ads-set-fs');
}else{
$partyElm.removeClass('ads-set-fs');
}});
$(this).addClass('ready-clicked');
$textLoadAds.addClass('show-load-ad');
videoContent.load();
videoContent.play();
adDisplayContainer.initialize();
try {
adsManager.init(adWidth, adHeight, google.ima.ViewMode.NORMAL);
if(_.global_muted_video){
adsManager.setVolume(0);
}
_.is_ad_google_ima_control[adsContainerID]=adsManager;
_.is_ad_google_ima_stated_event[adsContainerID]=true;
adsManager.start();
} catch (adError){
console.log('adsManager-init: '+(adError));
controlPlayer();
}
$(this).removeClass('active-item');
videoContent.pause();
});
$player_init_id.trigger(prefix+'playVideoWithGoogleIMAReady', [$player, $poster_preload]);
}
adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError);
adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, onContentPauseRequested);
adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, onContentResumeRequested);
adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.AD_METADATA, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.CLICK, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.DURATION_CHANGE, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.FIRST_QUARTILE, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.IMPRESSION, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.INTERACTION, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.LINEAR_CHANGED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.LOG, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.MIDPOINT, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.THIRD_QUARTILE, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.USER_CLOSE, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.VOLUME_CHANGED, onAdEvent);
adsManager.addEventListener(google.ima.AdEvent.Type.VOLUME_MUTED, onAdEvent);
}
adDisplayContainer=new google.ima.AdDisplayContainer(document.getElementById(adsContainerID));
var adsLoader_onAdError=function(adErrorEvent){
console.log('adsLoader: '+(adErrorEvent.getError()));
controlPlayer();
}
adsLoader=new google.ima.AdsLoader(adDisplayContainer);
adsLoader.getSettings().setAutoPlayAdBreaks(false);
var adsRequest=new google.ima.AdsRequest();
adsRequest.adTagUrl=va_google_ima_source;
adsRequest.linearAdSlotWidth=adWidth;
adsRequest.linearAdSlotHeight=adHeight;
adsRequest.nonLinearAdSlotWidth=adWidth;
adsRequest.nonLinearAdSlotHeight=adHeight;
adsLoader.requestAds(adsRequest);
adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, onAdsManagerLoaded, false);
adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, adsLoader_onAdError, false);
videoContent.addEventListener('ended', function(){
adsLoader.contentComplete();
});
}
vidorev_theme.prototype.ads_image=function(values){
if(typeof(values)!=='object'){
return;
}
var _=this;
var player_id=values.player_id,
ads_object=values.ads_object;
if(typeof(ads_object)==='undefined'||typeof(ads_object.va_image_source)==='undefined'||$.trim(ads_object.va_image_source)==''){
$(document).trigger(prefix+'adsFinish'+(player_id), [_]);
return false;
}
var va_image_source=$.trim(ads_object.va_image_source),
va_image_link=$.trim(ads_object.va_image_link),
time_skip_ads=parseFloat(ads_object.time_skip_ads),
time_to_hide_ads=parseFloat(ads_object.time_to_hide_ads);
var $partyElm=values.partyElm,
selfAdsID=(player_id)+'-selfAdsID';
var before_ads='',
after_ads='';
if(va_image_link!=''){
before_ads='';
after_ads='';
}
if($partyElm.find('#'+(selfAdsID)).length===0){
var skip_ad_image='';
if($partyElm.find('.video-play-control').length>0){
var img_video_url=$partyElm.find('.video-play-control').attr('data-background-url');
if(typeof(img_video_url)!=='undefined'&&img_video_url!=''){
skip_ad_image='';
}}
$partyElm.append('\
'+(before_ads)+'\
\
'+(after_ads)+'\
\
'+(vidorev_jav_js_object.translate_skip_ad)+'\
'+(vidorev_jav_js_object.translate_skip_ad_in)+''+(time_skip_ads)+'\
'+(skip_ad_image)+'\
\
'
);
}
var $selfAdsContainer=$('#'+(selfAdsID)+'.self-adContainer-control'),
$skipAds=$selfAdsContainer.find('.skip-ad-control'),
$skipSecond=$selfAdsContainer.find('.skip-second-control'),
$textLoadAds=$partyElm.find('.text-load-ads-control');
var timeOutHideAds=null,
timeOutSkipAds=null;
var remove_ads=function(){
if(timeOutHideAds!==null){
clearTimeout(timeOutHideAds);
}
if(timeOutSkipAds!==null){
clearInterval(timeOutSkipAds);
}
$skipAds.removeClass('active-skip');
$selfAdsContainer.addClass('hide-ads');
$skipSecond.text(time_skip_ads);
}
$skipAds.off('.clickSkipAds').on('click.clickSkipAds', function(){
remove_ads();
$(document).trigger(prefix+'adsFinish'+(player_id), [_]);
});
$selfAdsContainer.removeClass('hide-ads');
$textLoadAds.addClass('show-load-ad');
$selfAdsContainer.find('.type-image-ads-control').on('load', function(){
var $lightbox_wrapper=$partyElm.parents('.video-lightbox-wrapper-control'),
$item_wrapper=$partyElm.parents('.lib-item-control show-video');
if($lightbox_wrapper.length > 0&&$item_wrapper.length > 0&&(!$lightbox_wrapper.hasClass('show-lightbox')||!$item_wrapper.hasClass('show-video'))){
return false;
}
$textLoadAds.removeClass('show-load-ad');
$selfAdsContainer.addClass('ready-ad');
if(timeOutHideAds!==null){
clearTimeout(timeOutHideAds);
}
if(timeOutSkipAds!==null){
clearInterval(timeOutSkipAds);
}
timeOutHideAds=setTimeout(function(){
clearTimeout(timeOutHideAds);
$skipAds.trigger('click');
}, time_to_hide_ads * 1000);
var currentSkipSeconds=time_skip_ads;
timeOutSkipAds=setInterval(function(){
currentSkipSeconds--;
if(currentSkipSeconds===0){
clearInterval(timeOutSkipAds);
$skipAds.addClass('active-skip');
}
$skipSecond.text(currentSkipSeconds);
}, 1000);
})
.each(function(){
var $lightbox_wrapper=$partyElm.parents('.video-lightbox-wrapper-control'),
$item_wrapper=$partyElm.parents('.lib-item-control show-video');
if($lightbox_wrapper.length > 0&&$item_wrapper.length > 0&&(!$lightbox_wrapper.hasClass('show-lightbox')||!$item_wrapper.hasClass('show-video'))){
return false;
}
if(this.complete){
$(this).load();
}});
_.$el.on(prefix+'openLightBoxVideoEventTrigger', function(){
remove_ads();
});
_.$el.on(prefix+'closeLightBoxVideoEventTrigger', function(){
remove_ads();
});
}
vidorev_theme.prototype.converSecondsToTime=function(seconds){
var date=new Date(null);
date.setSeconds(seconds);
var result='';
try{
result=date.toISOString().substr(11, 8);
}catch(err){
return result;
}
var res=result.split(':');
if(res.length===3&&res[0]=='00'){
result=(res[1])+':'+(res[2]);
}
return result;
}
vidorev_theme.prototype.ads_html5_video=function(values){
if(typeof(values)!=='object'){
return;
}
var _=this;
var player_id=values.player_id,
ads_object=values.ads_object;
if(typeof(ads_object)==='undefined'||typeof(ads_object.va_video_source)!=='object'){
$(document).trigger(prefix+'adsFinish'+(player_id), [_]);
return false;
}
var va_video_source=ads_object.va_video_source,
va_video_link=$.trim(ads_object.va_video_link),
time_skip_ads=parseFloat(ads_object.time_skip_ads);
var $partyElm=values.partyElm,
selfAdsID=(player_id)+'-selfAdsID';
var before_ads='',
after_ads='';
if(va_video_link!=''){
before_ads='';
after_ads='';
}
var video_html_5_id='vidorev_vid_ads_'+(player_id);
if($partyElm.find('#'+(selfAdsID)).length===0){
var skip_ad_image='';
if($partyElm.find('.video-play-control').length>0){
var img_video_url=$partyElm.find('.video-play-control').attr('data-background-url');
if(typeof(img_video_url)!=='undefined'&&img_video_url!=''){
skip_ad_image='';
}}
var video_source='';
$.each(va_video_source, function(key, value){
var ext=value.slice((Math.max(0, value.lastIndexOf("."))||Infinity) + 1);
switch(ext){
case 'mp4':
video_source+='