File: /home/bt667/www/wp-content/plugins/wp_mvplayer/includes/player.js
function mp4video(player_id,admin_url,socialbtn_durations,content_durations,optin_durations,popup_durations,social,socialbtn_duration,socialbtn_dur_end,content_dur_end,content_duration,OptinBox,optin_duration,optin_dur_end,Popup,popup_duration,popup_dur_end,allowpause,autoplay){
jQuery(`.player${player_id} video`).css('background','black');
// var oncuepoint_{$player_id} = false;
window['oncuepoint_' + player_id] = false;
// var on_ps{$player_id} = false;
window['on_ps' + player_id] = false;
// var index{$player_id} = false;
window['index' + player_id] = false;
// var show_optin{$player_id} = false;
window['show_optin' + player_id] = false;
// var show_popup{$player_id} = false;
window['show_popup' + player_id] = false;
var current_player_id = false;
var api =jQuery(`.player${player_id}`).flowplayer({
cuepoints: [{time:socialbtn_durations,socialbtn:'button show'},
{time:content_durations,content:'content show'},
{time:optin_durations,optin:'optin show'},
{time:popup_durations,popup:'popup show'}]
});
var player = flowplayer(`.player${player_id}`, {muted:false})
if(autoplay == "1"){
player.mute();
}
player.bind('cuepoint', function (e, api, cuepoint) {
var mvplayer_social_shared = jQuery.cookie(`mvplayer_social_lockdown_shared${player_id}`);
if(cuepoint.socialbtn){
var mvplayer_social_shared = jQuery.cookie(`mvplayer_social_lockdown_shared${player_id}`);
if(social==1 && socialbtn_duration==0 && socialbtn_dur_end==0 && !window['oncuepoint_'+player_id] && mvplayer_social_shared == null){
window['on_ps'+player_id] = true;
api.pause();
`sociallock_${player_id}()`;
}
else{
api.play();
}
}else if(cuepoint.content){
if(content_dur_end==0 && content_duration==0){
jQuery(`#mvplayer_video_content${player_id}`).show();
}
}else if(cuepoint.optin){
if(`${OptinBox}`=='yes' && optin_duration==0 && optin_dur_end==0 && !window['show_optin'+player_id]){
window['on_ps'+player_id] = true;
api.pause();
`optinShowIt_${player_id}()`;
}
}else if(cuepoint.popup){
if(`${Popup}`=='yes' && popup_duration==0 && popup_dur_end==0 && !window['show_popup'+player_id]){
window['on_ps'+player_id] = true;
api.pause();
`popupShowIt_${player_id}()`;
}
}
});
api.bind('pause', function () {
if(`${allowpause}`=='1'){
if(!window['on_ps'+player_id]){
window['on_ps'+player_id] = false;
return flowplayer(jQuery(`.player${player_id}`)).play();
}else{
console.log('else2');
}
}else{console.log(`else1 : ${allowpause}`);}
});
api.bind('seek',function(time,callback){
var mvplayer_social_shared = jQuery.cookie(`mvplayer_social_lockdown_shared${player_id}`);
if(social==1 && socialbtn_duration==0 && socialbtn_dur_end==0 && mvplayer_social_shared == null){
if(flowplayer(`.player${player_id}`).video.time>socialbtn_durations){
window['on_ps'+player_id] = true;
flowplayer(jQuery(`.player${player_id}`)).pause();
`sociallock_${player_id}()`;
}
}
if(content_dur_end==0 && content_duration==0){
if(flowplayer(`.player${player_id}`).video.time>content_durations){
jQuery(`#mvplayer_video_content${player_id}`).show();
}
}
if(`${OptinBox}`=='yes' && optin_duration==0 && optin_dur_end==0 && !window['show_optin'+player_id]){
if(flowplayer(`.player${player_id}`).video.time>optin_durations){
window['on_ps'+player_id] = true;
flowplayer(jQuery(`.player${player_id}`)).pause();
`optinShowIt_${player_id}()`;
}
}
if(`${Popup}`=='yes' && popup_duration==0 && popup_dur_end==0 && !window['show_popup'+player_id]){
if(flowplayer(`.player${player_id}`).video.time>popup_durations){
window['on_ps'+player_id] = true;
flowplayer(jQuery(`.player${player_id}`)).pause();
`popupShowIt_${player_id}()`;
}
}
});
api.bind('resume', function () {
jQuery(`.player${player_id} video`).css('background','black');
if(content_duration==1){
jQuery(`#mvplayer_video_content${player_id}`).show();
}
if(`${OptinBox}`=='yes' && optin_duration==1 && !window['show_optin'+player_id]){
window['on_ps'+player_id] = true;
flowplayer(jQuery(`.player${player_id}`)).pause();
'optinShowIt_'+player_id();
}
if(`${Popup}`=='yes' && popup_duration==1 && !window['show_popup'+player_id]){
window['on_ps'+player_id] = true;
flowplayer(jQuery(`.player${player_id}`)).pause();
'popupShowIt_'+player_id();
}
var mvplayer_social_shared = jQuery.cookie(`mvplayer_social_lockdown_shared${player_id}`);
if(social==1 && !'oncuepoint_'+player_id && socialbtn_duration==1 && mvplayer_social_shared == null){
window['on_ps'+player_id] = true;
flowplayer(jQuery(`.player${player_id}`)).pause();
'sociallock_'+player_id();
}
});
api.bind('finish', function () {
if(content_dur_end==1){
jQuery(`#mvplayer_video_content${player_id}`).show();
}
if(`${OptinBox}`=='yes' && optin_dur_end==1 && !window['show_optin'+player_id]){
'optinShowIt_${player_id}'();
}
if(`${Popup}`=='yes' && popup_dur_end==1 && !window['show_popup'+player_id]){
`popupShowIt_${player_id}`();
}
var mvplayer_social_shared = jQuery.cookie(`mvplayer_social_lockdown_shared${player_id}`);
if(social==1 && socialbtn_dur_end==1 && mvplayer_social_shared == null){
`sociallock_${player_id}`();
}
});
jQuery(document).ready(function($){
//morebutton
$(`#morebtnlink${player_id}`).on('click',function(){
$(`#show_allbtnleft${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).show();
$(`#show_allbtn${player_id}`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.pause();
});
$(`#close_btn_iframe${player_id}`).on('click',function(){
$(this).parents(`#show_iframe${player_id}`).hide();
$(`#show_allbtn${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
});
$(`#close_btn_relatedvideos${player_id}`).on('click',function(){
$(this).parents(`#show_all_relatedvideo${player_id}`).hide();
$(this).parents(`#show_all_relatedvideo${player_id}`).children('.singlevideo').remove();
$(`#show_allbtn${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
});
$(`#close_btn_htmlcode${player_id}`).on('click',function(){
$(this).parents(`#show_htmlcode${player_id}`).hide();
$(`#show_allbtn${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
});
$(`#close_btn_map${player_id}`).on('click',function(){
$(this).parents(`#show_maploc${player_id}`).hide();
$(`#show_allbtn${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
});
$(`#close_allbtn${player_id}`).on('click',function(){
$(this).parents(`#show_allbtnleft${player_id}`).hide();
$(`#show_allbtn${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
});
$(document).on('click',`#close_post${player_id}`,function(){
$(this).parents('.show_post').hide();
$(`#show_allbtn${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
});
$(document).on("click", `#close_page${player_id}`, function () {
$(`#wrapper-${player_id} .pagedesc iframe`).remove();
$(this).parents('.show_page').hide();
$(`#show_allbtn${player_id}`).show();
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
});
//click on single button in left side
$(document).on('click',`#front_btnleft${player_id}`,function(){
$(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
$(this).parents(`#show_allbtnleft${player_id}`).hide();
var btn_type =$(this).children(`#btn_type${player_id}`).val();
var btn_maptitle =$(this).children(`#btn_maptitle${player_id}`).val();
var btn_maploc =$(this).children(`#btn_maploc${player_id}`).val();
var btn_maplat =$(this).children('.btn_maplat').val();
var btn_maplng =$(this).children('.btn_maplng').val();
var btn_iframeurl =$(this).children(`#btn_iframeurl${player_id}`).val();
var btn_htmlcode =$(this).children(`#btn_htmlcode${player_id}`).val();
var btn_relatedvideo_url =$(this).children(`#btn_relatedvideo_url${player_id}`).val();
var btn_relatedvideo_thumb =$(this).children(`#btn_relatedvideo_thumb${player_id}`).val();
var btn_postdivid =$(this).children('.btn_postdivid').val();
var btn_pagedivid =$(this).children('.btn_pagedivid').val();
if(btn_type=='iframe'){
$(`#show_iframe${player_id}`).show();
$(`#show_iframe${player_id}`).children('iframe').attr('src',btn_iframeurl);
}
else if(btn_type=='related_video'){
$(`#show_all_relatedvideo${player_id}`).show();
var btn_relatedvideo_urlarray = btn_relatedvideo_url.split(",");
var btn_relatedvideo_thumbarray = btn_relatedvideo_thumb.split(",");
for(var a=0;a<btn_relatedvideo_urlarray.length;a++){
$(`#show_all_relatedvideo${player_id}`).append('<div class="singlevideo"><a target="_blank" href="'+btn_relatedvideo_urlarray[a]+'"><img src="'+btn_relatedvideo_thumbarray[a]+'"></a></div>');
}
}
else if(btn_type=='post'){
$(`#wrapper-${player_id}`).children(btn_postdivid).show();
}
else if(btn_type=='page'){
var plink = $(`#wrapper-${player_id} ${btn_pagedivid} #pagelink`).val();
if($(`#wrapper-${player_id} `+btn_pagedivid+ ' .pagedesc').children().length == 1){
$(`#wrapper-${player_id} `+btn_pagedivid+ ' .pagedesc').append("<iframe id='page_iframe' src='"+plink+"' height='100%' width='100%'></iframe>");
}
$(`#wrapper-${player_id}`).children(btn_pagedivid).show();
}
else if(btn_type=='htmlcode'){
if($(`#show_htmlcode${player_id} label`).children().length == 0){
$(`#show_htmlcode${player_id}; label`).html(btn_htmlcode);
}
$(`#show_htmlcode${player_id}`).show();
}
else if(btn_type=='map'){
$(`#show_maploc${player_id}`).show();
var country = null;
$(`.btn_maploc${player_id}`).each(function(){
// Test if the div element is empty
if($(this).val() != "" && $(this).val() != null){
console.log('loop is running');
country = $(this).val();
}
});
if(country){
$(`#show_map${player_id}`).html(`<iframe id='country_iframe' src='https://maps.google.com/maps?q=${country}&output=embed' height='100%' width='100%'></iframe>`);
}
}
});
$(document).on("click", `#front_btn${player_id}`, function () {
var api = flowplayer(jQuery(`.player${player_id}`));
api.pause();
var btn_type =$(this).parents(`#btn_data${player_id}`).children(`#btn_type${player_id}`).val();
var btn_maptitle =$(this).parents(`#btn_data${player_id}`).children(`#btn_maptitle${player_id}`).val();
var btn_maploc =$(this).parents(`#btn_data${player_id}`).children(`#btn_maploc${player_id}`).val();
var btn_maplat =$(this).parents(`#btn_data${player_id}`).children('.btn_maplat').val();
var btn_maplng =$(this).parents(`#btn_data${player_id}`).children('.btn_maplng').val();
var btn_iframeurl =$(this).parents(`#btn_data${player_id}`).children(`#btn_iframeurl${player_id}`).val();
var btn_htmlcode =$(this).parents(`#btn_data${player_id}`).children(`#btn_htmlcode${player_id}`).val();
var btn_relatedvideo_url =$(this).parents(`#btn_data${player_id}`).children(`#btn_relatedvideo_url${player_id}`).val();
var btn_relatedvideo_thumb =$(this).parents(`#btn_data${player_id}`).children(`#btn_relatedvideo_thumb${player_id}`).val();
var btn_postdivid =$(this).parents(`#btn_data${player_id}`).children('.btn_postdivid').val();
var btn_pagedivid =$(this).parents(`#btn_data${player_id}`).children('.btn_pagedivid').val();
if(btn_type=='iframe'){
$(`#show_iframe${player_id}`).show();
$(`#show_iframe${player_id}`).children('iframe').attr('src',btn_iframeurl);
}
else if(btn_type=='related_video'){
$(`#show_all_relatedvideo${player_id}`).show();
var btn_relatedvideo_urlarray = btn_relatedvideo_url.split(",") ;
var btn_relatedvideo_thumbarray = btn_relatedvideo_thumb.split(",");
for(var a=0;a<btn_relatedvideo_urlarray.length;a++){
$(`#show_all_relatedvideo${player_id}`).append('<div class="singlevideo"><a target="_blank" href="'+btn_relatedvideo_urlarray[a]+'"><img src="'+btn_relatedvideo_thumbarray[a]+'"></a></div>');
}
}
else if(btn_type=='post'){
$(`#wrapper-$player_id`).children(btn_postdivid).show();
}
else if(btn_type=='page'){
var plink = $(`#wrapper-${player_id} ${btn_pagedivid} #pagelink`).val();
if($(`#wrapper-${player_id} `+btn_pagedivid+ ' .pagedesc').children().length == 1){
$(`#wrapper-${player_id} `+btn_pagedivid+ ' .pagedesc').append("<iframe id='page_iframe' src='"+plink+"' height='100%' width='100%'></iframe>");
}
$(`#wrapper-${player_id}`).children(btn_pagedivid).show();
}
else if(btn_type=='htmlcode'){
if($(`#show_htmlcode${player_id} label`).children().length == 0){
$(`#show_htmlcode${player_id} label`).html(btn_htmlcode);
}
$(`#show_htmlcode${player_id}`).show();
}
else if(btn_type=='map'){
$(`#show_maploc${player_id}`).show();
var country = null;
$(`.btn_maploc${player_id}`).each(function(){
// Test if the div element is empty
if($(this).val() != "" && $(this).val() != null){
country = $(this).val();
}
});
if(country){
$(`#show_map${player_id}`).html(`<iframe id='country_iframe' src='https://maps.google.com/maps?q=${country}&output=embed' height='100%' width='100%'></iframe>`);
}
}
$(`#show_allbtn${player_id}`).hide()
});
});
function mvplayer_social_lockdown_plusone(plusone) {
if (plusone.state == "on") {
var data = {post: `${whichpost}`, action: "mvplayer_social_lockdown", source: "google"};
jQuery.post(admin_url, data, function(response) {
if(current_player_id==`${player_id}`){
`sociallock_hide_${player_id}()`;
}
});
}
}
jQuery(document).ready(function() {
FB.Event.subscribe("edge.create", function(href) {
var data = {post: `${whichpost}`, action: "mvplayer_social_lockdown", source: "facebook"};
jQuery.post(admin_url, data, function(response) {
jQuery(".fb_edge_comment_widget.fb_iframe_widget").remove();
if(current_player_id==`${player_id}`){
`sociallock_hide_${player_id}()`;
}
});
});
});
twttr.ready(function (twttr) {
twttr.events.bind("tweet", function(event) {
var data = {post: `${whichpost}`, action: "mvplayer_social_lockdown", source: "twitter"};
jQuery.post(admin_url, data, function(response) {
if(current_player_id==`${player_id}`){
`sociallock_hide_${player_id}()`;
}
});
});
});
jQuery(`.allsharebtn${player_id}`).on('click',function(){
current_player_id = player_id;
jQuery('.social_btn').hide();
`sociallock_hide_${player_id}()`;
});
jQuery(`.allsharebtn${player_id}`).on('mouseover',function(){
current_player_id = `${player_id}`;
});
window['sociallock_' + player_id] = function (){
jQuery(`#show_allbtn${player_id}`).hide();
jQuery(`#show_allbtnleft${player_id}`).hide();
jQuery(`#show_iframe${player_id}`).hide();
jQuery(`#show_htmlcode${player_id}`).hide();
jQuery(`#show_maploc${player_id}`).hide();
jQuery(`#wrapper-${player_id}`).children('.show_post').hide();
jQuery(`#wrapper-${player_id}`).children('.show_page').hide();
jQuery(`#wrapper-${player_id} .mv_player_video_overlap`).show();
jQuery(`#social_button${player_id}`).css('display','flex');
}
window['sociallock_hide_' + player_id] = function (){
jQuery(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
jQuery(`#social_button${player_id}`).hide();
jQuery.cookie(`mvplayer_social_lockdown_shared${vid}`, '1', { expires: 30, path: '/' });
window['oncuepoint_'+player_id] = true;
window['on_ps'+player_id] = false;
jQuery(`#show_allbtn${player_id}`).show();
var api = flowplayer(jQuery(`.player${player_id}`));
api.pause();
}
window['popupShowIt_' + player_id] = function(){
jQuery(`#show_allbtn${player_id}`).hide();
jQuery(`#show_allbtnleft${player_id}`).hide();
jQuery(`#show_iframe${player_id}`).hide();
jQuery(`#show_htmlcode${player_id}`).hide();
jQuery(`#show_maploc${player_id}`).hide();
jQuery(`#wrapper-${player_id}`).children('.show_post').hide();
jQuery(`#wrapper-${player_id}`).children('.show_page').hide();
if ( document.getElementById(`show_popupbox_${player_id}`) ){
document.getElementById(`show_popupbox_${player_id}`).style.display = "block";
}
jQuery(`#wrapper-${player_id} .mv_player_video_overlap`).show();
}
jQuery(`#popuplink${player_id}`).on('click',function(){
if ( document.getElementById(`show_popupbox_${player_id}`) ){
document.getElementById(`show_popupbox_${player_id}`).style.display = "none";
}
jQuery(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
window['show_popup'+player_id] = true;
window['on_ps'+player_id] = false;
jQuery(`#show_allbtn${player_id}`).show();
var api = flowplayer(jQuery(`.player${player_id}`));
api.pause();
});
window['optinShowIt_' + player_id] = function (){
jQuery(`#show_allbtn${player_id}`).hide();
jQuery(`#show_allbtnleft${player_id}`).hide();
jQuery(`#show_iframe${player_id}`).hide();
jQuery(`#show_htmlcode${player_id}`).hide();
jQuery(`#show_maploc${player_id}`).hide();
jQuery(`#wrapper-${player_id}`).children('.show_post').hide();
jQuery(`#wrapper-${player_id}`).children('.show_page').hide();
if ( document.getElementById(`show_optinbox_${player_id}`) ){
document.getElementById(`show_optinbox_${player_id}`).style.display = "flex";
}
jQuery(`#wrapper-${player_id} .mv_player_video_overlap`).show();
}
window['optinHideIt_' + player_id] = function (){
if ( document.getElementById(`show_optinbox_${player_id}`) ){
document.getElementById(`show_optinbox_${player_id}`).style.display = "none";
}
jQuery(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
window['show_optin'+player_id] = true;
window['on_ps'+player_id] = false;
jQuery(`#show_allbtn${player_id}`).show();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
}
window['socialHideIt_' + player_id] =function(){
if ( document.getElementById(`social_button${player_id}`) ){
document.getElementById(`social_button${player_id}`).style.display = "none";
}
jQuery.cookie(`mvplayer_social_lockdown_shared${player_id}`, '1', { expires: 30, path: '/' });
window['oncuepoint_'+player_id] = true;
jQuery(`#wrapper-${player_id} .mv_player_video_overlap`).hide();
window['social_lock'+player_id] = true;
window['on_ps'+player_id] = false;
jQuery(`#show_allbtn${player_id}`).show();
jQuery(`#ico_img${player_id}`).hide();
var api = flowplayer(jQuery(`.player${player_id}`));
api.play();
};
}