| 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/saint-martin-lg/plugins/pagebuilderck/testimonials/assets/ |
Upload File : |
/**
* @name Page Builder CK
* @package com_pagebuilderck
* @copyright Copyright (C) 2015. 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 testimonials
*/
(function($) {
"use strict";
var PBCK_testimonials = function(el, opts) {
if (!(this instanceof PBCK_testimonials)) return new PBCK_testimonials(el, opts);
// init vars
var defaults = {};
var opts = $.extend(defaults, opts);
var t = this;
t.testimonials = $(el);
// if (t.testimonials.data('processed') == '1') return t;
var isInterface = t.testimonials.parents('#workspaceck').length || t.testimonials.parents('#previewarea').length;
var loader;
var rad = 0;
var radSum = 0.005;
opts.autoplay = t.testimonials.find('.pbck_testimonials').attr('data-autoplay') == '1' && !isInterface;
opts.pausehover = t.testimonials.find('.pbck_testimonials').attr('data-pausehover') == '1' && !isInterface;
opts.time = t.testimonials.find('.pbck_testimonials').attr('data-time') || 5000;
opts.random = t.testimonials.find('.pbck_testimonials').attr('data-random') || '0';
t.testimonials.anim = function(control) {anim(control)};
// if (t.testimonials.data('processed') == '1') return t.testimonials;
t.testimonials.data('processed', '1');
init();
// activate autoplay only if not in edition mode
if (opts.autoplay ) autoplay();
// t.testimonials.find('.pbck_t.testimonials_control').click(function() {
// animate($(this));
// });
if (opts.pausehover == '1') {
t.testimonials.hover(
function() {
$(this).addClass('pausedck');
}, function() {
$(this).removeClass('pausedck');
}
);
}
function init() {
// random list
if (opts.random === '1' && !isInterface) {
var ul = t.testimonials.find('.pbck_wrapinner')[0];
for (var i = ul.children.length; i >= 0; i--) {
ul.appendChild(ul.children[Math.random() * i | 0]);
}
}
t.testimonials.removeClass('pbck_animate');
t.testimonials.height('');
t.testimonials.find('.pbck_wrapinner')
.width((t.testimonials.find('.pbck_testimonial').length*100)+'%')
.css('marginLeft', '0');
t.testimonials.find('.pbck_testimonial').width((100/t.testimonials.find('.pbck_testimonial').length)+'%');
t.testimonials.find('.pbck_testimonial.current').removeClass('current');
t.testimonials.find('.pbck_testimonial').eq(0).addClass('current');
t.testimonials.find('.pbck_testimonials_control').click(function() { t.testimonials.anim(this); });
t.testimonials.addClass('pbck_animate');
}
function next() {
anim(t.testimonials.find('.control_next'));
}
function prev() {
anim(t.testimonials.find('.control_prev'));
}
function anim(control) {
var nb = t.testimonials.find('.pbck_testimonial').length;
var index;
var cur_testimonial = t.testimonials.find('.pbck_testimonial.current');
if ($(control).hasClass('control_next')) {
if (t.testimonials.find('.pbck_testimonial.current').next().length) {
index = t.testimonials.find('.pbck_testimonial').index(cur_testimonial) + 1;
} else {
index = 0;
}
} else {
if (t.testimonials.find('.pbck_testimonial.current').prev().length) {
index = t.testimonials.find('.pbck_testimonial').index(cur_testimonial) - 1;
} else {
index = nb - 1;
}
}
t.testimonials.find('.pbck_wrapinner').css('margin-left', '-'+(index*100)+'%');
t.testimonials.find('.pbck_testimonial.current').removeClass('current');
t.testimonials.find('.pbck_testimonial').eq(index).addClass('current');
t.testimonials.animate({'height': t.testimonials.find('.pbck_testimonial').eq(index).height()}, 300);
resetAutoplay();
if (opts.autoplay) autoplay();
}
function autoplay() {
if (! opts.autoplay) return;
// if (t.testimonials.hasClass('pausedck')) return;
clearInterval(loader);
loader = setInterval(
function(){
if(rad<1 && !t.testimonials.hasClass('pausedck')){
rad = (rad+radSum);
if (rad > 1) rad = 1;
// pieLoaderBar.css({'width':(rad*100)+'%'});
} else if (rad<=1 && t.testimonials.hasClass('pausedck')){
rad = rad;
} else {
clearInterval(loader);
if(!t.testimonials.hasClass('pausedck')) {
resetAutoplay();
next();
}
}
}
, opts.time*radSum);
}
function resetAutoplay() {
clearInterval(loader);
rad = 0;
// pieLoaderBar.css('width', '0');
}
// return instance
return t;
}
window.PBCK_testimonials = PBCK_testimonials;
})(jQuery);
function pbck_testimonials_init(testimonialsId) {
new PBCK_testimonials(document.getElementById(testimonialsId));
}
function pbck_testimonials_show(control) {
// B/C to avoid JS errors on click on the controls
// jQuery(control).parents('.pbck_testimonials.inner, .pbck_testimonier')[0].pbcktestimonials.anim(control);
}
jQuery(document).ready(function(){
// Loop though all testimonials to initialise them
// .pbck_testimonials.inner used for backward compatibility
jQuery('.pbck_testimonials.inner, .pbck_testimonier').each(function() {
new PBCK_testimonials(this);
});
});
/*
function pbck_testimonials_init(testimonialsname) {
var testimonials = jQuery('#'+testimonialsname);
testimonials.find('.pbck_wrapinner').width((testimonials.find('.pbck_testimonial').length*100)+'%');
testimonials.find('.pbck_testimonial').width((100/testimonials.find('.pbck_testimonial').length)+'%');
testimonials.find('.pbck_testimonial.current').removeClass('current');
testimonials.find('.pbck_testimonial').eq(0).addClass('current');
}
function pbck_testimonials_show(control) {
var testimonials = jQuery(jQuery(control).parents('.pbck_testimonials')[0]);
var nb = testimonials.find('.pbck_testimonial').length;
var index;
var cur_testimonial = testimonials.find('.pbck_testimonial.current');
if (jQuery(control).hasClass('control_next')) {
if (testimonials.find('.pbck_testimonial.current').next().length) {
index = testimonials.find('.pbck_testimonial').index(cur_testimonial) + 1;
} else {
index = 0;
}
} else {
if (testimonials.find('.pbck_testimonial.current').prev().length) {
index = testimonials.find('.pbck_testimonial').index(cur_testimonial) - 1;
} else {
index = nb - 1;
}
}
testimonials.find('.pbck_wrapinner').css('margin-left', '-'+(index*100)+'%');
testimonials.find('.pbck_testimonial.current').removeClass('current');
testimonials.find('.pbck_testimonial').eq(index).addClass('current');
testimonials.animate({'height': testimonials.find('.pbck_testimonial').eq(index).height()}, 300);
jQuery(window).bind('resize',function(){
testimonials.animate({'height': testimonials.find('.pbck_testimonial').eq(index).height()}, 300);
});
}
*/