| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/new-saint-martin/plugins/pagebuilderck/gallery/assets/ |
Upload File : |
/**
* @name Page Builder CK
* @package com_pagebuilderck
* @copyright Copyright (C) 2017. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
*/
/*
* Plugin to manage the gallery
*/
(function($) {
"use strict";
var PBCK_gallery = function(el, opts) {
if (!(this instanceof PBCK_gallery)) return new PBCK_gallery(el, opts);
// init vars
var defaults = {};
var opts = $.extend(defaults, opts);
var t = this;
t.gallery = $(el);
var isInterface = t.gallery.parents('#workspaceck').length || t.gallery.parents('#previewarea').length;
var loader;
var rad = 0;
var radSum = 0.005;
opts.autoplay = t.gallery.find('.pbck_slides').attr('data-autoplay') == '1' && !isInterface;
opts.pausehover = t.gallery.find('.pbck_slides').attr('data-pausehover') == '1' && !isInterface;
opts.time = t.gallery.find('.pbck_slides').attr('data-time') || 5000;
t.gallery.anim = function(control) {anim(control)};
t.gallery.data('processed', '1');
init();
// activate autoplay only if not in edition mode
if (opts.autoplay) autoplay();
if (opts.pausehover == '1') {
t.gallery.hover(
function() {
$(this).addClass('pausedck');
}, function() {
$(this).removeClass('pausedck');
}
);
}
function init() {
t.gallery.removeClass('pbck_animate');
t.gallery.height('');
t.gallery.find('.pbck_wrapinner')
.width((t.gallery.find('.pbck_slide').length*100)+'%')
.css('marginLeft', '0');
t.gallery.find('.pbck_slide').width((100/t.gallery.find('.pbck_slide').length)+'%');
t.gallery.find('.pbck_slide.current').removeClass('current');
t.gallery.find('.pbck_slide').eq(0).addClass('current');
t.gallery.find('.pbck_gallery_control').click(function() { t.gallery.anim(this); });
t.gallery.addClass('pbck_animate');
}
function next() {
anim(t.gallery.find('.control_next'));
}
function prev() {
anim(t.gallery.find('.control_prev'));
}
function anim(control) {
var nb = t.gallery.find('.pbck_slide').length;
var index;
var cur_slide = t.gallery.find('.pbck_slide.current');
if ($(control).hasClass('control_next')) {
if (t.gallery.find('.pbck_slide.current').next().length) {
index = t.gallery.find('.pbck_slide').index(cur_slide) + 1;
} else {
index = 0;
}
} else {
if (t.gallery.find('.pbck_slide.current').prev().length) {
index = t.gallery.find('.pbck_slide').index(cur_slide) - 1;
} else {
index = nb - 1;
}
}
t.gallery.find('.pbck_wrapinner').css('margin-left', '-'+(index*100)+'%');
t.gallery.find('.pbck_slide.current').removeClass('current');
t.gallery.find('.pbck_slide').eq(index).addClass('current');
t.gallery.animate({'height': t.gallery.find('.pbck_slide').eq(index).height()}, 300);
resetAutoplay();
if (opts.autoplay) autoplay();
}
function autoplay() {
if (! opts.autoplay) return;
clearInterval(loader);
loader = setInterval(
function(){
if(rad<1 && !t.gallery.hasClass('pausedck')){
rad = (rad+radSum);
if (rad > 1) rad = 1;
} else if (rad<=1 && t.gallery.hasClass('pausedck')){
rad = rad;
} else {
clearInterval(loader);
if(!t.gallery.hasClass('pausedck')) {
resetAutoplay();
next();
}
}
}
, opts.time*radSum);
}
function resetAutoplay() {
clearInterval(loader);
rad = 0;
}
// return instance
return t;
}
window.PBCK_gallery = PBCK_gallery;
})(jQuery);
// function used in the interface when creating a new gallery
function pbck_gallery_init(galleryId) {
new PBCK_gallery(document.getElementById(galleryId));
}
function pbck_gallery_show(control) {
// B/C to avoid JS errors on click on the controls
}
jQuery(document).ready(function(){
// Loop though all gallerys to initialise them
jQuery('.pbck_gallery').each(function() {
new PBCK_gallery(this);
});
});