PageSourceSearch

https://sautikubwa.org/wp-content/themes/nerubian/assets/js/dev/nerubian.js

js sautikubwa.org collected 2026-10-02 12:37:14 UTC 18,302 bytes, 485 lines download raw bytes

1(function($){
2    "use strict";
3
4    jQuery(document).ready(function(){
5
6        jQuery(".owl-single").each(function(){
7            jQuery(this).slick({
8                autoplay: true,
9                dots: true,
10                autoplaySpeed: 2000
11            });
12        });
13
14
15        jQuery(".article-carousel").each(function(){
16            var number = jQuery(this).data('number');
17            var dots = jQuery(this).data('dots');
18            var arrows = jQuery(this).data('arrows');
19            var table = jQuery(this).data('table');
20            var mobile = jQuery(this).data('mobile');
21            var mobilemin = jQuery(this).data('mobilemin');
22            var rtl = jQuery(this).data('rtl');
23            jQuery(this).slick({
24                dots: dots,
25                slidesToShow: number,
26                autoplay: true,
27                arrows: arrows,
28                autoplaySpeed: 5000,
29                rtl:rtl,
30                responsive: [
31                    {
32                        breakpoint: 900,
33                        settings: {
34                            slidesToShow: table
35                        }
36                    },
37                    {
38                        breakpoint: 600,
39                        settings: {
40                            slidesToShow: mobile
41                        }
42                    },
43                    {
44                        breakpoint: 440,
45                        settings: {
46                            slidesToShow: mobilemin
47                        }
48                    }
49                ]
50
51            });
52        });
53
54
55        jQuery(".article-carousel-center").each(function(){
56            var number = jQuery(this).data('number');
57            var dots = jQuery(this).data('dots');
58            var arrows = jQuery(this).data('arrows');
59            jQuery(this).slick({
60                dots: dots,
61                slidesToShow: number,
62                arrows: arrows,
63                slidesToScroll: 1,
64                autoplay: false,
65                autoplaySpeed:5000,
66                centerMode: true,
67                variableWidth: true,
68                focusOnSelect: true,
69                responsive: [
70                    {
71                        breakpoint: 850,
72                        settings: {
73                            variableWidth: false
74                        }
75                    },
76                    {
77                        breakpoint: 480,
78                        settings: {
79                            centerMode: false,
80                            variableWidth: false
81                        }
82                    }
83                ]
84            });
85        });
86
87        // Slider top -------------------------------------------------------------------------------------------------/
88        jQuery(".box-slider").each(function(){
89            var rtl = jQuery(this).data('rtl');
90            jQuery('.box-large').slick({
91                slidesToShow: 1,
92                arrows: true,
93                autoplay: true,
94                fade: true,
95                draggable: true,
96                rtl:rtl,
97            });
98        });
99
100        // Menu -------------------------------------------------------------------------------------------------------/
101        jQuery('.mega-menu').slicknav({
102            prependTo   :'#nerubian-header',
103            label       :''
104        });
105        var scrollTop = $(document).scrollTop();
106        var headerHeight = $('.header-fixed').outerHeight();
107        var contentHeight = $('.site-header').outerHeight();
108        $(window).scroll(function() {
109            var headerscroll = $(document).scrollTop();
110
111            if (headerscroll > contentHeight){$('.header-fixed').addClass('fixed');}
112            else {$('.header-fixed').removeClass('fixed');}
113            //
114            if (headerscroll > scrollTop){$('.header-fixed').removeClass('scroll-top');}
115            else {$('.header-fixed').addClass('scroll-top');}
116
117            scrollTop = $(document).scrollTop();
118        });
119
120        //sticky sidebar
121        $('.sidebar').theiaStickySidebar({additionalMarginTop: 0, additionalMarginBottom: 0, minWidth: 992});
122        $('.share-social-fixed').theiaStickySidebar({additionalMarginTop: 50, additionalMarginBottom: 0, minWidth: 992});
123        jQuery('.equal-content').each(function () {
124            var h=jQuery('.equal-content').outerHeight();
125            jQuery('.equal-sidebar').css('height',h);
126            $('.equal-sidebar').nanoScroller();
127        });
128        // Sticky Menu ------------------------------------------------------------------------------------------------/
129        jQuery(".btn-mini-search").on( 'click', function(){
130            jQuery(".header-content-right .searchform-wrap").removeClass('nerubian-
130hidden');
131        });
132        jQuery(".btn-mini-close").on( 'click', function(){
133            jQuery(".header-content-right .searchform-wrap").addClass('nerubian-hidden');
134        });
135
136        // CANVAS MENU ------------------------------------------------------------------------------------------------/
137        var menuWrap = jQuery('body').find('.button-offcanvas'),
138            mainWrapper = jQuery('body'),
139            iconClose = jQuery('.canvas-menu .btn-close'),
140            canvasOverlay = jQuery('.canvas-overlay');
141
142        // Function Canvas Menu
143        function menuCanvas(){
144            mainWrapper.toggleClass('canvas-open');
145        }
146        // Call Function Canvas
147        menuWrap.on( 'click', function(){
148            menuCanvas();
149        });
150
151        // Click icon close
152        iconClose.on( 'click', function(){
153            menuCanvas();
154        });
155
156        // Click canvas
157        canvasOverlay.on( 'click', function(){
158            menuCanvas();
159        });
160
161        // parallax ---------------------------------------------------------------------------------------------------/
162
163
164        // Quantity ---------------------------------------------------------------------------------------------------/
165        jQuery(".quantity .add-action").on( 'click', function(){
166            if( jQuery(this).hasClass('qty-plus') ) {
167                jQuery("[name=quantity]",'.quantity').val( parseInt(jQuery("[name=quantity]",'.quantity').val()) + 1 );
168            }
169            else {
170                if( parseInt(jQuery("[name=quantity]",'.quantity').val())  > 1 ) {
171                    jQuery("input",'.quantity').val( parseInt(jQuery("[name=quantity]",'.quantity').val()) - 1 );
172                }
173            }
174        } );
175
176        // Accordion Category------------------------------------------------------------------------------------------/
177
178        if($('.product-categories li.cat-parent')[0]){
179            $('.product-categories li.cat-parent>a').after('<span class="triggernav"><i class="expand-icon"></i></span>');
180            toggleMobileNav('.triggernav', '.widget_product_categories .product-categories li ul');
181        }
182
183        function toggleMobileNav(trigger, target) {
184            jQuery(target).each(function () {
185                jQuery(this).attr('data-h', jQuery(this).outerHeight());
186            });
187            jQuery(target).addClass('unvisible');
188            var h;
189            jQuery(trigger).on("click", function () {
190                h = 0;
191                jQuery(this).prev('a').toggleClass('active');
192                jQuery(this).toggleClass('active');
193                jQuery.this = jQuery(this).next(target);
194                if (jQuery.this.hasClass('unvisible')) {
195                    //Get height of this item
196                    if (jQuery.this.has("ul").length > 0) {
197                        h = parseInt(jQuery.this.attr('data-h')) - parseInt(jQuery.this.find(target).attr('data-h'));
198                    }
199                    else {
200                        h = parseInt(jQuery.this.attr('data-h'));
201                    }
202                    //resize for parent
203                    jQuery.this.parents(target).each(function () {
204                        jQuery(this).css('height', jQuery(this).outerHeight() + h);
205                    })
206                    //set height for this item
207                    jQuery.this.css('height', h + "px");
208                }
209                else {
210                    jQuery.this.find(target).not(':has(.unvisible)').addClass('unvisible');
211                    //resize for parent when this item hide
212                    h = jQuery.this.outerHeight();
213                    jQuery.this.parents(target).each(function () {
214                        jQuery(this).css('height', jQuery(this).outerHeight() - h);
215                    })
216                }
217                jQuery.this.toggleClass('unvisible');
218            });
219        }
220
221        //Facebook Comments ------------------------------------------------------------------------------------------//
222        (function(d, s, id) {
223            var js, fjs = d.getElementsByTagName(s)[0];
224            if (d.getElementById(id)) return;
225            js = d.createElement(s); js.id = id;
226            js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
227            fjs.parentNode.insertBefore(js, fjs);
228        }(document, 'script', 'facebook-jssdk'));
229
230        //VIDEO ------------------------------------------------------------------------------------------------------//
231        jQuery(".video-verticals").each(function(){
232            jQuery('.slider-video').slick({
233                slidesToShow: 1,
234                slidesToScroll: 1,
235                arrows: false,
236                infinite: false,
237                fade: true,
238                asNavFor: '.slider-nav'
239            });
240            jQuery('.slider-nav').slick({
241                slidesToShow: 3,
242                slidesToScroll: 1,
243                asNavFor: '.slider-video',
244                dots: false,
245                arrows: true,
246                centerMode:false,
247                infinite: true,
248                touchMove:true,
249                focusOnSelect: true,
250                vertical:true,
251            });
252        });
253
254        //slider video horizontal
255        jQuery(".video-horizontal").each(function(){
256            var rtl = jQuery(this).data('rtl');
257            jQuery('.slider-nav').slick({
258                slidesToShow: 4,
259                slidesToScroll: 1,
260                infinite: false,
261                dots: false,
262                arrows: true,
263                centerMode:false,
264                focusOnSelect: false,
265                rtl:rtl,
266                responsive: [
267                    {
268                        breakpoint: 480,
269                        settings: {
270                            slidesToShow: 2
271                        }
272                    }
273                ]
274            });
275        });
276        var initPhotoSwipeFromDOM = function(gallerySelector) {
277
278            // parse slide data (url, title, size ...) from DOM elements
279            // (children of gallerySelector)
280            var parseThumbnailElements = function(el) {
281                var thumbElements = el.childNodes,
282                    numNodes = thumbElements.length,
283                    items = [],
284                    figureEl,
285                    linkEl,
286                    size,
287                    item;
288
289                for(var i = 0; i < numNodes; i++) {
290
291                    figureEl = thumbElements[i]; // <figure> element
292
293                    // include only element nodes
294                    if(figureEl.nodeType !== 1) {
295                        continue;
296                    }
297
298                    linkEl = figureEl.children[0]; // <a> element
299
300                    size = linkEl.getAttribute('data-size').split('x');
301
302                    // create slide object
303                    item = {
304                        src: linkEl.getAttribute('href'),
305                        w: parseInt(size[0], 10),
306                        h: parseInt(size[1], 10)
307                    };
308
309
310
311                    if(figureEl.children.length > 1) {
312                        // <figcaption> content
313                        item.title = figureEl.children[1].innerHTML;
314                    }
315
316                    if(linkEl.children.length > 0) {
317                        // <img> thumbnail element, retrieving thumbnail url
318                        item.msrc = linkEl.children[0].getAttribute('src');
319                    }
320
321                    item.el = figureEl; // save link to element for getThumbBoundsFn
322                    items.push(item);
323                }
324
325                return items;
326            };
327
328            // find nearest parent element
329            var closest = function closest(el, fn) {
330                return el && ( fn(el) ? el : closest(el.parentNode, fn) );
331            };
332
333            // triggers when user clicks on thumbnail
334            var onThumbnailsClick = function(e) {
335                e = e || window.event;
336                e.preventDefault ? e.preventDefault() : e.returnValue = false;
337
338                var eTarget = e.target || e.srcElement;
339
340                // find root element of slide
341                var clickedListItem = closest(eTarget, function(el) {
342                    return (el.tagName && el.tagName.toUpperCase() === 'FIGURE');
343                });
344
345                if(!clickedListItem) {
346                    return;
347                }
348
349                // find index of clicked item by looping through all child nodes
350                // alternatively, you may define index via data- attribute
351                var clickedGallery = clickedListItem.parentNode,
352                    childNodes = clickedListItem.parentNode.childNodes,
353                    numChildNodes = childNodes.length,
354                    nodeIndex = 0,
355                    index;
356
357                for (var i = 0; i < numChildNodes; i++) {
358                    if(childNodes[i].nodeType !== 1) {
359                        continue;
360                    }
361
362                    if(childNodes[i] === clickedListItem) {
363                        index = nodeIndex;
364                        break;
365                    }
366                    nodeIndex++;
367                }
368
369
370
371                if(index >= 0) {
372                    // open PhotoSwipe if valid index found
373                    openPhotoSwipe( index, clickedGallery );
374                }
375                return false;
376            };
377
378            // parse picture index and gallery index from URL (#&pid=1&gid=2)
379            var photoswipeParseHash = function() {
380                var hash = window.location.hash.substring(1),
381                    params = {};
382
383                if(hash.length < 5) {
384                    return params;
385                }
386
387                var vars = hash.split('&');
388                for (var i = 0; i < vars.length; i++) {
389                    if(!vars[i]) {
390                        continue;
391                    }
392                    var pair = vars[i].split('=');
393                    if(pair.length < 2) {
394                        continue;
395                    }
396                    params[pair[0]] = pair[1];
397                }
398
399                if(params.gid) {
400                    params.gid = parseInt(params.gid, 10);
401                }
402
403                return params;
404            };
405
406            var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
407                var pswpElement = document.querySelectorAll('.pswp')[0],
408                    gallery,
409                    options,
410                    items;
411
412                items = parseThumbnailElements(galleryElement);
413
414                // define options (if needed)
415                options = {
416
417                    // define gallery index (for URL)
418                    galleryUID: galleryElement.getAttribute('data-pswp-uid'),
419
420                    getThumbBoundsFn: function(index) {
421                        // See Options -> getThumbBoundsFn section of documentation for more info
422                        var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
423                            pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
424                            rect = thumbnail.getBoundingClientRect();
425
426                        return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
427                    }
428
429                };
430
431                // PhotoSwipe opened from URL
432                if(fromURL) {
433                    if(options.galleryPIDs) {
434                        // parse real index when custom PIDs are used
435                        // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
436                        for(var j = 0; j < items.length; j++) {
437                            if(items[j].pid == index) {
438                                options.index = j;
439                                break;
440                            }
441                        }
442                    } else {
443                        // in URL indexes start from 1
444                        options.index = parseInt(index, 10) - 1;
445                    }
446                } else {
447                    options.index = parseInt(index, 10);
448                }
449
450                // exit if index not found
451                if( isNaN(options.index) ) {
452                    return;
453                }
454
455                if(disableAnimation) {
456                    options.showAnimationDuration = 0;
457                }
458
459                // Pass data to PhotoSwipe and initialize it
460                gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
461                gallery.init();
462            };
463
464            // loop through all gallery elements and bind events
465            var galleryElements = document.querySelectorAll( gallerySelector );
466
467            for(var i = 0, l = galleryElements.length; i < l; i++) {
468                galleryElements[i].setAttribute('data-pswp-uid', i+1);
469                galleryElements[i].onclick = onThumbnailsClick;
470            }
471
472            // Parse URL and open gallery if it contains #&pid=3&gid=1
473            var hashData = photoswipeParseHash();
474            if(hashData.pid && hashData.gid) {
475                openPhotoSwipe( hashData.pid ,  galleryElements[ hashData.gid - 1 ], true, true );
476            }
477        };
478
479        initPhotoSwipeFromDOM('.single-image');
480        // execute above function
481        initPhotoSwipeFromDOM('.gallery-main');
482
483    });
484
485})(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.