mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
This commit is contained in:
parent
98ac870e2d
commit
e8fc8c22ce
1 changed files with 79 additions and 66 deletions
|
@ -1,26 +1,22 @@
|
||||||
var modal;
|
var modal;
|
||||||
var player;
|
var player;
|
||||||
|
|
||||||
var floatLeft = "";
|
var floatLeft = "";
|
||||||
var floatTop = "";
|
var floatTop = "";
|
||||||
var floatWidth = "";
|
var floatWidth = "";
|
||||||
var floatHeight = "";
|
var floatHeight = "";
|
||||||
|
|
||||||
var changingVideoFloat = 0;
|
var changingVideoFloat = 0;
|
||||||
var floatClosed = 0;
|
var floatClosed = 0;
|
||||||
var fullDuration = 0;
|
var fullDuration = 0;
|
||||||
var isPlayingAd = false;
|
var isPlayingAd = false;
|
||||||
|
|
||||||
var mainVideoHeight = 0;
|
var mainVideoHeight = 0;
|
||||||
var doNotFloatVideo = false;
|
var doNotFloatVideo = false;
|
||||||
|
|
||||||
var mouseX;
|
var mouseX;
|
||||||
var mouseY;
|
var mouseY;
|
||||||
|
var videoContainerDragged = false;
|
||||||
$(document).mousemove(function (e) {
|
$(document).mousemove(function (e) {
|
||||||
mouseX = e.pageX;
|
mouseX = e.pageX;
|
||||||
mouseY = e.pageY;
|
mouseY = e.pageY;
|
||||||
});
|
});
|
||||||
|
|
||||||
String.prototype.stripAccents = function () {
|
String.prototype.stripAccents = function () {
|
||||||
var returnvar = this.replace(/[áàâãªä]/g, 'a');
|
var returnvar = this.replace(/[áàâãªä]/g, 'a');
|
||||||
returnvar = returnvar.replace(/[ÁÀÂÃÄ]/g, 'A');
|
returnvar = returnvar.replace(/[ÁÀÂÃÄ]/g, 'A');
|
||||||
|
@ -140,8 +136,56 @@ try {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFloatVideo() {
|
||||||
|
if (!videoContainerDragged) {
|
||||||
|
if (!floatLeft || parseInt(floatLeft) < 10 || parseInt(floatLeft) === 310) {
|
||||||
|
floatLeft = "10px";
|
||||||
|
}
|
||||||
|
if (parseInt(floatLeft) === 10 && youTubeMenuIsOpened) {
|
||||||
|
floatLeft = "310px";
|
||||||
|
}
|
||||||
|
$("#videoContainer").css({"left": floatLeft});
|
||||||
|
}
|
||||||
|
if (!$('#videoContainer').hasClass("floatVideo") && !floatClosed) {
|
||||||
|
$('#videoContainer').hide();
|
||||||
|
$('#videoContainer').addClass('floatVideo');
|
||||||
|
$('#videoContainer').parent().css('height', mainVideoHeight);
|
||||||
|
if (parseInt(floatTop) < 70) {
|
||||||
|
floatTop = "70px";
|
||||||
|
}
|
||||||
|
$("#videoContainer").css({"top": floatTop});
|
||||||
|
$("#videoContainer").css({"height": floatHeight});
|
||||||
|
$("#videoContainer").css({"width": floatWidth});
|
||||||
|
$("#videoContainer").resizable({
|
||||||
|
aspectRatio: 16 / 9,
|
||||||
|
minHeight: 150,
|
||||||
|
minWidth: 266
|
||||||
|
});
|
||||||
|
$("#videoContainer").draggable({
|
||||||
|
handle: ".move",
|
||||||
|
containment: ".principalContainer",
|
||||||
|
drag: function () {
|
||||||
|
videoContainerDragged = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
changingVideoFloat = 0;
|
||||||
|
$('#videoContainer').fadeIn();
|
||||||
|
$('#floatButtons').fadeIn();
|
||||||
|
} else {
|
||||||
|
changingVideoFloat = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var pleaseWaitIsINUse = false;
|
var pleaseWaitIsINUse = false;
|
||||||
|
var setFloatVideoYouTubeMenuIsOpened;
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
setInterval(function () {
|
||||||
|
if (setFloatVideoYouTubeMenuIsOpened === youTubeMenuIsOpened || !$('#videoContainer').hasClass("floatVideo")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
setFloatVideoYouTubeMenuIsOpened = youTubeMenuIsOpened;
|
||||||
|
setFloatVideo();
|
||||||
|
}, 1000);
|
||||||
modal = modal || (function () {
|
modal = modal || (function () {
|
||||||
var pleaseWaitDiv = $("#pleaseWaitDialog");
|
var pleaseWaitDiv = $("#pleaseWaitDialog");
|
||||||
if (pleaseWaitDiv.length === 0) {
|
if (pleaseWaitDiv.length === 0) {
|
||||||
|
@ -168,14 +212,14 @@ $(document).ready(function () {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
$('[data-toggle="popover"]').popover();
|
$('[data-toggle="popover"]').popover();
|
||||||
$('[data-toggle="tooltip"]').tooltip({container: 'body'});
|
$('[data-toggle="tooltip"]').tooltip({container: 'body'});
|
||||||
$('[data-toggle="tooltip"]').on('click', function () {
|
$('[data-toggle="tooltip"]').on('click', function () {
|
||||||
var t = this;
|
var t = this;
|
||||||
setTimeout(function(){$(t).tooltip('hide');}, 2000);
|
setTimeout(function () {
|
||||||
|
$(t).tooltip('hide');
|
||||||
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".thumbsImage").on("mouseenter", function () {
|
$(".thumbsImage").on("mouseenter", function () {
|
||||||
gifId = $(this).find(".thumbsGIF").attr('id');
|
gifId = $(this).find(".thumbsGIF").attr('id');
|
||||||
$(".thumbsGIF").fadeOut();
|
$(".thumbsGIF").fadeOut();
|
||||||
|
@ -190,11 +234,9 @@ $(document).ready(function () {
|
||||||
$(this).find(".thumbsGIF").stop(true, true).fadeIn();
|
$(this).find(".thumbsGIF").stop(true, true).fadeIn();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".thumbsImage").on("mouseleave", function () {
|
$(".thumbsImage").on("mouseleave", function () {
|
||||||
$(this).find(".thumbsGIF").stop(true, true).fadeOut();
|
$(this).find(".thumbsGIF").stop(true, true).fadeOut();
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($(".thumbsJPG").length) {
|
if ($(".thumbsJPG").length) {
|
||||||
$('.thumbsJPG').lazy({
|
$('.thumbsJPG').lazy({
|
||||||
effect: 'fadeIn',
|
effect: 'fadeIn',
|
||||||
|
@ -215,37 +257,10 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
changingVideoFloat = 1;
|
changingVideoFloat = 1;
|
||||||
var s = $(window).scrollTop();
|
var s = $(window).scrollTop();
|
||||||
|
console.log("$(window).scrollTop()= " + s);
|
||||||
|
console.log("mainVideoHeight = $('#videoContainer').innerHeight()= " + mainVideoHeight);
|
||||||
if (s > mainVideoHeight) {
|
if (s > mainVideoHeight) {
|
||||||
if (!$('#videoContainer').hasClass("floatVideo") && !floatClosed) {
|
setFloatVideo();
|
||||||
$('#videoContainer').hide();
|
|
||||||
$('#videoContainer').addClass('floatVideo');
|
|
||||||
$('#videoContainer').parent().css('height', mainVideoHeight);
|
|
||||||
if (parseInt(floatTop) < 70) {
|
|
||||||
floatTop = "70px";
|
|
||||||
}
|
|
||||||
if (parseInt(floatLeft) < 10) {
|
|
||||||
floatLeft = "10px";
|
|
||||||
}
|
|
||||||
$("#videoContainer").css({"top": floatTop});
|
|
||||||
$("#videoContainer").css({"left": floatLeft});
|
|
||||||
$("#videoContainer").css({"height": floatHeight});
|
|
||||||
$("#videoContainer").css({"width": floatWidth});
|
|
||||||
|
|
||||||
$("#videoContainer").resizable({
|
|
||||||
aspectRatio: 16 / 9,
|
|
||||||
minHeight: 150,
|
|
||||||
minWidth: 266
|
|
||||||
});
|
|
||||||
$("#videoContainer").draggable({
|
|
||||||
handle: ".move",
|
|
||||||
containment: ".principalContainer"
|
|
||||||
});
|
|
||||||
changingVideoFloat = 0;
|
|
||||||
$('#videoContainer').fadeIn();
|
|
||||||
$('#floatButtons').fadeIn();
|
|
||||||
} else {
|
|
||||||
changingVideoFloat = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
floatClosed = 0;
|
floatClosed = 0;
|
||||||
if ($('#videoContainer').hasClass("floatVideo")) {
|
if ($('#videoContainer').hasClass("floatVideo")) {
|
||||||
|
@ -255,7 +270,6 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("a").each(function () {
|
$("a").each(function () {
|
||||||
var location = window.location.toString()
|
var location = window.location.toString()
|
||||||
var res = location.split("?");
|
var res = location.split("?");
|
||||||
|
@ -266,8 +280,6 @@ $(document).ready(function () {
|
||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#clearCache, .clearCacheButton').on('click', function (ev) {
|
$('#clearCache, .clearCacheButton').on('click', function (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
|
@ -283,7 +295,6 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.clearCacheFirstPageButton').on('click', function (ev) {
|
$('.clearCacheFirstPageButton').on('click', function (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
|
@ -299,7 +310,6 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#generateSiteMap, .generateSiteMapButton').on('click', function (ev) {
|
$('#generateSiteMap, .generateSiteMapButton').on('click', function (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
|
@ -315,9 +325,7 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function removeTracks() {
|
function removeTracks() {
|
||||||
var oldTracks = player.remoteTextTracks();
|
var oldTracks = player.remoteTextTracks();
|
||||||
var i = oldTracks.length;
|
var i = oldTracks.length;
|
||||||
|
@ -361,7 +369,6 @@ function changeVideoSrcLoad() {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,7 +473,6 @@ function closeFloatVideo() {
|
||||||
$("#videoContainer").css({"left": ""});
|
$("#videoContainer").css({"left": ""});
|
||||||
$("#videoContainer").css({"height": ""});
|
$("#videoContainer").css({"height": ""});
|
||||||
$("#videoContainer").css({"width": ""});
|
$("#videoContainer").css({"width": ""});
|
||||||
|
|
||||||
$('#videoContainer').parent().css('height', '');
|
$('#videoContainer').parent().css('height', '');
|
||||||
$('#videoContainer').removeClass('floatVideo');
|
$('#videoContainer').removeClass('floatVideo');
|
||||||
$("#videoContainer").resizable('destroy');
|
$("#videoContainer").resizable('destroy');
|
||||||
|
@ -489,7 +495,6 @@ function mouseEffect() {
|
||||||
$(this).find(".thumbsGIF").width($(this).find(".thumbsJPG").width());
|
$(this).find(".thumbsGIF").width($(this).find(".thumbsJPG").width());
|
||||||
$(this).find(".thumbsGIF").stop(true, true).fadeIn();
|
$(this).find(".thumbsGIF").stop(true, true).fadeIn();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".thumbsImage").on("mouseleave", function () {
|
$(".thumbsImage").on("mouseleave", function () {
|
||||||
$(this).find(".thumbsGIF").stop(true, true).fadeOut();
|
$(this).find(".thumbsGIF").stop(true, true).fadeOut();
|
||||||
});
|
});
|
||||||
|
@ -617,7 +622,6 @@ function playerPlay(currentTime) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
|
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +630,6 @@ function playerPlay(currentTime) {
|
||||||
console.log("playerPlay: Autoplay was prevented, trying to mute and play ***");
|
console.log("playerPlay: Autoplay was prevented, trying to mute and play ***");
|
||||||
player.muted(true);
|
player.muted(true);
|
||||||
playerPlay(currentTime);
|
playerPlay(currentTime);
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
promisePlayTimeout = setTimeout(function () {
|
promisePlayTimeout = setTimeout(function () {
|
||||||
|
@ -656,3 +659,13 @@ function formatBytes(bytes, decimals) {
|
||||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function alertHTMLText(title, text) {
|
||||||
|
var span = document.createElement("span");
|
||||||
|
span.innerHTML = text;
|
||||||
|
|
||||||
|
swal({
|
||||||
|
title: title,
|
||||||
|
content: span
|
||||||
|
});
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue