').append(commentTextArea).html();
swal({
title: "תגובה",
content: span,
dangerMode: true,
buttons: {
cancel: "Cancel",
comment: {
text: "תגובה",
value: "comment",
className: "btn-success",
},
}
}).then(function (value) {
console.log(value);
switch (value) {
case "comment":
if (!empty(html)) {
saveEditedComment(comments_id);
} else {
replyComment(comments_id);
}
break;
}
});
setupFormElement('#popupCommentTextarea', 5, commentsmaxlen, true, true);
}
function getCommentTemplate(itemsArray) {
var template = commentTemplate;
for (var search in itemsArray) {
var replace = itemsArray[search];
if (typeof replace == 'boolean') {
if (search == 'userCanAdminComment') {
if (replace) {
replace = 'userCanAdminComment';
} else {
replace = 'userCanNotAdminComment';
}
} else if (search == 'userCanEditComment') {
if (replace) {
replace = 'userCanEditComment';
} else {
replace = 'userCanNotEditComment';
}
}
} else if (search == 'myVote') {
if (replace == '1') {
replace = 'myVote1';
} else if (replace == '-1') {
replace = 'myVote-1';
} else {
replace = 'myVote0';
}
}
if (typeof replace !== 'string' && typeof replace !== 'number') {
continue;
}
if (search == 'pin') {
if (!empty(replace)) {
replace = 'isPinned';
} else {
replace = 'isNotPinned';
}
}
template = template.replace(new RegExp('{' + search + '}', 'g'), replace);
}
template = template.replace(new RegExp('{replyText}', 'g'), "תשובה");
template = template.replace(new RegExp('{viewAllRepliesText}', 'g'), "הצג את כל התשובות");
template = template.replace(new RegExp('{hideRepliesText}', 'g'), "הסתר תגובות");
template = template.replace(new RegExp('{likes}', 'g'), 0);
template = template.replace(new RegExp('{dislikes}', 'g'), 0);
template = template.replace(new RegExp('{myVote}', 'g'), 'myVote0');
if (!empty(itemsArray.comments_id_pai)) {
template = template.replace(new RegExp('{isResponse}', 'g'), 'isResponse');
} else {
template = template.replace(new RegExp('{isResponse}', 'g'), 'isNotResponse');
}
return template;
}
function addComment(itemsArray, comments_id, append) {
if (typeof itemsArray === 'function') {
return false;
}
if(!empty(itemsArray.comments_id_pai)){
itemsArray.isAResponse = 'isAResponse';
}else{
itemsArray.isAResponse = 'isNotAResponse';
}
itemsArray.videoLink = itemsArray.video.link;
itemsArray.videoTitle = itemsArray.video.title;
var template = getCommentTemplate(itemsArray);
var selector = '#commentsArea ';
if (!empty(comments_id)) {
selector = '#comment_' + comments_id + ' > div.media-body > div.repliesArea ';
}
var element = '#comment_' + itemsArray.id;
if ($(element).length) {
var object = $('
').html(template);
var html = $(object).find(element).html();
$(element).html(html);
} else {
if(append){
$(selector).append(template);
}else{
$(selector).prepend(template);
}
}
return true;
}
function toogleReplies(comments_id, t) {
var selector = '#comment_' + comments_id + ' > div.media-body > div.repliesArea ';
if ($(selector).is(':empty')) {
getComments(comments_id, 1);
}
if ($(t).hasClass('isOpen')) {
$(t).removeClass('isOpen');
$(t).addClass('isNotOpen');
$(selector).slideUp();
}else{
$(t).removeClass('isNotOpen');
$(t).addClass('isOpen');
$(selector).slideDown();
}
}
var lastLoadedPage;
function getComments(comments_id, page) {
var url = webSiteRootURL + 'objects/comments.json.php';
if(typeof commentVideos_id == 'undefined'){
commentVideos_id = 0;
}
url = addQueryStringParameter(url, 'video_id', commentVideos_id);
url = addQueryStringParameter(url, 'comments_id', comments_id);
url = addQueryStringParameter(url, 'current', page);
lastLoadedPage = page;
$.ajax({
url: url,
success: function (response) {
if (response.error) {
avideoAlertError(response.msg);
} else {
var selector = '#commentsArea ';
if (!empty(comments_id)) {
selector = '#comment_' + comments_id + ' > div.media-body > div.repliesArea ';
}else{
if(empty(response.rows) || response.total < response.rowCount){
if(page>1){
avideoToastInfo('Finished');
}
$('#commentLoadMoreBtn').fadeOut();
}
}
if(page<=1){
$(selector).empty();
}
for (var i in response.rows) {
var row = response.rows[i];
if(typeof row === 'function'){
continue;
}
//console.log('getComments', comments_id, page, typeof row);
addComment(row, comments_id, true);
}
}
}
});
}
function saveComment() {
return _saveComment($('#comment').val(), commentVideos_id, 0, 0);
}
function deleteComment(comments_id) {
swal({
title: "האם אתה בטוח?",
text: "לא תוכל לשחזר פעולה זו!",
icon: "warning",
buttons: true,
dangerMode: true,
}).then(function (willDelete) {
if (willDelete) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/commentDelete.json.php',
method: 'POST',
data: {'id': comments_id},
success: function (response) {
if (!response.error) {
var selector = '#comment_' + comments_id;
$(selector).slideUp('fast', function () {
$(this).remove();
});
}
avideoResponse(response);
modal.hidePleaseWait();
}
});
}
});
}
function editComment(id) {
modal.showPleaseWait();
var url = webSiteRootURL + 'objects/comments.json.php';
url = addQueryStringParameter(url, 'id', id);
$.ajax({
url: url,
success: function (response) {
modal.hidePleaseWait();
if (response.error) {
avideoAlertError(response.msg);
} else {
console.log(response);
if (empty(response.rows)) {
avideoAlertError('No response from comments');
} else {
popupCommentTextarea(id, response.rows[0].commentPlain);
}
}
}
});
}
function saveEditedComment(id) {
return _saveComment($('#popupCommentTextarea').val(), commentVideos_id, 0, id);
}
function replyComment(comments_id) {
return _saveComment($('#popupCommentTextarea').val(), commentVideos_id, comments_id, 0);
}
function _saveComment(comment, video, comments_id, id) {
if (comment.length > 5) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/commentAddNew.json.php',
method: 'POST',
data: {'comment': comment, 'video': video, 'comments_id': comments_id, 'id': id, 'comment_users_id': $('#comment_users_id').val()},
success: function (response) {
avideoResponse(response);
if (!response.error) {
if (!empty(response.comment)) {
addComment(response.comment, response.replyed_to, false);
}
}
modal.hidePleaseWait();
$('#comment, #popupCommentTextarea').html('');
$('#comment, #popupCommentTextarea').val('');
}
});
} else {
avideoAlertError("ההערה שלך צריכה להיות גדולה מ -5 תווים!");
}
}
function pinComment(comments_id) {
modal.showPleaseWait();
var url = webSiteRootURL + 'objects/commentPinToogle.json.php';
url = addQueryStringParameter(url, 'comments_id', comments_id);
$.ajax({
url: url,
success: function (response) {
avideoResponse(response);
if (!response.error) {
getComments(0, 1);
}
modal.hidePleaseWait();
}
});
}
function saveCommentLikeDislike(comments_id, like) {
$.ajax({
url: webSiteRootURL + 'objects/comments_like.json.php?like=' + like,
method: 'POST',
data: {'comments_id': comments_id},
success: function (response) {
var selector = '#comment_' + comments_id;
$(selector).removeClass("myVote0 myVote1 myVote-1");
$(selector).addClass('myVote' + response.myVote);
$(selector + " .commentLikeBtn > small").attr('class', '');
$(selector + " .commentDislikeBtn > small").attr('class', '');
$(selector + " .commentLikeBtn > small").addClass('totalLikes' + response.likes);
$(selector + " .commentDislikeBtn > small").addClass('totalDislikes' + response.dislikes);
$(selector + " .commentLikeBtn > small").text(response.likes);
$(selector + " .commentDislikeBtn > small").text(response.dislikes);
}
});
}
function addCommentCount(comments_id, total) {
var selector = '.comment_' + comments_id + ' .total_replies';
$(selector).text(parseInt($(selector).text()) + total);
}
$(document).ready(function () {
getComments(0, 1);
});
$(document).ready(function () {
$("#shareDiv").slideUp();
$("#shareBtn").click(function () {
$(".menusDiv").not("#shareDiv").slideUp();
$("#shareDiv").slideToggle();
return false;
});
});
$(document).ready(function() {$('#deleteSelect_sortBy').remove();});
function getSelectformatStateResultsortBy (state) {
if (!state.id) {
return state.text;
}
var $state = $(
'
'+
state.text + ''
);
return $state;
};$(document).ready(function() {$('#sortBy').select2({templateSelection: getSelectformatStateResultsortBy, templateResult: getSelectformatStateResultsortBy,width: '100%'});});
$(function () {
loadVideosListPageTransformLinks();
$('#sortBy, #rowCount').change(function () {
loadVideosListPage(1);
});
videosListDidNotSearchForVideos(); });
var loadVideosListPagerowCount = 'loadVideosListPagerowCount';
var loadVideosListPagesortBy = 'loadVideosListPagesortBy';
function loadVideosListPage(page) {
if (typeof modal === 'undefined') {
setTimeout(function () {
loadVideosListPage(page);
}, 500);
return false;
}
var url = 'https://tube.kadidak.com/view/videosList.php?videos_id=0&sortBy=newest';
var rowCount = $('#rowCount').val();
var sortBy = $('#sortBy').val();
Cookies.set(loadVideosListPagerowCount, rowCount, {
path: '/',
expires: 365
});
Cookies.set(loadVideosListPagesortBy, sortBy, {
path: '/',
expires: 365
});
url = addQueryStringParameter(url, 'rowCount', rowCount);
url = addQueryStringParameter(url, 'sortBy', sortBy);
url = addQueryStringParameter(url, 'current', page);
$.get(url, function (response) {
var videosList = $($.parseHTML(response)).filter("#videosListItems").html();
$('#videosListItems').html(videosList);
animateChilds('#videosListItems', 'animate__flipInX', 0.2);
lazyImage();
avideoSocket();
loadVideosListPageTransformLinks();
modal.hidePleaseWait();
});
}
function loadVideosListPageTransformLinks() {
$('#videosListItems > nav a').click(function (event) {
event.preventDefault();
loadVideosListPage($(this).attr('pageNum'));
});
}
function videosListDidNotSearchForVideos(){
var rowCount = Cookies.get(loadVideosListPagerowCount);
if(!empty(rowCount)){
$('#rowCount').val(rowCount);
}
var sortBy = Cookies.get(loadVideosListPagesortBy);
if(!empty(sortBy)){
$('#sortBy').val(sortBy).trigger('change');
}
loadVideosListPage(1);
}
var fading = false;
var autoPlaySources = [{"type":"video\/mp4","src":"https:\/\/tube.kadidak.com\/videos\/video_230429132136_vee23\/video_230429132136_vee23_1080.mp4","label":"1080p
FHD<\/span>","res":"1080"},{"type":"video\/mp4","src":"https:\/\/tube.kadidak.com\/videos\/video_230429132136_vee23\/video_230429132136_vee23_720.mp4","label":"720p HD<\/span>","res":"720"},{"type":"video\/mp4","src":"https:\/\/tube.kadidak.com\/videos\/video_230429132136_vee23\/video_230429132136_vee23_540.mp4","label":"540p ","res":"540"},{"type":"video\/mp4","src":"https:\/\/tube.kadidak.com\/videos\/video_230429132136_vee23\/video_230429132136_vee23_480.mp4","label":"480p ","res":"480"},{"type":"video\/mp4","src":"https:\/\/tube.kadidak.com\/videos\/video_230429132136_vee23\/video_230429132136_vee23_360.mp4","label":"360p ","res":"360"},{"type":"video\/mp4","src":"https:\/\/tube.kadidak.com\/videos\/video_230429132136_vee23\/video_230429132136_vee23_240.mp4","label":"240p ","res":"240"}];
var autoPlayURL = 'https://tube.kadidak.com/v/93?channelName=Admin&catName=default';
var autoPlayPoster = 'https://tube.kadidak.com/videos/video_230429132136_vee23.jpg';
var autoPlayThumbsSprit = 'https://tube.kadidak.com/videos/video_230429132136_vee23_thumbsSprit.jpg';
$(document).ready(function () {
});
$(function () {
/** showAlertMessage **/
/** showAlertMessage !requestComesFromSafePlace [] **/ });
$(document).ready(function () {
});
$(document).ready(function () {
});
if ('mediaSession' in navigator) {
navigator.mediaSession.metadata = new MediaMetadata({"title":""});
setActionHandlerIfSupported('play', function () { /* Code excerpted. */
player.play();
});
setActionHandlerIfSupported('pause', function () { /* Code excerpted. */
player.pause();
});
setActionHandlerIfSupported('stop', function () { /* Code excerpted. */
player.pause();
});
setActionHandlerIfSupported('seekbackward', function () { /* Code excerpted. */
player.currentTime(player.currentTime() - 5);
});
setActionHandlerIfSupported('seekforward', function () { /* Code excerpted. */
player.currentTime(player.currentTime() + 5);
});
setActionHandlerIfSupported('seekto', function () { /* Code excerpted. */
console.log('mediaSession seekto');
});
setActionHandlerIfSupported('previoustrack', function () { /* Code excerpted. */
try {
player.playlist.previous();
} catch (e) {
}
});
setActionHandlerIfSupported('nexttrack', function () { /* Code excerpted. */
try {
player.playlist.next();
} catch (e) {
if (playNextURL) {
playNext(playNextURL);
}
}
});
setActionHandlerIfSupported('skipad', function () { /* Code excerpted. */
console.log('mediaSession skipad');
});
setPlaylistUpdate();
}
function setPlaylistUpdate() {
if (typeof player == 'undefined' || typeof player.playlist == 'undefined') {
setTimeout(function () {
setPlaylistUpdate();
}, 1000);
return false;
}
console.log('setPlaylistUpdate');
player.on('playlistitem', function () {
updateMediaSessionMetadata();
});
}
function updateMediaSessionMetadata() {
videos_id = 0;
key = 0;
live_servers_id = 0;
live_schedule_id = 0;
if (typeof player.playlist == 'function') {
if (typeof playerPlaylist == 'undefined') {
playerPlaylist = player.playlist();
console.log('updateMediaSessionMetadata playerPlaylist was undefined', playerPlaylist);
}
}
if (typeof player.playlist == 'function' && typeof playerPlaylist !== 'undefined' && !empty(playerPlaylist)) {
index = player.playlist.currentIndex();
if (!empty(playerPlaylist[index])) {
videos_id = playerPlaylist[index].videos_id;
console.log('updateMediaSessionMetadata playerPlaylist[index].videos_id', videos_id);
}
} else if (mediaId) {
videos_id = mediaId;
console.log('updateMediaSessionMetadata mediaId', mediaId);
} else if (isLive) {
key = isLive.key;
live_servers_id = isLive.live_servers_id;
live_schedule_id = isLive.live_schedule_id;
console.log('updateMediaSessionMetadata isLive', key);
}
if (videos_id) {
console.log('updateMediaSessionMetadata', videos_id);
$.ajax({
url: webSiteRootURL + 'plugin/PlayerSkins/mediaSession.json.php',
method: 'POST',
data: {
'videos_id': videos_id,
'key': key,
'live_servers_id': live_servers_id,
'live_schedule_id': live_schedule_id,
},
success: function (response) {
console.log('updateMediaSessionMetadata response', response);
navigator.mediaSession.metadata = new MediaMetadata(response);
}
});
}
}
function setActionHandlerIfSupported(action, func) {
try {
navigator.mediaSession.setActionHandler(action, func);
} catch (e) {
if (e.name != "TypeError")
throw e;
}
}
var currentFontsize = 100;
var accessibilityJustDrag = false;
$(function () {
$('.accessibility-toolbar-overlay a').click(function (event) {
event.preventDefault();
var action = $(this).attr('action');
switch (action) {
case 'increase-text':
var newFontSize = currentFontsize + 10;
if (newFontSize < 150) {
newFontSize = 150;
}
setFontSize(newFontSize);
break;
case 'decrease-text':
var newFontSize = currentFontsize - 10;
if (newFontSize < 150) {
newFontSize = 150;
}
setFontSize(currentFontsize - 10);
break;
case 'grayscale':
$('body').toggleClass('accessibility-grayscale');
$(this).toggleClass('active');
break;
case 'high-contrast':
$('body').toggleClass('accessibility-high-contrast');
$(this).toggleClass('active');
break;
case 'negative-contrast':
$('body').toggleClass('accessibility-negative-contrast');
$(this).toggleClass('active');
break;
case 'links-underline':
$('body').toggleClass('accessibility-links-underline');
$(this).toggleClass('active');
break;
case 'readable-font':
$('body').toggleClass('accessibility-readable-font');
$(this).toggleClass('active');
break;
case 'reset':
resetAccessibility();
break;
default:
break;
}
});
$("#accessibility-toolbar").draggable({
axis: "y",
containment: 'window',
scroll: false,
start: function () {
accessibilityJustDrag=true;;
},
stop: function () {
$("#accessibility-toolbar").css("left", "");
setCookie('accessibility-toolbar-top', $("#accessibility-toolbar").position().top, 30);
setTimeout(function(){accessibilityJustDrag=false;},200);
}
});
setAccessibilityTop();
});
function toogleAccessibility(){
if(accessibilityJustDrag){
return false;
}
$('#accessibility-toolbar').toggleClass('active');
}
function setAccessibilityTop(){
if(typeof getCookie !== 'function'){
setTimeout(function(){setAccessibilityTop();},500);
return false;
}
var accessibilityTop = getCookie('accessibility-toolbar-top');
if(!empty(accessibilityTop)){
console.log('setAccessibilityTop', accessibilityTop);
$("#accessibility-toolbar").css("top", accessibilityTop+'px');
}
$("#accessibility-toolbar").show();
}
function setFontSize(num) {
if (num < 100) {
num = 100;
} else if (num > 300) {
num = 300;
}
for (i = 10; i <= 200; i += 10) {
var fontsizeNum = 100 + i;
$('body').removeClass('accessibility-fontsize-' + fontsizeNum);
}
$('body').addClass('accessibility-fontsize-' + num);
currentFontsize = num;
}
function resetAccessibility() {
$('.accessibility-toolbar-overlay a').removeClass('active');
var classItems = $('body').attr('class').split(/\s+/);
for (var item in classItems) {
var className = classItems[item];
if (/^accessibility/.test(className)) {
$('body').removeClass(className);
}
}
}
$(function () {setTimeout(function(){if(typeof $("#mainNavBar").autoHidingNavbar == "function"){$("#mainNavBar").autoHidingNavbar();}},5000);});
$(function () {
$("#mainNavBar").on("show.autoHidingNavbar", function () {
if ($(window).scrollTop() < 10) {
$("body").removeClass("nopadding");
}
});
$("#mainNavBar").on("hide.autoHidingNavbar", function () {
if ($(window).scrollTop() < 10) {
$("body").addClass("nopadding");
}
});
});
iframeAllowAttributes = 'allow="fullscreen;autoplay;camera *;microphone *;" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"';
var autoPlayVideoURL="https://tube.kadidak.com/v/93?channelName=Admin&catName=default"; var videoJsId = "mainVideo";
var playerSeekForward = 30; var playerSeekBack = 10;var forwardLayer = "\r\n
<\/i>\r\n<\/div>\r\n";var backLayer = "\r\n
<\/i>\r\n<\/div>\r\n";
/* getStartPlayerJS $prepareStartPlayerJS_onPlayerReady = "3", $prepareStartPlayerJS_getDataSetup = "0" */
var videoJsResolutionSwitcherDefault = "720";
var timeOutCopyToClipboard_67d707e03e8be;
$(document).ready(function () {
$('#copyToClipboard_67d707e03e8be').click(function () {
clearTimeout(timeOutCopyToClipboard_67d707e03e8be);
$('#copyToClipboard_67d707e03e8be').find('i').removeClass("fa-clipboard");
$('#copyToClipboard_67d707e03e8be').find('i').addClass("text-success");
$('#copyToClipboard_67d707e03e8be').addClass('bg-success');
$('#copyToClipboard_67d707e03e8be').find('i').addClass("fa-clipboard-check");
timeOutCopyToClipboard_67d707e03e8be = setTimeout(function () {
$('#copyToClipboard_67d707e03e8be').find('i').removeClass("fa-clipboard-check");
$('#copyToClipboard_67d707e03e8be').find('i').removeClass("text-success");
$('#copyToClipboard_67d707e03e8be').removeClass('bg-success');
$('#copyToClipboard_67d707e03e8be').find('i').addClass("fa-clipboard");
}, 3000);
copyToClipboard($('#67d707e03e8be').val());
})
});
function showSharing67d707e03e485() {
if ($('#mainVideo').length) {
$('#SharingModal67d707e03e485').appendTo("#mainVideo");
} else {
$('#SharingModal67d707e03e485').appendTo("body");
}
$('#SharingModal67d707e03e485').modal("show");
$('.modal-backdrop').hide();
return false;
}
$(document).ready(function () {
$('#SharingModal67d707e03e485').modal({show: false});
});
function tooglePlayersocial(){showSharing67d707e03e485();}
var originalVideo;
var adTagOptions;
var _adTagUrl = ''; var player; $(document).ready(function () {
originalVideo = $('#mainVideo').clone();
/* prepareStartPlayerJS_onPlayerReady = 7, prepareStartPlayerJS_getDataSetup = 0 */
if (typeof player === 'undefined' && $('#mainVideo').length) {
player = videojs('mainVideo',{errorDisplay: false,'playbackRates':[0.5, 1, 1.5, 2]});
}
player.ready(function () {player.on('error', () => {
AvideoJSError(player.error().code);
});
player.persistvolume({
namespace: 'AVideo'
});var err = this.error();
if (err && err.code) {
$('.vjs-error-display').hide();
$('#mainVideo').find('.vjs-poster').css({'background-image': 'url(https://tube.kadidak.com/plugin/Live/view/Offline.jpg)'});
}
player.on('play', function () {
addView(63, this.currentTime());
_addViewBeaconAdded = false;
});
player.on('timeupdate', function () {
var time = Math.round(this.currentTime());
playerCurrentTime = time;
var url = 'https://tube.kadidak.com/video/63/che-cos-%C3%A8-la-fisica-che-cos-%C3%A8-la-meccanica?channelName=Admin';
if (url.indexOf('?') > -1) {
url += '&t=' + time;
} else {
url += '?t=' + time;
}
$('#linkCurrentTime, .linkCurrentTime').val(url);
if (time >= 5 && time % 1 === 0) {
addView(63, time);
}else{
addViewFromCookie();
addViewSetCookie(PHPSESSID, 63, time, seconds_watching_video);
}
});
player.on('ended', function () {
var time = Math.round(this.currentTime());
addView(63, time);
});playNextURL = 'https://tube.kadidak.com/v/93?channelName=Admin&catName=default';player.on('ended', function () {setTimeout(function(){if(playNextURL){playNext(playNextURL);}},playerHasAds()?10000:500);});
if(typeof player.hotkeys == 'function'){player.hotkeys({ seekStep: 5,enableVolumeScroll: true,alwaysCaptureHotkeys: true,enableFullscreen: true,fullscreenKey: function(event, player) { return (event.which ===70); },playPauseKey: function(event, player) { return (event.which ===32); },volumeUpKey: function(event, player) { return (event.which === 107); },
volumeDownKey: function(event, player) { return (event.which === 109);},enableModifiersForNumbers: false
});}
player.seekButtons({forward: playerSeekForward, back: playerSeekBack});
var trackDisplayTimeout;
var showingSeekButton = true;
function startTrackDisplay() {
if ($(".vjs-text-track-display").length === 0) {
setTimeout(function () {
startTrackDisplay();
}, 500);
}
console.log("startTrackDisplay started");
$(".vjs-text-track-display").css('pointerEvents', "auto");
$(".vjs-text-track-display").dblclick(function (e) {
e.preventDefault();
console.log("dbl click happen " + trackDisplayTimeout);
clearTimeout(trackDisplayTimeout);
const playerWidth = $("#mainVideo").width();
if (0.66 * playerWidth < e.offsetX) {
$(forwardLayer).prependTo("#mainVideo");
setTimeout(function () {
$("#forwardLayer i").addClass('active');
$('#forwardLayer').fadeOut('slow', function () {
$('#forwardLayer').remove();
});
}, 100);
player.currentTime(player.currentTime() + playerSeekForward);
} else if (e.offsetX < 0.33 * playerWidth) {
$(backLayer).prependTo("#mainVideo");
setTimeout(function () {
$("#backLayer i").addClass('active');
$('#backLayer').fadeOut('slow', function () {
$('#backLayer').remove();
});
}, 100);
player.currentTime((player.currentTime() - playerSeekBack) < 0 ? 0 : (player.currentTime() - playerSeekBack));
} else {
if (player.paused()) {
player.play();
} else {
player.pause();
}
}
});
$(".vjs-text-track-display").click(function (e) {
e.preventDefault();
console.log("single click happen");
clearTimeout(trackDisplayTimeout);
trackDisplayTimeout = setTimeout(function () {
console.log("single click timeout");
if (player.paused()) {
player.play();
} else {
player.pause();
}
}, 300);
console.log("single click register " + trackDisplayTimeout);
});
$( "" ).insertBefore( ".vjs-text-track-display" );
}
startTrackDisplay();
if (player.getChild('controlBar').getChild('PictureInPictureToggle')) {
player.getChild('controlBar').addChild('Theater', {}, getPlayerButtonIndex('PictureInPictureToggle') + 1);
} else {
player.getChild('controlBar').addChild('Theater', {}, getPlayerButtonIndex('fullscreenToggle') - 1);
}
var Button = videojs.getComponent('Button');
var socialButton = videojs.extend(Button, {
//constructor: function(player, options) {
constructor: function () {
Button.apply(this, arguments);
this.addClass('social-button');
this.controlText("social");
setTimeout(function(){avideoTooltip(".social-button","Share");},1000);
},
handleClick: function () {
console.log('socialButton clicked');
tooglePlayersocial();
}
});
videojs.registerComponent('socialButton', socialButton);
player.getChild('controlBar').addChild('socialButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1);
var Button = videojs.getComponent('Button');
var autoplayButton = videojs.extend(Button, {
//constructor: function(player, options) {
constructor: function () {
Button.apply(this, arguments);
this.addClass('autoplay-button');
this.controlText("autoplay");
setTimeout(function(){avideoTooltip(".autoplay-button","Autoplay");},1000);
},
handleClick: function () {
console.log('autoplayButton clicked');
if($('.autoplay-button').hasClass('checked')){
disableAutoPlay();
}else{
enableAutoPlay();
}
}
});
videojs.registerComponent('autoplayButton', autoplayButton);
player.getChild('controlBar').addChild('autoplayButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1);
checkAutoPlay();
updateMediaSessionMetadata();
playerPlayIfAutoPlay(0);
});var Button = videojs.getComponent('Button');
var LoopButton = videojs.extend(Button, {
//constructor: function(player, options) {
constructor: function () {
Button.apply(this, arguments);
this.addClass('loop-button');
if (!isPlayerLoop()) {
this.addClass('loop-disabled-button');
} else {
this.addClass('fa-spin');
}
this.controlText("Loop");
},
handleClick: function () {
tooglePlayerLoop();
}
});
videojs.registerComponent('LoopButton', LoopButton);
player.getChild('controlBar').addChild('LoopButton', {}, 0);var sourcesForAdsInterval = setInterval(function(){
setSourcesForAds();
},200);
function setSourcesForAds(){
if(typeof player ==='undefined'){
return false;
}
if(typeof player.currentSources !== 'function'){
if(typeof player.currentSources === 'object'){
console.log('currentSources changed to function');
var sourcesForAds = player.currentSources;
player.currentSources = function(){return sourcesForAds;};
console.log('currentSources', player.currentSources);
}
}else{
clearTimeout(sourcesForAdsInterval);
setTimeout(function(){
setSourcesForAds();
},1000);
}
}});
var checkFooterTimout;
$(function () {
checkFooter();
$(window).scroll(function () {
clearTimeout(checkFooterTimout);
checkFooterTimout = setTimeout(function () {
checkFooter();
}, 100);
});
$(window).resize(function () {
clearTimeout(checkFooterTimout);
checkFooterTimout = setTimeout(function () {
checkFooter();
}, 100);
});
$(window).mouseup(function () {
clearTimeout(checkFooterTimout);
checkFooterTimout = setTimeout(function () {
checkFooter();
}, 100);
});
});
function checkFooter() {
$("#mainFooter").fadeIn();
if (getPageHeight() <= $(window).height()) {
clearTimeout(checkFooterTimout);
checkFooterTimout = setTimeout(function () {
checkFooter();
}, 1000);
$("#mainFooter").css("position", "fixed");
} else {
$("#mainFooter").css("position", "relative");
}
}
function getPageHeight() {
var mainNavBarH = 0;
if ($('#mainNavBar').length) {
mainNavBarH = $('#mainNavBar').height();
}
var mainFooterH = 0;
if ($('#mainFooter').length) {
mainFooterH = $('#mainFooter').height();
}
var containerH = getLargerContainerHeight();
return mainNavBarH + mainFooterH + containerH;
}
function getLargerContainerHeight() {
var conteiners = $('body > .container,body > .container-fluid');
var height = 0;
for (var item in conteiners) {
if (isNaN(item)) {
continue;
}
var h = $(conteiners[item]).height();
if (h > height) {
height = h;
}
}
return height;
}
var fading = false;