Co to za język programowania: $(document).ready(function() { var $videoPlayer, excerptStart, excerptTimeout, $videoPlayButton, $videoLayer, $videoToggle, paymentModal, dataOptions, videoOptions, video;
init();
function removePlayer (video) { video.dispose(); $videoLayer.remove(); $videoToggle.show(); $videoLayer.hide();
if (videoOptions.showModalOnTimeout) { paymentModal.showPayments(); } }
function setCurrentTime (video, excerptStart) { if (excerptStart) { video.currentTime(excerptStart); } }
$(document).ready(function() {
var $videoPlayer,
excerptStart,
excerptTimeout,
$videoPlayButton,
$videoLayer,
$videoToggle,
paymentModal,
dataOptions,
videoOptions,
video;
init();
function removePlayer (video) {
video.dispose();
$videoLayer.remove();
$videoToggle.show();
$videoLayer.hide();
if (videoOptions.showModalOnTimeout) {
paymentModal.showPayments();
}
}
function setCurrentTime (video, excerptStart) {
if (excerptStart) {
video.currentTime(excerptStart);
}
}
function hideOnTimeout () {
setTimeout(function () {
removePlayer(video)
}, excerptTimeout);
}
function play () {
if (!$('#video-player').length) {
return false;
}
$videoToggle.hide();
$videoLayer.show();
if (excerptStart) {
setCurrentTime(video, excerptStart);
video.play();
} else {
video.play();
}
hideOnTimeout();
}
function listeners () {
$videoPlayButton.on('click', function () {
play();
});
}
function initOptions () {
videoOptions = {
autoplay: false,
showModalOnTimeout: true
};
if ($videoPlayer.attr('data-options')) {
dataOptions = JSON.parse($videoPlayer.attr('data-options'));
if (typeof dataOptions.autoplay !== "undefined") {
videoOptions.autoplay = dataOptions.autoplay
}
if (typeof dataOptions.showModalOnTimeout !== "undefined") {
videoOptions.showModalOnTimeout = dataOptions.showModalOnTimeout;
}
}
}
function initVideo () {
if ($videoPlayer.length) {
video = videojs('video-player');
video.load();
listeners();
if (videoOptions.autoplay) {
play();
}
}
}
function _init () {
$videoPlayer = $('#video-player');
excerptStart = $videoPlayer.data('excerpt-start');
excerptTimeout = $videoPlayer.data('excerpt-time') * 1000;
$videoPlayButton = $('#video-play-button');
$videoLayer = $('.video-layer');
$videoToggle = $('.video-toggle');
paymentModal = new PaymentModal();
paymentModal.init();
initOptions();
initVideo();
}
});
#programowanie #hacking #informatyka #pomoc #pytanie