PageSourceSearch

https://academyofcivil.com/wp-content/themes/academyofcivil/assets/js/custom.js

js academyofcivil.com collected 2026-10-04 05:12:45 UTC 81,604 bytes, 2,193 lines download raw bytes

1
2/**
3 * Tilt
4 */
5!function (t) { "function" == typeof define && define.amd ? define(["jquery"], t) : "object" == typeof module && module.exports ? module.exports = function (i, s) { return void 0 === s && (s = "undefined" != typeof window ? require("jquery") : require("jquery")(i)), t(s), s } : t(jQuery) }(function (t) { return t.fn.tilt = function (i) { const s = function () { this.ticking || (requestAnimationFrame(l.bind(this)), this.ticking = !0) }, e = function () { void 0 !== this.timeout && clearTimeout(this.timeout), t(this).css({ transition: `${this.settings.speed}ms ${this.settings.easing}` }), this.settings.glare && this.glareElement.css({ transition: `opacity ${this.settings.speed}ms ${this.settings.easing}` }), this.timeout = setTimeout(() => { t(this).css({ transition: "" }), this.settings.glare && this.glareElement.css({ transition: "" }) }, this.settings.speed) }, n = function (i) { this.ticking = !1, t(this).css({ "will-change": "transform" }), e.call(this), t(this).trigger("tilt.mouseEnter") }, a = function (i) { return void 0 === i && (i = { pageX: t(this).offset().left + t(this).outerWidth() / 2, pageY: t(this).offset().top + t(this).outerHeight() / 2 }), { x: i.pageX, y: i.pageY } }, h = function (t) { this.mousePositions = a(t), s.call(this) }, r = function () { e.call(this), this.reset = !0, s.call(this), t(this).trigger("tilt.mouseLeave") }, o = function () { const i = t(this).outerWidth(), s = t(this).outerHeight(), e = t(this).offset().left, n = t(this).offset().top, a = (this.mousePositions.x - e) / i, h = (this.mousePositions.y - n) / s; return { tiltX: (this.settings.maxTilt / 2 - a * this.settings.maxTilt).toFixed(2), tiltY: (h * this.settings.maxTilt - this.settings.maxTilt / 2).toFixed(2), percentageX: 100 * a, percentageY: 100 * h, angle: Math.atan2(this.mousePositions.x - (e + i / 2), -(this.mousePositions.y - (n + s / 2))) * (180 / Math.PI) } }, l = function () { if (this.transforms = o.call(this), this.reset) return this.reset = !1, t(this).css("transform", `perspective(${this.settings.perspective}px) rotateX(0deg) rotateY(0deg)`), void (this.settings.glare && (this.glareElement.css("transform", "rotate(180deg) translate(-50%, -50%)"), this.glareElement.css("opacity", "0"))); t(this).css("transform", `perspective(${this.settings.perspective}px) rotateX(${"x" === this.settings.disableAxis ? 0 : this.transforms.tiltY}deg) rotateY(${"y" === this.settings.disableAxis ? 0 : this.transforms.tiltX}deg) scale3d(${this.settings.scale},${this.settings.scale},${this.settings.scale})`), this.settings.glare && (this.glareElement.css("transform", `rotate(${this.transforms.angle}deg) translate(-50%, -50%)`), this.glareElement.css("opacity", `${this.transforms.percentageY * this.settings.maxGlare / 100}`)), t(this).trigger("change", [this.transforms]), this.ticking = !1 }, g = function () { this.glareElement.css({ width: `${2 * t(this).outerWidth()}`, height: `${2 * t(this).outerWidth()}` }) }; return t.fn.tilt.destroy = function () { t(this).each(function () { t(this).find(".js-tilt-glare").remove(), t(this).css({ "will-change": "", transform: "" }), t(this).off("mousemove mouseenter mouseleave") }) }, t.fn.tilt.getValues = function () { const i = []; return t(this).each(function () { this.mousePositions = a.call(this), i.push(o.call(this)) }), i }, t.fn.tilt.reset = function () { t(this).each(function () { this.mousePositions = a.call(this), this.settings = t(this).data("settings"), r.call(this), setTimeout(() => { this.reset = !1 }, this.settings.transition) }) }, this.each(function () { this.settings = t.extend({ maxTilt: t(this).is("[data-tilt-max]") ? t(this).data("tilt-max") : 20, perspective: t(this).is("[data-tilt-perspective]") ? t(this).data("tilt-perspective") : 300, easing: t(this).is("[data-tilt-easing]") ? t(this).data("tilt-easing") : "cubic-bezier(.03,.98,.52,.99)", scale: t(this).is("[data-tilt-scale]") ? t(this).data("tilt-scale") : "1", speed: t(this).is("[data-tilt-speed]") ? t(this).data("tilt-speed") : "400", transition: !t(this).is("[data-tilt-transition]") || t(this).data("tilt-transition"), disableAxis: t(this).is("[data-tilt-disable-axis]") ? t(this).data("tilt-disable-axis") : null, axis: t(this).is("[data-tilt-axis]") ? t(this).data("tilt-axis") : null, reset: !t(this).is("[data-tilt-reset]") || t(this).data("tilt-reset"), glare: !!t(this).is("[data-tilt-glare]") && t(this).data("tilt-glare"), maxGlare: t(this).is("[data-tilt-maxglare]") ? t(this).data("tilt-maxglare") : 1 }, i), null !== this.settings.axis && (console.warn("Tilt.js: the axis setting has been renamed to disableAxis. See https://github.com/gijsroge/tilt.js/pull/26 for more information"), this.settings.disableAxis = this.settings.axis), this.init = (() => { t(this).data("settings", this.settings), this.settings.glare && function () { const i = this.settings.glarePrerender; if (i || t(this).append('<div class="js-tilt-glare"><div class="js-tilt-glare-inner"></div></div>'), this.glareElementWrapper = t(this).find(".js-tilt-glare"), this.glareElement = t(this).find(".js-tilt-glare-inner"), i) return; this.glareElementWrapper.css({ position: "absolute", top: "0", left: "0", width: "100%", height: "100%" }).css({ overflow: "hidden", "pointer-events": "none" }), this.glareElement.css({ position: "absolute", top: "50%", left: "50%", "background-image": "linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)", width: `${2 * t(this).outerWidth()}`, height: `${2 * t(this).outerWidth()}`, transform: "rotate(180deg) translate(-50%, -50%)", "transform-origin": "0% 0%", opacity: "0" }) }.call(this), function () { t(this).on("mousemove", h), t(this).on("mouseenter", n), this.settings.reset && t(this).on("mouseleave", r), this.settings.glare && t(window).on("resize", g.bind(this)) }.call(this) }), this.init() }) }, t("[data-tilt]").tilt(), !0 });
6
7
8/**
9 * DoneTyping
10 */
11(function($){
12    $.fn.extend({
13        donetyping: function(callback,timeout){
14            timeout = timeout || 1e3; // 1 second default timeout
15            var timeoutReference,
16                doneTyping = function(el){
17                    if (!timeoutReference) return;
18                    timeoutReference = null;
19                    callback.call(el);
20                };
21            return this.each(function(i,el){
22                var $el = $(el);
23                // Chrome Fix (Use keyup over keypress to detect backspace)
24                // thank you @palerdot
25                $el.is(':input') && $el.on('keyup keypress paste',function(e){
26                    // This catches the backspace button in chrome, but also prevents
27                    // the event from triggering too preemptively. Without this line,
28                    // using tab/shift+tab will make the focused element fire the callback.
29                    if (e.type=='keyup' && e.keyCode!=8) return;
30
31                    // Check if timeout has been set. If it has, "reset" the clock and
32                    // start over again.
33                    if (timeoutReference) clearTimeout(timeoutReference);
34                    timeoutReference = setTimeout(function(){
35                        // if we made it here, our timeout has elapsed. Fire the
36                        // callback
37                        doneTyping(el);
38                    }, timeout);
39                }).on('blur',function(){
40                    // If we can, fire the event since we're leaving the field
41                    doneTyping(el);
42                });
43            });
44        }
45    });
46})(jQuery);
47
48(function ($) {
49    $(document).ready(function () {
50        // Initially hide extra posts
51        $('.extra-post').hide();
52
53        // Toggle extra posts when clicking the "Read More" button
54        $(".toggle-extra-posts").click(function () {
55            var $section = $(this).closest(".category-box");
56            $section.find(".extra-post").slideToggle();
57            $(this).toggleClass("less");
58
59        });
60        // start menu mobile
61        $(".header-mm , .footer-menu-mobile").click(function (e) {
62            e.preventDefault();
63            $("#mask").fadeIn(500);
64            $("#menumobile").addClass("come-menumobile");
65        });
66        $("#mask").click(function () {
67            $(this).fadeOut(500);
68            $("#menumobile").removeClass("come-menumobile");
69            $(".sub-menu").removeClass("come-submenu");
70            $(".head_item_box").removeClass("active");
71        });
72        $("#nomenumobile").click(function () {
73            $("#mask").fadeOut(500);
74            $("#menumobile").removeClass("come-menumobile");
75            $(".sub-menu").removeClass("come-submenu");
76        });
77        $("#menumobile .main-mm ul > .menu-item-has-children > a").append("<span class='childer'></span>");
78        $("#menumobile .childer").click(function (e) {
79            e.preventDefault();
80            $(this).parent().next().slideToggle();
81            $(this).parent().parent().toggleClass('active');
82            $(this).toggleClass('active');
83        });
84        $(".head_btn_cart").click(function () {
85
86            $("#mask").fadeIn(500);
87            $(".head_item_box").addClass("active");
88        });
89        $(".shopping_box_close").click(function () {
90
91            $("#mask").fadeOut(500);
92            $(".head_item_box").removeClass("active");
93        });
94        // end menu mobile
95
96        $(document).ready(function() {
97            $('.play-btn').on('click', function() {
98                // Toggle play/pause for video
99                var video = $('#video')[0]; // Get the video element
100                if (video.paused) {
101                    $('.media-wrap').fadeIn();
102                    video.play();
103                    // Change button icon and text to 'Pause'
104                    $(this).html('<i class="icon-pause"></i> توقف ویدیو');
105                    $('.hero-content').fadeOut();
106                } else {
107                    $('.media-wrap').fadeOut();
108                    video.pause();
109                    // Change button icon and text to 'Play'
110                    $(this).html('<i class="icon-play"></i> مشاهده ویدیو');
111                    $('.hero-content').fadeIn();
112                }
113
114                // Fade out the hero content
115
116            });
117        });
118
119        jQuery(".help-heading > span").click(function () {
120            jQuery(this).next().slideToggle(400);
121            jQuery(this).children().toggleClass('active');
122        })
123        jQuery(".sidebar-title ").append("<i class='icon-down'></i>");
124        
125        jQuery(".sidebar-title").click(function () {
126            jQuery(this).next().slideToggle(400);
127            jQuery(this).toggleClass('active');
128        })
129
130        jQuery('.blog-tab:first-child,.blog-content:first-child').addClass('active');
131        jQuery('.blog-tab').click(function (e) {
132            e.preventDefault();
133            jQuery(this).addClass('active');
134            jQuery(this).siblings().removeClass('active');
135            jQuery('.blog-content').removeClass('active');
136            var activeTab = jQuery(this).attr('href');
137            jQuery(activeTab).addClass('active');
138
139        });
140
141
142
143
144
145        /*****************************************************
146         copy single url
147         *****************************************************/
148
149        $('.copy-btn').each(function(){
150            $(this).on('click', function(e) {
151                e.preventDefault();
152                value = jQuery(this).data('clipboard-text');
153                var $temp = jQuery('<input>');
154                jQuery('body').append($temp);
155                $temp.val(value).select();
156                document.execCommand('copy');
157                $temp.remove();
158                $(this).children('.tooltip-url').text("Copied!");
159            }).on('mouseout', function (e) {
160                e.preventDefault();
161                $(this).children('.tooltip-url').text("Copy url");
162            })
163        });
164        /*******************************
165                swiper
166         *****************************/
167
168        $(".swiper-categories").each(function (i) {
169            const swiper_wrapper = $(this).find('.swiper-wrapper');
170            const rawSwiperLoop = $.trim(swiper_wrapper.data('loop'));
171            let isLoopEnabled = rawSwiperLoop.toLowerCase() === 'true';
172            if (jQuery(window).width() > 768) {
173               isLoopEnabled = false;
174            }
175            const swiper_categories = new Swiper($(".swiper-categories")[i], {
176                spaceBetween: 0,
177                slidesPerView: 'auto',
178                touchRatio: 0.2,
179                navigation: {
180                    nextEl: ".section-categories .swiper-nav-next",
181                    prevEl: ".section-categories .swiper-nav-prev",
182                },
183                touchEventsTarget: "swiper-categories",
184                loop: isLoopEnabled,
185                touchRatio: 0.2,
186                loopedSlides: 4,
187                breakpoints: {
188                    320: {
189                        slidesPerView: 1,
190                    },
191                    400: {
192                        slidesPerView: 1,
193
194                    },
195                    500: {
196                        slidesPerView: 1.5,
197
198                    },
199                    768: {
200                        slidesPerView: 2.5,
201
202                    },
203                    992: {
204                        slidesPerView: 3,
205
206                    },
207                    1200: {
208                        slidesPerView: 4,
209                    },
210                    1400: {
211                        slidesPerView: 4,
212                    },
213                },
214            });
215
216        $('.swiper-categories .swiper-slide:first-child').addClass('slide-active');
217        jQuery('#overlay_1').addClass('active-overlay');
218        $('.swiper-categories .swiper-slide').click(function(e) {
219            e.preventDefault()
220            $('.swiper-categories .swiper-slide').removeClass('slide-active');
221            $('.overlay-cat').removeClass('active-overlay');
222            $(this).addClass('slide-active');
223            var href = jQuery(this).find('.item-categories').attr('data-target');
224            jQuery(href).addClass('active-overlay');
225        });
226
227        $('.swiper-categories .swiper-slide').hover(function() {
228            $( this ).trigger( "click" );
229        });
230        swiper_categories.on('slideChange', function () {
231            $('.swiper-categories .swiper-slide').removeClass('slide-active');
232            $('.overlay-cat').removeClass('active-overlay');
233            var activeSlide = $('.swiper-categories .swiper-slide').eq(swiper_categories.activeIndex);
234            activeSlide.addClass('slide-active');
235            var href = activeSlide.find('.item-categories').attr('data-target');
236            jQuery(href).addClass('active-overlay');
237        });
238        });
239
240        $(".swiper-testimonial").each(function (i) {
241            const swiper_testimonial = new Swiper($(".swiper-testimonial")[i], {
242                slidesPerView: 1.2,
243                // centerInsufficientSlides: true,
244                centeredSlides: true,
245                grabCursor: true,
246                // loop: true,
247                // initialSlide:2,
248                // direction: ltr,
249                // freeMode: true,
250                effect: 'coverflow',
251                coverflowEffect: {
252                    rotate: 0,
253                    depth: 500,
254                    slideShadows: false,
255                    stretch: 25,
256
257                },
258                navigation: {
259                    nextEl: ".swiper-nav-next",
260                    prevEl: ".swiper-nav-prev"
261                },
262                pagination: {
263                    el: ".swiper-pagination",
264                    clickable: true,
265                },
266                autoplay: {
267                    delay: 4000,
268                    disableOnInteraction: false
269                },
270                speed: 3000,
271                breakpoints: {
272                    320: {
273                        slidesPerView: 1.,
274                        spaceBetween: 10,
275                    },
276                    400: {
277                        slidesPerView: 1,
278                        spaceBetween: 10,
279
280                    },
281                    500: {
282                        slidesPerView: 1,
283                        spaceBetween: 10,
284
285                    },
286                    768: {
287                        slidesPerView: 1,
288                        spaceBetween: 10,
289
290                    },
291                    992: {
292                        slidesPerView: 1.1,
293
294
295                    },
296                    1200: {
297                        slidesPerView: 1.2,
298
299                    },
300                },
301            });
302        });
303
304
305        $(".swiper-cards").each(function (i) {
306            const swiper_wrapper = $(this).find('.swiper-wrapper');
307            const rawSwiperLoop = $.trim(swiper_wrapper.data('loop'));
308            const isLoopEnabled = rawSwiperLoop.toLowerCase() === 'true';
309
310
311            const swiper_cards = new Swiper($(".swiper-cards")[i], {
312                slideToClickedSlide: true,
313                loop: isLoopEnabled,
314                initialSlide: 1,
315                effect: "coverflow",
316                centeredSlides: true,
317                slidesPerView: "auto",
318                coverflowEffect: {
319                    rotate: 40,
320                    stretch: 0,
321                    depth: 200,
322                    modifier: 1,
323                    slideShadows: true,
324                },
325                spaceBetween: 0,
326                navigation: {
327                    nextEl: ".swiper-card-next",
328                    prevEl: ".swiper-card-prev",
329                },
330                observer: true,
331                touchEventsTarget: "swiper-cards",
332                speed: 1000,
333                breakpoints: {
334                    320: {
335                        slidesPerView: 1.,
336                        spaceBetween: 20,
337                    },
338                    400: {
339                        slidesPerView: 1,
340                        spaceBetween: 20,
341
342                    },
343                    500: {
344                        slidesPerView: 1.7,
345                        spaceBetween: 30,
346
347                    },
348                    768: {
349                        slidesPerView: 2,
350                        spaceBetween: 30,
351
352                    },
353                    992: {
354                        slidesPerView: 2.5,
355                        spaceBetween: 40,
356
357                    },
358                    1200: {
359                        slidesPerView: 3,
360                        spaceBetween: 50,
361                    },
362                },
363            });
364        });
365        $(".swiper-gallery-about").each(function (i) {
366            const swiper_wrapper = $(this).find('.swiper-wrapper');
367            const rawSwiperLoop = $.trim(swiper_wrapper.data('loop'));
368            const isLoopEnabled = rawSwiperLoop.toLowerCase() === 'true';
369            const swiper = new Swiper($(".swiper-gallery-about")[i], {
370                slidesPerView: 3,
371                spaceBetween: 30,
372                 centerInsufficientSlides: true,
373                loop: isLoopEnabled,
374                navigation: {
375                    nextEl: ".swiper-nav-next",
376                    prevEl: ".swiper-nav-prev",
377                },
378                speed: 1000,
379                freeMode: false,
380                breakpoints: {
381                    320: {
382                        slidesPerView: 1,
383                        spaceBetween: 20,
384                    },
385
386                    450: {
387                        slidesPerView: 1.5,
388                        spaceBetween: 20,
389                    },
390                    576: {
391                        slidesPerView: 2.5,
392                        spaceBetween: 20,
393                    },
394                    768: {
395                        slidesPerView: 3,
396                        spaceBetween: 20,
397                    },
398                    992: {
399                        slidesPerView: 3.2,
400                        spaceBetween: 20,
401                    },
402                    1200: {
403                        slidesPerView: 3.5,
404                        spaceBetween: 20,
405                    },
406                    1400: {
407                        slidesPerView: 4,
408                        spaceBetween: 20,
409                    },
410                    1700: {
411                        slidesPerView: 5,
412                        spaceBetween: 20,
413                    },
414                },
415            });
416        });
417        $(".swiper-step").each(function (i) {
418            const swiper_step = new Swiper($(".swiper-step")[i], {
419                spaceBetween: 10,
420                slidesPerView: 4,
421                touchEventsTarget: "swiper-step",
422                navigation: {
423                    nextEl: ".swiper-nav-next",
424                    prevEl: ".swiper-nav-prev",
425                },
426                speed: 500,
427                freeMode: true,
428                mouseDrag: true,
429                breakpoints: {
430                    320: {
431                        slidesPerView: 1.5,
432                        spaceBetween: 22,
433                    },
434                    400: {
435                        slidesPerView: 1.8,
436                        spaceBetween: 22,
437
438                    },
439                    500: {
440                        slidesPerView: 1.5,
441                        spaceBetween: 22,
442
443                    },
444                    768: {
445                        slidesPerView: 2,
446                        spaceBetween: 22,
447
448                    },
449                    992: {
450                        slidesPerView: 2.5,
451                        spaceBetween: 30,
452
453                    },
454                    1200: {
455                        slidesPerView: 3,
456                        spaceBetween: 30,
457                    },
458                    1400: {
459                        slidesPerView: 5,
460                        spaceBetween: 22,
461                    },
462                },
463            });
464        });
465        $(".swiper-product").each(function (i) {
466            const swiper_brands = new Swiper($(".swiper-product")[i], {
467                freeMode: true,
468                pagination: {
469                    el: ".swiper-pagination",
470                    clickable: true,
471                },
472                navigation: {
473                    nextEl: ".swiper-nav-next",
474                    prevEl: ".swiper-nav-prev",
475                },
476                grabCursor: false,
477                slidesPerView: 2,
478                spaceBetween: 15,
479                breakpoints: {
480                    320: {
481                        slidesPerView: 1,
482                        spaceBetween: 15,
483                    },
484                    400: {
485                        slidesPerView: 1.5,
486                        spaceBetween: 15,
487
488                    },
489
490                    576: {
491                        slidesPerView: 2,
492                        spaceBetween: 15,
493                    },
494                    768: {
495                        slidesPerView: 2.5,
496                        spaceBetween: 15,
497                    },
498                    992: {
499                        slidesPerView: 2,
500                        spaceBetween: 24,
501                    },
502                    1200: {
503                        slidesPerView: 2.5,
504                        spaceBetween: 24,
505                    },
506                    1400: {
507                        slidesPerView: 3,
508                        spaceBetween: 17,
509                    },
510                    1700: {
511                        slidesPerView: 4,
512                        spaceBetween: 17,
513                    },
514
515                },
516            });
517        });
518        $(".swiper-brands").each(function (i) {
519            const swiper_brands = new Swiper($(".swiper-brands")[i], {
520                loop: true,
521                
522                freeMode: true,
523                autoplay: {
524                    delay: 0,
525                    disableOnInteraction: false,
526                },
527                pagination: {
528                    el: ".swiper-pagination",
529                    clickable: true,
530                },
531                grabCursor: true,
532                speed: 3000,
533                slidesPerView: 2,
534                spaceBetween: 15,
535                breakpoints: {
536                    320: {
537                        slidesPerView: 2,
538                        spaceBetween: 15,
539                    },
540                    400: {
541                        slidesPerView: 2.2,
542                        spaceBetween: 15,
543
544                    },
545
546                    576: {
547                        slidesPerView: 3,
548                        spaceBetween: 15,
549                    },
550                    768: {
551                        slidesPerView: 4,
552                        spaceBetween: 15,
553                    },
554                    992: {
555                        slidesPerView: 5,
556                        spaceBetween: 24,
557                    },
558                    1200: {
559                        slidesPerView: 6,
560                        spaceBetween: 24,
561                    },
562
563                },
564            });
565        });
566
567        $(".swiper-terms").each(function (i) {
568            const swiper_term = new Swiper($(".swiper-terms")[i], {
569                spaceBetween: 10,
570                slidesPerView: 4,
571                touchEventsTarget: "swiper-terms",
572                speed: 2000,
573                navigation: {
574                    nextEl: ".swiper-nav-next",
575                    prevEl: ".swiper-nav-prev"
576                },
577                centerInsufficientSlides: true,
578                freeMode: true,
579                mouseDrag: true,
580                grabCursor: true,
581                breakpoints: {
582                    320: {
583                        slidesPerView: 1.5,
584                        spaceBetween: 15,
585
586                    },
587                    400: {
588                        slidesPerView: 2,
589                        spaceBetween: 15,
590
591
592                    },
593                    500: {
594                        slidesPerView: 2.5,
595                        spaceBetween: 15,
596
597
598                    },
599                    768: {
600                        slidesPerView: 3,
601                        spaceBetween: 15,
602
603                    },
604                    992: {
605                        slidesPerView: 3,
606                        spaceBetween: 24,
607
608                    },
609                    1200: {
610                        slidesPerView: 3.5,
611                        spaceBetween: 24,
612                    },
613                    1400: {
614                        slidesPerView: 4,
615                        spaceBetween: 38,
616                    },
617                    1600: {
618                        slidesPerView: 5,
619                        spaceBetween: 38,
620                    },
621                },
622            });
623        });
624
625        $(".swiper-cats").each(function (i) {
626            const swiper_cats = new Swiper($(".swiper-cats")[i], {
627                spaceBetween: 10,
628                slidesPerView: 4,
629                touchEventsTarget: "swiper-cats",
630                speed: 2000,
631                navigation: {
632                    nextEl: ".swiper-nav-next",
633                    prevEl: ".swiper-nav-prev"
634                },
635                freeMode: true,
636                grabCursor: true,
637                mouseDrag: true,
638                breakpoints: {
639                    320: {
640                        slidesPerView: 1.5,
641                        spaceBetween: 15,
642
643                    },
644                    400: {
645                        slidesPerView: 2,
646                        spaceBetween: 15,
647
648
649                    },
650                    500: {
651                        slidesPerView: 3,
652                        spaceBetween: 15,
653
654
655                    },
656                    768: {
657                        slidesPerView: 4,
658                        spaceBetween: 25,
659
660                    },
661                    992: {
662                        slidesPerView: 5,
663                        spaceBetween: 25,
664
665                    },
666                    1200: {
667                        slidesPerView: 5,
668                        spaceBetween: 25,
669                    },
670                    1400: {
671                        slidesPerView: 6,
672                        spaceBetween: 25,
673                    },
674                },
675            });
676        });
677        $(".swiper-access").each(function (i) {
678            const swiper_cats = new Swiper($(".swiper-access")[i], {
679                spaceBetween: 10,
680                slidesPerView: 4,
681                touchEventsTarget: "swiper-access",
682                speed: 3000,
683                autoplay: {
684                    delay: 1000,
685                    disableOnInteraction: false,
686                },
687                pagination: {
688                    el: ".swiper-pagination",
689                    clickable: true,
690                },
691                grabCursor: true,
692                freeMode: true,
693                loop: true,
694                freeMode: true,
695                mouseDrag: true,
696                breakpoints: {
697                    320: {
698                        slidesPerView: 1.5,
699                        spaceBetween: 15,
700
701                    },
702                    400: {
703                        slidesPerView: 2,
704                        spaceBetween: 15,
705
706
707                    },
708                    500: {
709                        slidesPerView: 3,
710                        spaceBetween: 15,
711
712
713                    },
714                    768: {
715                        slidesPerView: 4,
716                        spaceBetween: 25,
717
718                    },
719                    992: {
720                        slidesPerView: 5,
721                        spaceBetween: 25,
722
723                    },
724                    1200: {
725                        slidesPerView: 5,
726                        spaceBetween: 24,
727                    },
728                    1400: {
729                        slidesPerView: 6,
730                        spaceBetween: 24,
731                    },
732                    1700: {
733                        slidesPerView: 6.5,
734                        spaceBetween: 24,
735                    },
736                },
737            });
738        });
739
740        $(".swiper-steps").each(function (i) {
741            const swiper_steps = new Swiper($(".swiper-steps")[i], {
742                direction: 'vertical',
743                slidesPerView: 3,
744                // centerInsufficientSlides: true,
745                centeredSlides: true,
746                 loop: true,
747                 initialSlide:1,
748                 freeMode: true,
749                spaceBetween: 12,
750                navigation: {
751                    nextEl: ".swiper-nav-next",
752                    prevEl: ".swiper-nav-prev"
753                },
754                grabCursor: true,
755                pagination: {
756                    el: ".swiper-pagination",
757                    clickable: true,
758                },
759                autoplay: {
760                    delay: 3000,
761                    disableOnInteraction: false
762                },
763                speed: 3000,
764                breakpoints: {
765                    320: {
766                        slidesPerView: 'auto',
767                    },
768                    576: {
769                        slidesPerView: 'auto',
770                    },
771                }
772
773            });
774        });
775
776
777        $(".swiper-feature").each(function (i) {
778            const swiper_feature = new Swiper($(".swiper-feature")[i], {
779                spaceBetween: 10,
780                loop: true,
781                slidesPerView: 4,
782                centerInsufficientSlides: true,
783                centeredSlides: true,
784                loop: true,
785
786                autoplay: {
787                    delay: 0,
788                    disableOnInteraction: false
789                },
790                speed: 4000,
791                grabCursor: true,
792                breakpoints: {
793                    320: {
794                        slidesPerView: 1,
795                        spaceBetween: 15,
796
797                    },
798                    400: {
799                        slidesPerView: 1.4,
800                        spaceBetween: 15,
801                    },
802                    500: {
803                        slidesPerView: 1.5,
804                        spaceBetween: 15,
805                    },
806                    768: {
807                        slidesPerView: 2,
808                        spaceBetween: 15,
809                        loop: false,
810                    },
811                    992: {
812                        slidesPerView: 2.5,
813                        spaceBetween: 24,
814                        loop: false,
815                    },
816                    1200: {
817                        slidesPerView: 3,
818                        spaceBetween: 32,
819                        loop: false,
820                        autoplay: {
821                            enabled: false,
822
823                        },
824                        centeredSlides: false,
825                    },
826                },
827            });
828        });
829
830
831        var swiper_faq = new Swiper(".swiper-faq", {
832            slidesPerView: 3,
833            spaceBetween: 10,
834            navigation: {
835                nextEl: ".swiper-nav-next",
836                prevEl: ".swiper-nav-prev"
837            },
838            grabCursor: true,
839            breakpoints: {
840                320: {
841                    slidesPerView: 1.5,
842                    spaceBetween: 8,
843                    pagination: {
844                        el: ".swiper-pagination",
845                        clickable: true,
846                    },
847                },
848                400: {
849                    slidesPerView: 2,
850                    spaceBetween: 8,
851                    pagination: {
852                        el: ".swiper-pagination",
853                        clickable: true,
854                    },
855                },
856                576: {
857                    slidesPerView: 2.5,
858                    spaceBetween: 15,
859                    pagination: {
860                        el: ".swiper-pagination",
861                        clickable: true,
862                    },
863                },
864                576: {
865                    slidesPerView: 3,
866                    spaceBetween: 15,
867                    pagination: {
868                        el: ".swiper-pagination",
869                        clickable: true,
870                    },
871                },
872                992: {
873                    slidesPerView: 4,
874                    spaceBetween: 24,
875
876                },
877                1200: {
878                    slidesPerView: 5,
879                    spaceBetween: 20,
880                },
881                1400: {
882                    slidesPerView: 5,
883                    spaceBetween: 20,
884                },
885                1700: {
886                    slidesPerView: 6,
887                    spaceBetween: 20,
888                }
889
890            },
891        });
892        $(".swiper-blog").each(function (i) {
893            const swiper_blog = new Swiper($(".swiper-blog")[i], {
894                navigation: {
895                    nextEl: ".swiper-nav-next",
896                    prevEl: ".swiper-nav-prev"
897                },
898                grabCursor: true,
899                freeMode: true,
900                spaceBetween: 10,
901                slidesPerView: 3,
902                breakpoints: {
903                    320: {
904                        slidesPerView: 1,
905                        spaceBetween: 15,
906                    },
907                    420: {
908                        slidesPerView: 1.2,
909                        spaceBetween: 15,
910                    },
911                    500: {
912                        slidesPerView: 1.4,
913                        spaceBetween: 15,
914                    },
915
916                    576: {
917                        slidesPerView: 1.5,
918                        spaceBetween: 15,
919                    },
920                    768: {
921                        slidesPerView: 2,
922                        spaceBetween: 15,
923                    },
924                    992: {
925                        slidesPerView: 3,
926                        spaceBetween: 15,
927                    },
928                    1200: {
929                        slidesPerView: 3,
930                        spaceBetween: 24,
931                    },
932                    1300: {
933                        slidesPerView: 3,
934                        spaceBetween: 24,
935                    },
936                    1700: {
937                        slidesPerView: 4,
938                        spaceBetween: 24,
939                    }
940
941                },
942
943            });
944        });
945        $(".swiper-slider").each(function (i) {
946            const swiper = new Swiper($(".swiper-slider")[i], {
947                spaceBetween: 10,
948                effect: "fade",
949                navigation: {
950                    nextEl: ".swiper-nav-next",
951                    prevEl: ".swiper-nav-prev"
952                },
953                grabCursor: true,
954            });
955        });
956
957
958        let swiperInstances1 = {};
959        $(".swiper-team").each(function (index, element) {
960            var $this = $(this);
961            $this.addClass("swiper-team-" + index);
962            $this
963                .closest(".swiper-container")
964                .find(".swiper-nav-prev")
965                .addClass("prev-sl-" + index);
966            $this
967                .closest(".swiper-container")
968                .find(".swiper-nav-next")
969                .addClass("next-sl-" + index);
970            swiperInstances1[index] = new Swiper(".swiper-team-" + index, {
971                navigation: {
972                    nextEl: ".next-sl-" + index,
973                    prevEl: ".prev-sl-" + index,
974                },
975
976                freeMode: true,
977                spaceBetween: 30,
978                slidesPerView: 3,
979                breakpoints: {
980                    320: {
981                        slidesPerView: 1,
982                        spaceBetween: 15,
983                        centeredSlides: true,
984                        loop: true,
985                    },
986                    450: {
987                        slidesPerView: 1,
988                        spaceBetween: 15,
989                        centeredSlides: true,
990                        loop: true,
991                    },
992                    576: {
993                        slidesPerView: 1,
994                        spaceBetween: 15,
995                    },
996                    768: {
997                        slidesPerView: 2,
998                        spaceBetween: 15,
999                    },
1000                    1200: {
1001                        slidesPerView: 3,
1002                        spaceBetween: 15,
1003                    },
1004                    1400: {
1005                        slidesPerView: 3,
1006                        spaceBetween: 21,
1007                    },
1008                    1700: {
1009                        slidesPerView: 4,
1010                        spaceBetween: 21,
1011                    },
1012                },
1013            });
1014        });
1015        var galleryTop = new Swiper('.gallery-top', {
1016            spaceBetween: 10,
1017            loop: true,
1018            loopedSlides: 4,
1019            breakpoints: {
1020                320: {
1021                    slidesPerView: 1,
1022                    spaceBetween: 8,
1023
1024                },
1025                378: {
1026                    slidesPerView: 1,
1027                    spaceBetween: 10,
1028                },
1029                576: {
1030                    slidesPerView: 1,
1031                },
1032                992: {
1033                    slidesPerView: 1,
1034                },
1035            },
1036
1037        });
1038        var galleryThumbs = new Swiper('.gallery-thumbs', {
1039            spaceBetween: 100,
1040            centerInsufficientSlides: true,
1041            centeredSlides: true,
1042            slidesPerView: '2',
1043            navigation: {
1044                nextEl: '.advanced-nav .swiper-nav-next',
1045                prevEl: '.advanced-nav .swiper-nav-prev',
1046            },
1047            touchRatio: 0.5,
1048            slideToClickedSlide: true,
1049            loop: true,
1050            speed: 400,
1051            loopedSlides: 4,
1052            breakpoints: {
1053                320: {
1054                    slidesPerView: 1.5,
1055                    spaceBetween: 8,
1056
1057                },
1058                378: {
1059                    slidesPerView: 3,
1060                    spaceBetween: 10,
1061                },
1062                576: {
1063                    slidesPerView: 5,
1064                    spaceBetween: 25,
1065                },
1066                992: {
1067                    slidesPerView: 5,
1068                    spaceBetween: 30,
1069
1070                },
1071                1200: {
1072                    slidesPerView: 9,
1073                    spaceBetween: 0,
1074
1075                },
1076            },
1077
1078        });
1079        galleryTop.controller.control = galleryThumbs;
1080        galleryThumbs.controller.control = galleryTop;
1081
1082        $(".swiper-gallery").each(function (index, element) {
1083            const swiper_wrapper = $(this).find('.swiper-wrapper');
1084            const rawSwiperLoop = $.trim(swiper_wrapper.data('loop'));
1085            const isLoopEnabled = rawSwiperLoop.toLowerCase() === 'true';
1086            var $this = $(this);
1087            $this.addClass("swiper-gallery-" + index);
1088            $this
1089                .closest(".swiper-container")
1090                .find(".swiper-nav-prev")
1091                .addClass("prev-gl-" + index);
1092            $this
1093                .closest(".swiper-container")
1094                .find(".swiper-nav-next")
1095                .addClass("next-gl-" + index);
1096            swiperInstances1[index] = new Swiper(".swiper-gallery-" + index, {
1097                navigation: {
1098                    nextEl: ".next-gl-" + index,
1099                    prevEl: ".prev-gl-" + index,
1100                },
1101                loop: isLoopEnabled,
1102    
1102            centerInsufficientSlides: true,
1103                freeMode: true,
1104                spaceBetween: 30,
1105                slidesPerView: 3,
1106                breakpoints: {
1107                    320: {
1108                        slidesPerView: 1,
1109                        spaceBetween: 20,
1110                    },
1111
1112                    450: {
1113                        slidesPerView: 1.5,
1114                        spaceBetween: 20,
1115                    },
1116                    576: {
1117                        slidesPerView: 2.5,
1118                        spaceBetween: 20,
1119                    },
1120                    768: {
1121                        slidesPerView: 3,
1122                        spaceBetween: 20,
1123                    },
1124                    992: {
1125                        slidesPerView: 3.2,
1126                        spaceBetween: 20,
1127                    },
1128                    1200: {
1129                        slidesPerView: 3.5,
1130                        spaceBetween: 20,
1131                    },
1132                    1400: {
1133                        slidesPerView: 4,
1134                        spaceBetween: 20,
1135                    },
1136                    1700: {
1137                        slidesPerView: 5,
1138                        spaceBetween: 20,
1139                    },
1140                },
1141            });
1142        });
1143
1144        $(".swiper-logos").each(function () {
1145            var $wrap = $(this).closest(".logos-slider-wrap");
1146            new Swiper(this, {
1147                loop: true,
1148                speed: 600,
1149                autoplay: {
1150                    delay: 3000,
1151                    disableOnInteraction: false,
1152                    pauseOnMouseEnter: true,
1153                },
1154                navigation: {
1155                    nextEl: $wrap.find(".logos-next")[0],
1156                    prevEl: $wrap.find(".logos-prev")[0],
1157                },
1158                slidesPerView: 3,
1159                spaceBetween: 10,
1160                breakpoints: {
1161                    480: {
1162                        slidesPerView: 4,
1163                        spaceBetween: 14,
1164                    },
1165                    768: {
1166                        slidesPerView: 6,
1167                        spaceBetween: 16,
1168                    },
1169                    992: {
1170                        slidesPerView: 8,
1171                        spaceBetween: 18,
1172                    },
1173                },
1174            });
1175        });
1176
1177        $(".swiper-lightgallery").each(function (i) {
1178            const swiper = new Swiper($(".swiper-lightgallery")[i], {
1179                slidesPerView: 3,
1180                spaceBetween: 30,
1181                navigation: {
1182                    nextEl: ".swiper-nav-next",
1183                    prevEl: ".swiper-nav-prev",
1184                },
1185                breakpoints: {
1186                    320: {
1187                        slidesPerView: 1.5,
1188                        spaceBetween: 14,
1189                    },
1190                    380: {
1191                        slidesPerView: 2,
1192                        spaceBetween: 14,
1193                    },
1194                    450: {
1195                        slidesPerView: 2.5,
1196                        spaceBetween: 14,
1197                    },
1198                    576: {
1199                        slidesPerView: 2,
1200                        spaceBetween: 20,
1201                    },
1202                    768: {
1203                        slidesPerView: 3,
1204                        spaceBetween: 20,
1205                    },
1206                    992: {
1207                        slidesPerView: 3.5,
1208                        spaceBetween: 20,
1209                    },
1210                    1200: {
1211                        slidesPerView: 4,
1212                        spaceBetween: 25,
1213                    },
1214                    1400: {
1215                        slidesPerView: 4.5,
1216                        spaceBetween: 25,
1217                    },
1218                    1700: {
1219                        slidesPerView: 5,
1220                        spaceBetween: 17,
1221                    },
1222                },
1223            });
1224        });
1225        /*****************************************************
1226         gallery js
1227         *****************************************************/
1228        const gallery_about = document.querySelector(".swiper-gallery-about");
1229
1230        if (gallery_about) {
1231            jQuery(".swiper-gallery-about").lightGallery({
1232                thumbnail: true,
1233                selector: ".swiper-slide a",
1234                subHtmlSelectorRelative: true,
1235            });
1236        }
1237        const gallery = document.querySelector(".swiper-gallery");
1238
1239        if (gallery) {
1240            jQuery(".swiper-gallery").lightGallery({
1241                thumbnail: true,
1242                selector: ".swiper-slide a",
1243                subHtmlSelectorRelative: true,
1244            });
1245        }
1246        const lightgallery = document.querySelector(".swiper-lightgallery");
1247        if (lightgallery) {
1248            jQuery(".swiper-lightgallery").lightGallery({
1249                thumbnail: true,
1250                selector: ".swiper-slide a",
1251                subHtmlSelectorRelative: true,
1252            });
1253        }
1254
1255        /*****************************************************
1256         AJAX search
1257         *****************************************************/
1258        jQuery('.search-close , .search-form .search-remove').click(function () {
1259            jQuery(".search-results-box").html('').fadeOut();
1260            jQuery("#search-text").val('');
1261            jQuery('.search-form .search-remove').fadeOut(400);
1262            jQuery('.search-offers').fadeIn(100);
1263            jQuery('.search-banner').fadeIn(100);
1264            jQuery('.archive-features').fadeIn(100);
1265        });
1266        jQuery('#search-text').on('input', function () {
1267            var subject = jQuery(this).val().trim();
1268            if (subject.length > 1) {
1269                jQuery('.search-form .search-remove').fadeOut(400);
1270                jQuery('.search-form .search-loading').fadeIn(500);
1271            } else {
1272                jQuery('.search-form .search-remove , .search-form .search-loading').fadeOut(300);
1273                jQuery('.search-offers').fadeIn(100);
1274                jQuery('.search-banner').fadeIn(100);
1275                jQuery('.archive-features').fadeIn(100);
1276
1277            }
1278        });
1279        jQuery('#search-text').on('focus', function () {
1280            jQuery(this).parent().addClass('search-focus')
1281        });
1282
1283        jQuery("#search-text").donetyping(function () {
1284            var subject = jQuery(this).val().trim();
1285            var offers = jQuery('.search-offers').length;
1286            var banner = jQuery('.search-banner').length;
1287            if (subject.length > 2) {
1288                jQuery.ajax({
1289                    type: 'post',
1290                    async: true,
1291                    url: ajax_data.url,
1292                    data: {
1293                        action: 'results_search',
1294                        'subject': subject,
1295                        keyword: jQuery('#search-text').val(),
1296                    },
1297                    dataType: "html"
1298
1299                }).done(function (data) {
1300
1301                    jQuery('.search-offers').fadeOut(100);
1302                    jQuery('.search-banner').fadeOut(100);
1303                    jQuery('.archive-features').fadeOut(100);
1304
1305                    jQuery('.search-form .search-loading').fadeOut(400);
1306                    jQuery('.search-form .search-remove').fadeIn(600);
1307                    jQuery(".search-results-box").html('').html(data).fadeIn(400);
1308                });
1309            } else {
1310                jQuery('.search-offers').fadeIn(100);
1311                jQuery('.search-banner').fadeIn(100);
1312                jQuery('.archive-features').fadeIn(100);
1313                jQuery(".search-results-box").html('').fadeOut(400);
1314            }
1315        });
1316
1317
1318
1319
1320
1321
1322        /*****************************************************
1323         Factor
1324         *****************************************************/
1325        if (jQuery("body").hasClass("woocommerce-checkout")) {
1326            if (jQuery('#customer-type_field').length) {
1327                jQuery('#national-code_field').hide();
1328                jQuery('#company_field').hide();
1329                jQuery('#register-number_field').hide();
1330                jQuery('#economic-code_field').hide();
1331                jQuery('#national-id_field').hide();
1332
1333                jQuery('#customer-type_field input[type="radio"]').change(function () {
1334                    if (this.value == 'haghighi') {
1335                        jQuery('#national-code_field').show();
1336                        jQuery('#company_field').hide();
1337                        jQuery('#register-number_field').hide();
1338                        jQuery('#economic-code_field').hide();
1339                        jQuery('#national-id_field').hide();
1340                    } else {
1341                        jQuery('#national-code_field').hide();
1342                        jQuery('#company_field').show();
1343                        jQuery('#register-number_field').show();
1344                        jQuery('#economic-code_field').show();
1345                        jQuery('#national-id_field').show();
1346                    }
1347                });
1348            }
1349        }
1350
1351        /*****************************************************
1352         Modal js
1353         *****************************************************/
1354
1355        jQuery("body").on('click', '*[data-toggle="modal"]', function () {
1356            var target = jQuery(this).attr("data-target");
1357            jQuery(target).fadeIn();
1358            jQuery(target).addClass('show');
1359        });
1360
1361        jQuery(".modal").on('click', '.close', function () {
1362            jQuery(this).parents('.modal').fadeOut();
1363            jQuery(this).parents('.modal').removeClass('show');
1364        });
1365        $("#search-text").focus(function () {
1366            $('.header__search .icon-search').css({
1367                opacity: '1',
1368                transition: 'opacity 0.4s ease'
1369            });
1370        }).blur(function () {
1371            $('.header__search .icon-search').css({
1372                opacity: '0.4',
1373                transition: 'opacity 0.4s ease'
1374            });
1375        });
1376
1377        jQuery('.item-banner').tilt({
1378            perspective: 1000,
1379            axis: 'y',
1380            disableAxis: 'X'
1381        });
1382
1383        /*****************************************************
1384         Single access post
1385         *****************************************************/
1386        
1387        jQuery('a[href^="#"]:not([href="#"])').on('click', function (e) {
1388            e.preventDefault();
1389            var hash = this.hash;
1390            jQuery('html, body').animate({
1391                scrollTop: jQuery(hash).offset().top - 46
1392            }, 800);
1393        });
1394
1395
1396
1397        /*****************************************************
1398         seach pop up
1399         *****************************************************/
1400
1401        jQuery(".search-wrap").click(function (e) {
1402            e.preventDefault();
1403            jQuery(".search-pup-up").fadeIn(500);
1404            jQuery(".search-pup-up").addClass('popup-search-active');
1405        });
1406        jQuery(".fd-outer").click(function (e) {
1407            e.preventDefault();
1408            jQuery(".search-pup-up").fadeOut(500);
1409            jQuery(".search-pup-up").removeClass('popup-search-active');
1410        });
1411
1412        /*****************************************************
1413         AJAX search
1414         *****************************************************/
1415        jQuery(' .search-close , .search-form .search-remove').click(function () {
1416            jQuery(".search-results-box").html('').fadeOut();
1417            jQuery(".search-form").val('');
1418            jQuery('.search-form .search-remove').fadeOut(400);
1419            jQuery("#search-text").val('');
1420            jQuery('.search-form .search-remove').fadeOut(400);
1421            jQuery('.header__search .search-form').css("width", "76px");
1422            jQuery(' .search-form .icon-search').fadeIn(400);
1423
1424        });
1425
1426        /*****************************************************
1427         AJAX search
1428         *****************************************************/
1429        jQuery('.search-close , .search-form .search-remove').click(function () {
1430            jQuery(".search-results-box").html('').fadeOut();
1431            jQuery("#search-text").val('');
1432            jQuery('.search-form .search-remove').fadeOut(400);
1433        });
1434        jQuery('#search-text').on('input', function () {
1435            var subject = jQuery(this).val().trim();
1436            if (subject.length > 1) {
1437                jQuery('.search-form .search-remove').fadeOut(400);
1438                jQuery('.search-form .search-loading').fadeIn(500);
1439            } else {
1440                jQuery('.search-form .search-remove , .search-form .search-loading').fadeOut(300);
1441
1442            }
1443        });
1444        jQuery('#search-text').on('focus', function () {
1445            jQuery(this).parent().addClass('search-focus')
1446        });
1447
1448        jQuery("#search-text").donetyping(function () {
1449            var subject = jQuery(this).val().trim();
1450            if (subject.length > 2) {
1451                jQuery.ajax({
1452                    type: 'post',
1453                    async: true,
1454                    url: ajax_data.url,
1455                    data: {
1456                        action: 'results_search',
1457                        'subject': subject,
1458                        keyword: jQuery('#search-text').val(),
1459                    },
1460                    dataType: "html"
1461
1462                }).done(function (data) {
1463
1464                    jQuery('.search-form .search-loading').fadeOut(400);
1465                    jQuery('.search-form .search-remove').fadeIn(600);
1466                    jQuery(".search-results-box").html('').html(data).fadeIn(400);
1467                });
1468            } else {
1469                jQuery(".search-results-box").html('').fadeOut(400);
1470            }
1471        });
1472
1473
1474
1475        /* FAQ SCRIPT tab */
1476
1477        jQuery('.tab-links li').click(function (e) {
1478            e.preventDefault();
1479            jQuery('.tab-links li').removeClass('active');
1480            jQuery(this).addClass('active');
1481            jQuery('.tab-content').removeClass('active in');
1482            var activeTab = jQuery(this).find('a').attr('href');
1483            jQuery(activeTab).addClass('active in');
1484        });
1485        $('.tabContent').hide();
1486        $('#'+$('.tabLinks:first').attr('data-tab')).show();
1487        $('.tabLinks:first').addClass('active');
1488
1489        $('.tabLinks').click(function(){
1490            var tab = $(this).attr('data-tab');
1491
1492            $('.tabLinks').removeClass('active');
1493            $(this).addClass('active');
1494
1495            $('.tabContent').hide();
1496            $('#'+tab).show();
1497        });
1498
1499        // $(window).scroll(function() {
1500        //     var scroll = $(window).scrollTop();
1501        //     if (scroll >= 40) {
1502        //         $('#header').addClass("active");
1503        //     } else {
1504        //         $('#header').removeClass("active");
1505        //     }
1506        // });
1507        var position = $(window).scrollTop();
1508        $(window).scroll(function () {
1509            var scroll = $(window).scrollTop();
1510            if ((scroll > position)) {
1511                 $('#header').removeClass('active');
1512                 $('#header').removeClass('static');
1513                $('.product-nav').removeClass('active');
1514                $('.sidebar').removeClass('active');
1515                var offset = 220;
1516                 $('#header').addClass('notactive');
1517            } else if ((scroll <= 40)) {
1518                 $('#header').addClass('static');
1519                $('#header').removeClass('notactive');
1520
1521            } else {
1522                var offset = 110;
1523
1524                $('#header').addClass('active');
1525                $('#header').removeClass('static');
1526                $('.product-nav').addClass('active');
1527                $('.sidebar').addClass('active');
1528                $('#header').removeClass('notactive')
1529
1530            }
1531            position = scroll;
1532            if ($('#mobileMenu').hasClass('opened')) {
1533                $('#header').removeClass('active');
1534                $('#header').addClass('static');
1535            }
1536        });
1537        jQuery('.modular-links a').on('click', function (e) {
1538            e.preventDefault();
1539            var hash = this.hash;
1540            var win = $(window).scrollTop();
1541            var sec = jQuery(hash).offset().top;
1542            if(win < sec ) {
1543                jQuery('html, body').animate({
1544                    scrollTop: jQuery(hash).offset().top - 110
1545                }, 800);
1546            }else{
1547                jQuery('html, body').animate({
1548                    scrollTop: jQuery(hash).offset().top - 220
1549                }, 800);
1550            }
1551
1552        });
1553
1554
1555        /*****************************************************
1556         ACCordion SCRIPT FAQ
1557         *****************************************************/
1558        jQuery('.faq-content .faqs-item:first-child').addClass('active');
1559        jQuery('.faq-content .faqs-item:first-child .accordion-content').slideDown(350);
1560        jQuery('.faq-content .faqs-item:first-child .accordion-content').addClass('show');
1561        jQuery('.faq-content .faqs-item:first-child .accordion-content .editor-content').addClass('text-light');
1562        jQuery('.accordion').click(function (e) {
1563            e.preventDefault();
1564            var $this = jQuery(this);
1565            if ($this.next().hasClass('show')) {
1566                $this.next().removeClass('show');
1567                $this.next().children().removeClass('text-light');
1568                $this.next().slideUp(350);
1569                $this.parents('.faqs-item ').removeClass('active');
1570            } else {
1571                $this.parents('.faqs-item ').addClass('active');
1572                $this.parent().parent().find('li .inner').removeClass('show');
1573                $this.parent().parents('.faq-content').find('.accordion-content').slideUp(350);
1574                $this.next().addClass('show');
1575                $this.next().children().addClass('text-light');
1576                $this.next('.accordion-content').slideDown(350);
1577                $this.parents('.faqs-item ').siblings().removeClass('active');
1578                $this.parents('.faqs-item ').siblings().find('.accordion-content').removeClass('show');
1579            }
1580        });
1581
1582
1583
1584        /* JS for ALL sidebar */
1585        jQuery('.cat-item .children').slideUp();
1586        jQuery(".cat-item ").children('.children').after("<span class='caticon'></span>");
1587        jQuery(".widget-title ").append("<span class='caticon'></span>");
1588
1589        jQuery(".children").parent().addClass("cat-parent");
1590        jQuery(".cat-parent .caticon").each(function (index) {
1591            jQuery(this).on("click", function () {
1592                jQuery(this).toggleClass('active');
1593                jQuery(this).parent().toggleClass('active');
1594                jQuery(this).siblings(".children").slideToggle(300);
1595            });
1596        });
1597        jQuery(".woocommerce-widget-layered-nav .widget-title").next().slideUp(400);
1598        jQuery("#woocommerce_layered_nav-21 .widget-title").next().slideDown(400);
1599        jQuery(".widget-title").click(function () {
1600            jQuery(this).next().slideToggle(400);
1601            jQuery(this).children().toggleClass('active');
1602        })
1603
1604
1605
1606
1607
1608        var x = jQuery(".container").offset();
1609        jQuery(".second-slide .slide-content").css('left', x.left + 120);
1610
1611        jQuery(".first-slide .slide-content").css('right', x.left + 120);
1612
1613
1614        jQuery(window).resize(function () {
1615            var x = jQuery(".container").offset();
1616            jQuery(".second-slide .slide-content").css('left', x.left + 120);
1617            jQuery(".first-slide .slide-content").css('right', x.left + 120);
1618        });
1619
1620        jQuery('.next.page-numbers').parent().addClass('pagination-nav pagination-nav-next');
1621        jQuery('.prev.page-numbers').parent().addClass('pagination-nav pagination-nav-prev');
1622
1623
1624
1625        $('.copy-btn').each(function(){
1626            $(this).on('click', function(e) {
1627                e.preventDefault();
1628                value = jQuery(this).data('clipboard-text');
1629                var $temp = jQuery('<input>');
1630                jQuery('body').append($temp);
1631                $temp.val(value).select();
1632                document.execCommand('copy');
1633                $temp.remove();
1634                $(this).children('.tooltip').text("Copied!");
1635            }).on('mouseout', function (e) {
1636                e.preventDefault();
1637                $(this).children('.tooltip').text("Copy url");
1638            })
1639        });
1640
1641        function checkRtl(character) {
1642            var RTL = ["ا", "ب", "پ", "ت", "س", "ج", "چ", "ح", "خ", "د", "ذ", "ر", "ز", "ژ", "س", "ش", "ص", "ض", "ط", "ظ", "ع", "غ", "ف", "ق", "ک", "گ", "ل", "م", "ن", "و", "ه", "ی"];
1643            return RTL.indexOf(character) > -1;
1644        }
1645        jQuery("#brands-search").on("change keyup input",function() {
1646            brands_search($(this))
1647        });
1648        function brands_search(e) {
1649            var value = e.val().toLowerCase();
1650            isrtl = checkRtl(value.charAt(0));
1651            if (isrtl == !0 || value == "") {
1652                jQuery("#brands-search").addClass("rtlt");
1653            } else {
1654                jQuery("#brands-search").removeClass("rtlt");
1655            }
1656            var nores = !0;
1657            jQuery(".brand-item-wrap").filter(function () {
1658                $(this).toggle(jQuery(this).data("search").toLowerCase().indexOf(value) > -1);
1659                if (jQuery(this).data("search").toLowerCase().indexOf(value) > -1 == !0) {
1660                    nores = !1;
1661                }
1662            });
1663            if (nores == !0) {
1664                jQuery(".no-results").show();
1665            } else {
1666                jQuery(".no-results").hide();
1667            }
1668        }
1669
1670
1671    });
1672
1673    if($(window).width() < 768){
1674    jQuery(document).ready(function($) {
1675        var $tables = $('.woocommerce-product-attributes');
1676        var $firstTableRows = $tables.first().find('tbody tr');
1677        var totalRowCount = $firstTableRows.length;
1678
1679        // Show first 4 rows of the first table
1680        $firstTableRows.slice(0, 4).css('display', 'flex');
1681
1682        // Add Show More button only if there are more than 4 rows in the first table
1683        if (totalRowCount > 4) {
1684            $('.attributes-wrapper').after('<button class="toggle-more-btn button-simple">نمایش بیشتر</button>');
1685        }
1686
1687        // Event handler for "Show More/Less" button
1688        $('.toggle-more-btn').on('click', function() {
1689            var $button = $(this);
1690            var isShown = $button.data('shown');
1691            var firstTableDone = false;
1692
1693            $tables.each(function() {
1694                $(this).find('tbody tr').each(function(index) {
1695                    // Skip the first 4 rows of the first table
1696                    if (!firstTableDone && index < 4) {
1697                        return true;
1698                    }
1699
1700                    // Toggle the row
1701                    $(this).slideToggle(function() {
1702                        if (isShown) {
1703                            $(this).css('display', 'none');
1704                        } else {
1705                            $(this).css('display', 'flex');
1706                        }
1707                    });
1708                });
1709
1710                firstTableDone = true;
1711            });
1712
1713            // Toggle button text and data attribute
1714            $button.text(isShown ? 'نمایش بیشتر' : 'نمایش کمتر').data('shown', !isShown);
1715            $button.toggleClass('less');
1716        });
1717    });
1718    };
1719
1720    $(document).ready(function() {
1721        $('.service-box').each(function(){
1722            var service_box = $(this);
1723            var imageHeight = service_box.find('.image-service img').height() - 90;
1724            if(service_box.find('.image-service img').lenght == '') {
1725                imageHeight = 500
1726            }
1727            var contentHeight = service_box.find('.content-service').height() ;
1728            service_box.find('.content-service').css('max-height', imageHeight + 'px');
1729
1730            if (contentHeight > imageHeight) {
1731                // Append the read more/less button
1732                service_box.append('<span class="read-more more"><i class="icon-shape"></i><i class="icon-long-down"></i></span>');
1733
1734                service_box.find('.read-more').click(function() {
1735                    if ($(this).hasClass("more") ) {
1736                        // Expand the content-service and change button text
1737                        service_box.find('.content-service').css('max-height', contentHeight + 'px');
1738                        $(this).removeClass('more');
1739                        $(this).addClass('less');
1740                    } else {
1741                        // Collapse the content-service and change button text
1742                        service_box.find('.content-service').css('max-height', imageHeight + 'px');
1743                        $(this).addClass('more');
1744                        $(this).removeClass('less');
1745                    }
1746                });
1747            }
1748        })
1749
1750
1751        // Set the initial height of content-service to match the image height
1752
1753    });
1754
1755
1756}(jQuery));
1757jQuery(document).ready(function(){
1758    var url = jQuery('#vidurl').val()
1759    if(url && url.indexOf('aparat.com') === -1){
1760        jQuery('.vid-wrap').append('<video  id="video-about" type="video/mp4" src="'+url+'" controls></video>')
1761        jQuery('.video-about').click(function(){
1762            jQuery('.video-about ').toggleClass('active')
1763            var video = document.querySelector("#video-about");
1764            if (video.paused & jQuery(".video-about").hasClass("active")){
1765                video.play(); }
1766            else {
1767                video.pause();
1768            }
1769        });
1770    }
1771
1772
1773
1774    jQuery('.banner-item').tilt({
1775        perspective: 1000,
1776        axis: 'y',
1777        disableAxis: 'X'
1778    });
1779});
1780
1781
1782
1783(function ($) {
1784    jQuery(document).ready(function(){
1785
1786        jQuery( ".sidebar-btn" ).on("click", function(){
1787            $("#mask").fadeIn(500);
1788            jQuery("#sidebar-shop").toggleClass('active')
1789        });
1790        jQuery( "#sidebar-shop" ).on("click", '.sidebar-close',function(){
1791            $("#mask").fadeOut(500);
1792            jQuery("#sidebar-shop").toggleClass('active')
1793        });
1794        $("#mask").click(function () {
1795            jQuery("#sidebar-shop").removeClass('active')
1796        });
1797
1798        $('.copy-btn').each(function(){
1799            $(this).on('click', function(e) {
1800                e.preventDefault();
1801                value = jQuery(this).data('clipboard-text');
1802                var $temp = jQuery('<input>');
1803                jQuery('body').append($temp);
1804                $temp.val(value).select();
1805                document.execCommand('copy');
1806                $temp.remove();
1807                $(this).children('.tooltip').text("Copied!");
1808            }).on('mouseout', function (e) {
1809                e.preventDefault();
1810                $(this).children('.tooltip').text("Copy url");
1811            })
1812        });
1813
1814
1815
1816        const menuItems = document.querySelectorAll('.scroll-item');
1817        if (menuItems.length !== 0) {
1818// Dynamically get sections based on href values in menuItems
1819            const sections = Array.from(menuItems).map(item => {
1820                const sectionId = item.getAttribute('href').substr(1);
1821                return document.getElementById(sectionId);
1822            }
1822).filter(Boolean);  // Remove null values
1823
1824            window.addEventListener('scroll', function () {
1825                let currentSection = null;
1826                sections.forEach(section => {
1827                    const sectionTop = section.offsetTop;
1828                    const sectionHeight = section.clientHeight;
1829
1830                    if (window.scrollY >= sectionTop - sectionHeight / 3 && window.scrollY < sectionTop + sectionHeight) {
1831                        currentSection = section;
1832                    }
1833                });
1834
1835                if (currentSection) {  // Null check
1836                    menuItems.forEach(item => {
1837                        item.classList.remove('active');
1838                        if (item.getAttribute('href').substr(1) === currentSection.id) {
1839                            item.classList.add('active');
1840                        }
1841                    });
1842                }
1843            });
1844        }
1845
1846    });
1847    /*****************************************************
1848     wishlist js
1849     *****************************************************/
1850
1851    jQuery(".wishlist-remove a").click(function () {
1852        jQuery(this).parent().parent().hide();
1853    });
1854
1855    jQuery(".wishlist-item").click(function (e) {
1856        e.preventDefault();
1857        var $elem = jQuery(this);
1858        if (!$elem.hasClass("wished")) {
1859            jQuery.ajax({
1860                url: ajax_data.url,
1861                data: {
1862                    action: "websima_wc_wishlist_add",
1863                    pid: jQuery(this).attr("data-id"),
1864                },
1865                dataType: "json",
1866                type: "post",
1867                success: function (response) {
1868                    $elem.addClass("wished");
1869                },
1870            });
1871        } else {
1872            jQuery.ajax({
1873                url: ajax_data.url,
1874                data: {
1875                    action: "websima_wc_wishlist_remove",
1876                    pid: jQuery(this).attr("data-id"),
1877                },
1878                dataType: "json",
1879                type: "post",
1880                success: function (response) {
1881                    $elem.removeClass("wished");
1882                },
1883            });
1884        }
1885    });
1886
1887
1888    $(".socials-share .icon-share").click(function() {
1889        $(".share-wrap").toggle( "slide" );
1890        setTimeout(function(){
1891            if($(".share-wrap").is(':visible')) {
1892                $(".share-wrap").toggle( "slide" )
1893            }
1894        }, 5000);
1895    });
1896    jQuery("#close-access").click(function() {
1897        jQuery(this).parents('.box').fadeOut('slow');
1898    });
1899
1900    jQuery(".quick-access").click(function() {
1901        jQuery(this).prev().fadeIn('slow');
1902    });
1903}(jQuery));
1904
1905// custom data table js
1906(function ($) {
1907    jQuery(document).ready(function(){
1908        var a = 0;
1909        $(window).scroll(function () {
1910            if ($(".hero-features").length) {
1911                var oTop = $(".hero-features").offset().top - window.innerHeight;
1912                if (a == 0 && $(window).scrollTop() > oTop) {
1913                    $(".hero-features .feature-num").each(function () {
1914                        var $this = $(this),
1915                            countTo = $this.html();
1916                        $({
1917                            countNum: $this.text(),
1918                        }).animate(
1919                            {
1920                                countNum: countTo,
1921                            },
1922                            {
1923                                duration: 2000,
1924                                easing: "swing",
1925                                step: function () {
1926                                    $this.text(Math.floor(this.countNum));
1927                                },
1928                                complete: function () {
1929                                    $this.text(this.countNum);
1930                                },
1931                            }
1932                        );
1933                    });
1934                    a = 1;
1935                }
1936            }
1937        });
1938
1939        function isInView(elem) {
1940            return elem[0].getBoundingClientRect().top < window.innerHeight;
1941        }
1942
1943        $(".feature-num").each(function () {
1944            $(this).attr("data-count", $(this).html());
1945            //$(this).html(0);
1946        });
1947
1948        $(window).scroll(function () {
1949            $(".feature-num").each(function () {
1950                if (isInView($(this))) {
1951                    counter_scroll($(this));
1952                }
1953            });
1954        });
1955
1956        var countDecimals = function (value) {
1957            if (Math.floor(value) === value) return 0;
1958            return value.toString().split(".")[1].length || 0;
1959        };
1960
1961        function naiveRound(num, decimalPlaces = 0) {
1962            var p = Math.pow(10, decimalPlaces);
1963            return Math.round(num * p) / p;
1964        }
1965
1966        function counter_scroll(e) {
1967            if (!e.hasClass("counted")) {
1968                e.addClass("counted");
1969                let n = parseInt(e.data("count"));
1970                var snail = { val: 0 };
1971                $(snail).animate(
1972                    { val: n },
1973                    {
1974                        duration: 2000,
1975                        easing: "swing",
1976                        step: function (now) {
1977                            e.html(naiveRound(now, countDecimals(n)));
1978                        },
1979                    }
1980                );
1981            }
1982        }
1983    });
1984
1985    if (jQuery(window).width() < 991) {
1986        jQuery('.feature-card').each( function() {
1987            jQuery(this).click(function(e){
1988                e.preventDefault();
1989                jQuery(this).parent().siblings().children('.desc').slideUp();
1990                jQuery(this).parent().siblings().removeClass('active');
1991                jQuery(this).next().slideToggle();
1992                jQuery(this).parent().toggleClass('active');
1993            })
1994
1995        });
1996    }
1997
1998
1999}(jQuery));
2000
2001
2002
2003
2004
2005
2006//
2007jQuery(document).ready(function($) {
2008    // Function to check and apply 'chosen' class based on cookies
2009    function applyChosenClassFromCookies() {
2010        $('.comment_container').each(function() {
2011            var commentId = $(this).data('id');
2012            var ratingType = getCookie('rated_comment_' + commentId);
2013
2014            if (ratingType) {
2015                var selector = ratingType === 'like' ? '.like-comment' : '.dislike-comment';
2016                $(this).find(selector).addClass('chosen');
2017            }
2018        });
2019    }
2020
2021    // Apply 'chosen' class based on cookies when the page loads
2022    applyChosenClassFromCookies();
2023
2024    $('.rate-comment .like-comment, .rate-comment .dislike-comment').on('click', function() {
2025        var commentId = $(this).closest('.comment_container').data('id');
2026        var ratingType = $(this).hasClass('like-comment') ? 'like' : 'dislike';
2027        var clickedElement = $(this);
2028
2029        if (getCookie('rated_comment_' + commentId)) {
2030            alert('You have already rated this comment.');
2031            return;
2032        }
2033
2034        $.ajax({
2035            type: 'post',
2036            dataType: 'json',
2037            url: ajax_data.url,
2038            data: {
2039                action: 'process_comment_rating',
2040                nonce: ajax_data.nonce,
2041                comment_id: commentId,
2042                rating_type: ratingType
2043            },
2044            success: function(response) {
2045                var commentSelector = '.comment_container[data-id="' + commentId + '"] ';
2046                $(commentSelector + '.like-comment .count').text(response.likes);
2047                $(commentSelector + '.dislike-comment .count').text(response.dislikes);
2048
2049                $(commentSelector + '.like-comment, ' + commentSelector + '.dislike-comment').removeClass('chosen');
2050                clickedElement.addClass('chosen');
2051
2052                setCookie('rated_comment_' + commentId, ratingType, 7); // Cookie expires in 7 days
2053            }
2054        });
2055    });
2056});
2057
2058
2059function setCookie(name, value, days) {
2060    var expires = "";
2061    if (days) {
2062        var date = new Date();
2063        date.setTime(date.getTime() + (days*24*60*60*1000));
2064        expires = "; expires=" + date.toUTCString();
2065    }
2066    // Adding SameSite=Lax attribute
2067    document.cookie = name + "=" + (value || "") + expires + "; path=/; SameSite=Lax";
2068}
2069
2070
2071function getCookie(name) {
2072    var nameEQ = name + "=";
2073    var ca = document.cookie.split(';');
2074    for(var i=0; i < ca.length; i++) {
2075        var c = ca[i];
2076        while (c.charAt(0)==' ') c = c.substring(1,c.length);
2077        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
2078    }
2079    return null;
2080}
2081
2082
2083document.addEventListener('DOMContentLoaded', function() {
2084    document.querySelectorAll('.video-container').forEach(function(container) {
2085
2086
2087        const video = container.querySelector('.video-element');
2088        const cover = container.querySelector('.video-poster');
2089        const videoBtn = container.querySelector('.video-btn');
2090        if (!video || !videoBtn) {
2091            return;
2092        }
2093        const icon = videoBtn.querySelector('i');
2094        if (!icon) {
2095            return;
2096        }
2097
2098        videoBtn.addEventListener('click', function() {
2099            if (video.paused) {
2100                video.play();
2101                if (cover) {
2102                    cover.style.display = 'none';
2103                }
2104                icon.classList.remove('icon-play');
2105                icon.classList.add('icon-pause');
2106                container.classList.add('hidden');
2107            } else {
2108                video.pause();
2109                if (cover) {
2110                    cover.style.display = 'block';
2111                }
2112                icon.classList.remove('icon-pause');
2113                icon.classList.add('icon-play');
2114            }
2115        });
2116        video.addEventListener('pause', function() {
2117            container.classList.remove('hidden'); // Show the button when video is paused
2118        });
2119
2120        video.addEventListener('ended', function() {
2121            container.classList.remove('hidden'); // Show the button when video ends
2122            icon.classList.remove('icon-pause');
2123            icon.classList.add('icon-play');
2124        });
2125    });
2126});
2127
2128
2129jQuery(".search-area").on('click','.load-more:not(.disable)',function(){
2130    let load_more_btn = jQuery(this);
2131    let loading_text = 'در حال ارسال اطلاعات ...';
2132    let more_text = 'نمایش بیشتر';
2133    let keyword = jQuery('#search-string').text();
2134
2135    let type = jQuery(this).attr("data-type");
2136    let paged = jQuery(this).attr("data-paged");
2137
2138    var $content = jQuery(this).parents('.search-box').find(".contents .row");
2139    paged = parseInt(paged) + 1;
2140
2141    jQuery.ajax({
2142        type : "post",
2143        data       : {
2144            action: "websima_search_results",
2145            type : type,
2146            paged : paged,
2147            keyword :  keyword,
2148            nonce: ajax_data.nonce
2149        },
2150        url : ajax_data.url,
2151        beforeSend : function(){
2152            load_more_btn.text(loading_text);
2153            load_more_btn.addClass('disable');
2154        },
2155        success:function(response){
2156            let statusCode = response.status;
2157            let htmlContent = response.html;
2158            let btn_status = response.more_btn;
2159
2160            if(statusCode == 0){
2161                load_more_btn.text(more_text);
2162                load_more_btn.removeClass('disable');
2163            }
2164
2165            if(statusCode == 1){
2166                if(htmlContent.trim() !== ''){
2167                    $content.append( jQuery(htmlContent).hide().fadeIn(750));
2168                }
2169
2170                if(btn_status){
2171                    load_more_btn.text(more_text);
2172                    load_more_btn.removeClass('disable');
2173                    load_more_btn.attr('data-paged',paged);
2174                }else{
2175                    load_more_btn.fadeOut('slow', function(){
2176                        load_more_btn.remove();
2177                    });
2178                }
2179            }
2180        },
2181        error:function(){
2182            load_more_btn.text(more_text);
2183            load_more_btn.removeClass('disable');
2184        }
2185    })
2186});
2187jQuery(function($){
2188    $('body.woocommerce-cart').on('click', '.showcoupon', function(){
2189        $('.woocommerce-form-coupon').slideToggle('slow')
2190        return false;
2191    });
2192});
2193

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.