PageSourceSearch

https://carmelinasrestaurant.com/wp-content/themes/basilico/elements/assets/js/pxl-elements.js?ver=1.1

js carmelinasrestaurant.com collected 2026-10-09 22:24:39 UTC 19,127 bytes, 514 lines download raw bytes

1( function( $ ) {
2    /**
3     * @param $scope The Widget wrapper element as a jQuery element
4     * @param $ The jQuery alias
5     */
6    
7    'use strict';
8    function pxl_widget_show_on_column_hover() {
9        $('.elementor-column .elementor-widget-wrap').each(function(){
10            if ($(this).find('> .pxl-show-on-column-hover').length > 0) {
11                $(this).addClass('pxl-column-hover-show-widget');
12            }
13        });
14    }
15    function pxl_section_start_render(){
16        var _elementor = typeof elementor != 'undefined' ? elementor : elementorFrontend;
17        _elementor.hooks.addFilter( 'pxl_section_start_render', function( html, settings, el ) {
18            if(typeof settings.pxl_parallax_bg_img != 'undefined' && settings.pxl_parallax_bg_img.url != ''){
19                html += '<div class="pxl-section-bg-parallax"></div>';
20            }
21            if(typeof settings.pxl_bg_ken_burns_bg_img != 'undefined' && settings.pxl_bg_ken_burns_bg_img.url != ''){
22                html += '<div class="pxl-section-bg-ken-burns"></div>';
23            }
24              
25            return html;
26        } );
27    }  
28    function pxl_animation_handler( $scope ) {
29        elementorFrontend.waypoint($scope.find('.pxl-animate'), function () {
30            var $animate_el = $(this),
31                data = $animate_el.data('settings');
32            if(typeof data['animation'] != 'undefined'){
33                setTimeout(function () {
34                    $animate_el.removeClass('pxl-invisible').addClass('animated ' + data['animation']);
35                }, data['animation_delay']);
36            }
37        });
38        elementorFrontend.waypoint($scope.find('.pxl-border-animated'), function () {
39            $(this).addClass('pxl-animated');
40        });
41        elementorFrontend.waypoint($scope.find('.pxl-scroll'), function () {
42            $(this).addClass('pxl-animated');
43        });
44        elementorFrontend.waypoint($scope.find('.pxl-image-wg.draw-from-top'), function () {
45            var $el = $(this),
46                data = $el.data('settings');
47            if(typeof data != 'undefined'){
48                setTimeout(function () {
49                    $el.addClass('pxl-animated');
50                }, data['animation_delay']);
51            }else{
52                $el.addClass('pxl-animated');
53            }
54        });
55        elementorFrontend.waypoint($scope.find('.pxl-image-wg.draw-from-left'), function () {
56            var $el = $(this),
57                data = $el.data('settings');
58            if(typeof data != 'undefined'){
59                setTimeout(function () {
60                    $el.addClass('pxl-animated');
61                }, data['animation_delay']);
62            }else{
63                $el.addClass('pxl-animated');
64            }
65        });
66        elementorFrontend.waypoint($scope.find('.pxl-image-wg.draw-from-right'), function () {
67            var $el = $(this),
68                data = $el.data('settings');
69            if(typeof data != 'undefined'){
70                setTimeout(function () {
71                    $el.addClass('pxl-animated');
72                }, data['animation_delay']);
73            }else{
74                $el.addClass('pxl-animated');
75            }
76        });
77        elementorFrontend.waypoint($scope.find('.pxl-image-wg.move-from-left'), function () {
78            $(this).addClass('pxl-animated');
79        });
80        elementorFrontend.waypoint($scope.find('.pxl-image-wg.move-from-right'), function () {
81            $(this).addClass('pxl-animated');
82        }); 
83        elementorFrontend.waypoint($scope.find('.pxl-image-wg.skew-in'), function () {
84            $(this).addClass('pxl-animated');
85        });
86        elementorFrontend.waypoint($scope.find('.pxl-image-wg.skew-in-right'), function () {
87            $(this).addClass('pxl-animated');
88        });
89
90    }
91    function pxlMouseDirection(){
92        $('.pxl-grid-direction .item-direction').each(function () {
93            $(this).on('mouseenter',function(ev){
94                addClass( ev, this, 'mouse-in in' );
95            });
96            $(this).on('mouseleave',function(ev){
97                addClass( ev, this, 'mouse-out out' );
98            });
99        });
100
101    }
102    function getDirection(ev, obj) {
103        var w = $(obj).width(),
104            h = $(obj).height(),
105            x = (ev.pageX - $(obj).offset().left - (w / 2)) * (w > h ? (h / w) : 1),
106            y = (ev.pageY - $(obj).offset().top - (h / 2)) * (h > w ? (w / h) : 1),
107            d = Math.round( Math.atan2(y, x) / 1.57079633 + 5 ) % 4;
108        return d;
109    }
110    function addClass( ev, obj, state ) {
111        var direction = getDirection( ev, obj ),
112            class_suffix = null;
113        $(obj).removeAttr('class');
114        switch ( direction ) {
115            case 0 : class_suffix = '-top';    break;
116            case 1 : class_suffix = '-right';  break;
117            case 2 : class_suffix = '-bottom'; break;
118            case 3 : class_suffix = '-left';   break;
119        }
120        $(obj).addClass( state + class_suffix );
121    }
122    $.fn.ctDeriction = function () {
123    }
124    $('.pxl-grid-direction .item-direction').ctDeriction();
125
126    function pxl_parallax_bg(){
127        $(document).find('.pxl-parallax-background').parallaxBackgroun
127d({
128            event: 'mouse_move',
129            animation_type: 'shift',
130            animate_duration: 2
131        });
132        $(document).find('.pxl-pll-basic').parallaxBackground();
133        $(document).find('.pxl-pll-rotate').parallaxBackground({
134            animation_type: 'rotate',
135            zoom: 50,
136            rotate_perspective: 500
137        });
138        $(document).find('.pxl-pll-mouse-move').parallaxBackground({
139            event: 'mouse_move',
140            animation_type: 'shift',
141            animate_duration: 2
142        });
143        $(document).find('.pxl-pll-mouse-move-rotate').parallaxBackground({
144            event: 'mouse_move',
145            animation_type: 'rotate',
146            animate_duration: 1,
147            zoom: 70,
148            rotate_perspective: 1000
149        });
150    }
151
152    function pxl_parallax_effect(){ 
153        if( $(document).find('.pxl-parallax-effect.mouse-move').length > 0 ){
154
155            setTimeout(function(){
156                $('.pxl-parallax-effect.mouse-move').each(function(index, el) {
157                    var $this = $(this);
158                    var $bound = 'undefined'; 
159                    
160                    if( $this.closest('.mouse-move-bound').length > 0 ){
161                        $bound = $this.closest('.mouse-move-bound');
162                    }
163                    if ( $(this).hasClass('bound-section') ){
164                        $bound = $this.closest('.elementor-section');
165                    }
166                    if ( $(this).hasClass('bound-column') ){
167                        $bound = $this.closest('.elementor-column');
168                    }
169                    if ( $(this).hasClass('mouse-move-scope') ){
170                        $bound = $this.parents('.mouse-move-scope');
171                        if( $bound.length <= 0 )
172                            $bound = $this;
173                    }
174
175                    if( $bound != 'undefined' && $bound.length > 0 )
176                        pxl_parallax_effect_mousemove($this, $bound);
177                });
178            }, 600);
179        }
180    }
181    function pxl_parallax_effect_mousemove($this, $bound){  
182        
183        var rect = $bound[0].getBoundingClientRect();
184         
185        var mouse = {x: 0, y: 0, moved: false};
186       
187        $bound.on("mouseenter", function() { 
188            mouse.moved = true;  
189        }); 
190        $bound.on("mouseleave", function() { 
191            mouse.moved = false;
192            gsap.to($this[0], {
193                duration: 0.5,
194                x: 0,
195                y: 0,
196            });  
197        });   
198
199        $bound.mousemove(function(e) {
200            mouse.moved = true;
201            mouse.x = e.clientX - rect.left;
202            mouse.y = e.clientY - rect.top;
203            gsap.to($this[0], {
204                duration: 0.5,
205                x: (mouse.x - rect.width / 2) / rect.width * -100,
206                y: (mouse.y - rect.height / 2) / rect.height * -100
207            });
208        });
209          
210        $(window).on('resize scroll', function(){
211            rect = $bound[0].getBoundingClientRect();
212        })
213    }
214
215    function pxl_split_text($scope){
216          
217        var st = $scope.find(".pxl-split-text");
218        if(st.length == 0) return;
219
220        gsap.registerPlugin(SplitText);
221        
222        st.each(function(index, el) {
223           var els = $(el).find('p, a').length > 0 ? $(el).find('p, a')[0] : el;
224            const pxl_split = new SplitText(els, { 
225                type: "lines, words, chars",
226                lineThreshold: 0.5,
227                linesClass: "split-line"
228            });
229            var split_type_set = pxl_split.chars;
230           
231            gsap.set(els, { perspective: 400 });
232 
233            var settings = {
234                scrollTrigger: {
235                    trigger: els,
236                    toggleActions: "play none none none", //play reset play reset 
237                    start: "top 95%",
238                },
239                duration: 0.8, 
240                stagger: 0.02,
241                ease: "power3.out",
242            };
243            if( $(el).hasClass('split-in-fade') ){
244                settings.opacity = 0;
245            }
246            if( $(el).hasClass('split-in-right') ){
247                settings.opacity = 0;
248                settings.x = "50";
249            }
250            if( $(el).hasClass('split-in-left') ){
251                settings.opacity = 0;
252                settings.x = "-50";
253            }
254            if( $(el).hasClass('split-in-up') ){
255                settings.opacity = 0;
256                settings.y = "80";
257            }
258            if( $(el).hasClass('split-in-down') ){
259                settings.opacity = 0;
260                settings.y = "-80";
261            }
262            if( $(el).hasClass('split-in-rotate') ){
263                settings.opacity = 0;
264                settings.rotateX = "50deg";
265            }
266            if( $(el).hasClass('split-in-scale') ){
267                settings.opacity = 0;
268                settings.scale = "0.5";
269            }
270 
271            if( $(el).hasClass('split-lines-transform') ){
272                pxl_split.split({
273                    type:"lines",
274                    lineThreshold: 0.5,
275                    linesClass: "split-line"
276                }); 
277                split_type_set = pxl_split.lines;
278                settings.opacity = 0;
279                settings.yPercent = 100;
280                settings.autoAlpha = 0;
281                settings.stagger = 0.1;
282            }
283            if( $(el).hasClass('split-lines-rotation-x') ){
284                pxl_split.split({
285                    type:"lines",
286                    lineThreshold: 0.5,
287                    linesClass: "split-line"
288                }); 
289                split_type_set = pxl_split.lines;
290                settings.opacity = 0;
291                settings.rotationX = -120;
292                settings.transformOrigin = "top center -50";
293                settings.autoAlpha = 0;
294                settings.stagger = 0.1;
295            }
296             
297            if( $(el).hasClass('split-words-scale') ){
298                pxl_split.split({type:"words"}); 
299                split_type_set = pxl_split.words;
300               
301                $(split_type_set).each(function(index,elw) {
302                    gsap.set(elw, {
303                        opacity: 0,
304                        scale:index % 2 == 0  ? 0 : 2,
305                        force3D:true,
306                        duration: 0.1,
307                        ease: "power3.out",
308                        stagger: 0.02,
309                    },index * 0.01);
310                });
311
312                var pxl_anim = gsap.to(split_type_set, {
313                    scrollTrigger: {
314                        trigger: el,
315                        toggleActions: "play none none none",
316                        start: "top 95%",
317                    },
318                    rotateX: "0",
319                    scale: 1,
320                    opacity: 1,
321                });
322  
323            }else{
324                var pxl_anim = gsap.from(split_type_set, settings);
325            }
326             
327            if( $(el).hasClass('hover-split-text') ){
328                $(el).mouseenter(function(e) {
329                    pxl_anim.restart();
330                });
331            }
332        });
333    }
334
335    function pxl_split_text_hover(){
336        var st = $(document).find(".pxl-split-text-only-hover");
337 
338        if(st.length == 0) return;
339        gsap.registerPlugin(SplitText);
340        
341        st.each(function(index, el) {
342            var els = $(el).find('p, a').length > 0 ? $(el).find('p, a')[0] : el; 
343            const pxl_split_hover = new SplitText(els, { 
344                type: "lines, words, chars",
345                lineThreshold: 0.5,
346                linesClass: "split-line"
347            });
348            var split_type_set = pxl_split_hover.chars;
349           
350            gsap.set(els, { perspective: 400 });
351 
352            var settings = {
353                duration: 0.8, 
354                stagger: 0.02,
355                ease: "power3.out" //circ.out
356            };
357            if( $(el).hasClass('split-in-fade') ){
358                settings.opacity = 0;
359            }
360            if( $(el).hasClass('split-in-right') ){
361                settings.opacity = 0;
362                settings.x = "50";
363            }
364            if( $(el).hasClass('split-in-left') ){
365                settings.opacity = 0;
366                settings.x = "-50";
367            }
368            if( $(el).hasClass('split-in-up') ){
369                settings.opacity = 0;
370                settings.y = "80";
371            }
372            if( $(el).hasClass('split-in-down') ){
373                settings.opacity = 0;
374                settings.y = "-80";
375            }
376            if( $(el).hasClass('split-in-rotate') ){
377                settings.opacity = 0;
378                settings.rotateX = "50deg";
379            }
380            if( $(el).hasClass('split-in-scale') ){
381                settings.opacity = 0;
382                settings.scale = "0.5";
383            }
384 
385            if( $(el).hasClass('split-lines-transform') ){
386                pxl_split_hover.split({
387                    type:"lines",
388                    lineThreshold: 0.5,
389                    linesClass: "split-line"
390                }); 
391                split_type_set = pxl_split_hover.lines;
392                settings.opacity = 0;
393                settings.yPercent = 100;
394                settings.autoAlpha = 0;
395                settings.stagger = 0.1;
396            }
397            if( $(el).hasClass('split-lines-rotation-x') ){
398                pxl_split_hover.split({
399                    type:"lines",
400                    lineThreshold: 0.5,
401                    linesClass: "split-line"
402                }); 
403                split_type_set = pxl_split_hover.lines;
404                settings.opacity = 0;
405                settings.rotationX = -120;
406                settings.transformOrigin = "top center -50";
407                settings.autoAlpha = 0;
408                settings.stagger = 0.1;
409            }
410             
411            if( $(el).hasClass('split-words-scale') ){
412                pxl_split_hover.split({type:"words"}); 
413                split_type_set = pxl_split_hover.words;
414               
415                $(split_type_set).each(function(index,elw) {
416                    gsap.set(elw, {
417                        opacity: 0,
418                        scale:index % 2 == 0  ? 0 : 2,
419                        force3D:true,
420                        duration: 0.1,
421                        ease: "power3.out", //circ.out
422                        stagger: 0.02,
423                    },index * 0.01);
424                });
425                var pxl_anim = gsap.to(split_type_set, {
426                    rotateX: "0",
427                    scale: 1,
428                    opacity: 1,
429                });
430
431                $(el).mouseenter(function(e) {
432                    pxl_anim.restart();
433                });
434                 
435            }else{
436                $(el).mouseenter(function(e) {  
437                    gsap.from(split_type_set, settings);
438                });
439            }
440        });
441    }
442
443    function basilico_cursor_animate($scope) {
444        if($scope.find(".circle-cursor").length > 0) {
445            const cursor = $scope.find(".circle-cursor")[0];
446            let anchors  = $scope.find(".add-custom-cursor");
447            let anchorsremove  = $scope.find(".remove-cursor");
448            let circleStyle = cursor.style;
449
450            console.log(circleStyle)
451
452            document.addEventListener('mousemove', e => {
453                window.requestAnimationFrame(() => {
454                   circleStyle.top = `${ e.clientY - cursor.offsetHeight/2 }px`;
455                   circleStyle.left = `${ e.clientX - cursor.offsetWidth/2 }px`;
456               });
457            });
458
459            $(anchors).on("mouseenter", function(){
460                $(cursor).addClass("enlarged");
461            });
462            $(anchors).on("mouseleave", function(){
463                $(cursor).removeClass("enlarged");
464            });
465
466            $(anchorsremove).on("mouseenter", function(){
467                $(cursor).removeClass("enlarged");
468            });
469            $(anchorsremove).on("mouseleave", function(){
470                $(cursor).addClass("enlarged");
471            });
472
473            $($scope).on("mouseleave", function(){
474                $(cursor).removeClass("enlarged");
475            });
476        }
477    }
478
479    // Make sure you run this code under Elementor.
480    $( window ).on( 'elementor/frontend/init', function() {
481        pxl_section_start_render();
482        elementorFrontend.hooks.addAction( 'frontend/element_ready/global', function( $scope ) {
483            pxl_animation_handler($scope);
484        } );
485        
486        pxl_widget_show_on_column_hover();
487        pxlMouseDirection();
488        pxl_parallax_bg();
489        pxl_parallax_effect();
490
491        elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_heading.default', function( $scope ) {
492            pxl_split_text($scope);
493            elementorFrontend.waypoint($scope.find('.heading-subtitle'), function () {
494                $(this).addClass('pxl-animated');
495            });
496        } );
497        elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_text_editor.default', function( $scope ) {
498            pxl_split_text($scope);
499        } );
500        elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_button.default', function( $scope ) {
501            pxl_split_text($scope);
502        } );
503        elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_post_carousel.default', function( $scope ) {
504            basilico_cursor_animate($scope);
505        } );
506        elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_image_carousel.default', function( $scope ) {
507            basilico_cursor_animate($scope);
508        } );
509
510        setTimeout(function () { 
511            pxl_split_text_hover();
512        }, 500);
513    } );
514} )( jQuery );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.