PageSourceSearch

https://deserttech.com/static/version1790073598/frontend/Mgs/desert/en_US/js/mgs_theme.js

js deserttech.com collected 2026-09-24 20:33:13 UTC 16,543 bytes, 394 lines download raw bytes

1require([
2    'jquery'
3], function ($) {
4    var $_miniCart = $("header.page-header .minicart-wrapper .block-minicart");
5    var $_loginForm = $("header.page-header .header-top-links .login-form");
6    var $_settingSite = $("header.page-header .setting-site .setting-site-content");
7    var $_wishlistHeader = $("header.page-header .top-wishlist .block-wishlist");
8
9    $(document).ready(function(){
10        /* Header */
11
12        /* Header Top Links */
13        $(document).on("click",".header-top-links > .actions",function(e){
14            // e.preventDefault();
15            if($('.header-area').hasClass('myaccount-slide')){
16                disableBodyScroll();
17            }
18            $('.header-top-links').toggleClass('active');
19            if($('.header-top-links').hasClass('active') && $('.header-top-links .captcha-reload').length){
20                $('.header-top-links').find('.captcha-reload').click();
21            }
22        });
23
24        $(document).on("click","#close-myaccount",function(e){
25            $(this).parents('.header-top-links').removeClass('active');
26            if($('header-area').hasClass('myaccount-slide')){
27                activeBodyScroll(false);
28            }
29        });
30
31        $(document).on("click","#close-myaccount",function(e){
32            $(this).parents('.header-top-links').removeClass('active');
33            if($('header-area').hasClass('myaccount-slide')){
34                activeBodyScroll(false);
35            }
36        });
37        /* ++++++++++++ */
38
39        /* Mini Cart */
40        $(document).on("click",".minicart-wrapper .details-qty .minus",function(e){
41            var $itemQty = parseInt($(this).parent().find('.cart-item-qty').attr('data-item-qty'));
42            var $val = parseInt($(this).parent().find('.cart-item-qty').val());
43            var $valChange = $val - 1;
44            if($val > 1){
45                $(this).parent().find('.cart-item-qty').val($valChange);
46                if($itemQty != $valChange){
47                    $(this).parents('.details-qty').find('.update-cart-item').show('fade', 300);
48                }else {
49                    $(this).parents('.details-qty').find('.update-cart-item').hide('fade', 300);
50                }
51            }
52        });
53
54        $(document).on("click",".minicart-wrapper .details-qty .plus",function(e){
55            var $val = parseInt($(this).parent().find('.cart-item-qty').val());
56            var $itemQty = parseInt($(this).parent().find('.cart-item-qty').attr('data-item-qty'));
57            var $valChange = $val + 1;
58            $(this).parent().find('.cart-item-qty').val($valChange);
59            if($itemQty != $valChange){
60                $(this).parents('.details-qty').find('.update-cart-item').show('fade', 300);
61            }else {
62                $(this).parents('.details-qty').find('.update-cart-item').hide('fade', 300);
63            }
64        });
65        /* ++++++++++++ */
66
67        /* Header Setting */
68        $(document).on("click",".setting-site .actions .action.setting",function(e){
69            disableBodyScroll();
70            $(this).parents('.setting-site').addClass('active');
71        });
72
73        $(document).on("click","#close-setting-site",function(e){
74            $('header.page-header .setting-site').removeClass('active');
75            activeBodyScroll(false);
76        });
77        /* ++++++++++++ */
78
79        /* Header Sticky Menu */
80        if($('.active-sticky:not(.header7)').length){
81            var headerHeight = $('.active-sticky:not(.header7)').height();
82            var topHeaderHeight = $('.top-header').height();
83            $(window).scroll(function(){
84                var st = $(this).scrollTop();
85                if(st > topHeaderHeight){
86                    $('.active-sticky').addClass('scrolling');
87                    $('#placeholder-header').css("cssText", "height: "+headerHeight+"px !important");
88                }else {
89                    $('.active-sticky').removeClass('scrolling');
90                    $('#placeholder-header').css("cssText", "height: 0px !important");
91                }
92            });
93        }
94        /* Footer */
95        $(".footer-title").click(function(){
96            if($(window).width() < 767){
97                $(this).parent().toggleClass('active');
98                $(this).parent().find('ul').slideToggle();
99            }
100        });
101        /* Menu Mobile */
102        $(document).on("click",".megamenu_action_mb",function(e){
103            if($('header.page-header').hasClass('active-menu')){
104                $('header.page-header').removeClass('active-menu');
105                activeBodyScroll(true);
106            }else {
107                $('header.page-header').addClass('active-menu');
108                disableBodyScroll();
109            }
110
111        });
112        $('.nav-main-menu .static-menu li > .toggle-menu a').click(function(){
113            $(this).toggleClass('active');
114            $(this).parent().parent().find('> ul').slideToggle();
115        });
116
117        $(document).on("click",".close-nav-button",function(e){
118            $('header.page-header').removeClass('active-menu');
119            activeBodyScroll(true);
120        });
121        /* Responsive Header*/
122        $('header.page-header button.action.nav-tg').click(function(){
123            if ($('html').hasClass('nav-open')) {
124                $('html').removeClass('nav-open');
125                setTimeout(function () {
126                    $('html').removeClass('nav-before-open');
127                }, 300);
128            } else {
129                $('html').addClass('nav-before-open');
130                setTimeout(function () {
131                    $('html').addClass('nav-open');
132                }, 42);
133            }
134        });
135
136        $('.close-nav-button').click(function(){
137            $('html').removeClass('nav-open');
138            setTimeout(function () {
139                $('html').removeClass('nav-before-open');
140            }, 300);
141        });
142
143        // Active minicart
144        $(document).on("click","#cart-top-action",function(e){
145            $('.table-icon-menu .minicart-wrapper .action.showcart').click();
146        });
147
148        //Active Mobile tabs
149        $(document).on("click","#js_mobile_tabs .action-mb-tabs",function(e){
150            if ($('html').hasClass('nav-open')) {
151                $('html').removeClass('nav-open');
152                setTimeout(function () {
153                    $('html').removeClass('nav-before-open');
154                }, 300);
155            } else {
156                $('html').addClass('nav-before-open');
157                setTimeout(function () {
158                    $('html').addClass('nav-open');
159                }, 42);
160                var $el_action = $(this).attr('id');
161                switch ($el_action) {
162                    case "my-account-action":
163                        $(".megamenu-content .nav-tabs li a").each(function() {
164                            $(this).parent('li').removeClass("active");
165                            $(".megamenu-content .tab-content .tab-pane").removeClass("active");
166                            $('[href="#main-Accountcontent"]').parent().addClass('active');
167                            $(".megamenu-content .tab-content #main-Accountcontent").addClass('active');
168                        });
169                        break;
170                    case "setting-web-action":
171                        $(".megamenu-content .nav-tabs li a ").each(function() {
172                            $(this).parent('li').removeClass("active");
173                            $(".megamenu-content .tab-content .tab-pane").removeClass("active");
174                            $('[href="#main-Settingcontent"]').parent().addClass('active');
175                            $(".megamenu-content .tab-content #main-Settingcontent").addClass('active');
176                        });
177                        break;
178
179                }
180            }
181        });
182
183        //Menu content mobile
184        $('.menu-content-mb .data.item.title li a').click(function(event){
185            event.preventDefault();
186            $('.menu-content-mb .data.item.title li').removeClass('active');
187            $('.menu-content-mb .data.item.tab-content > .tab-pane').removeClass('active');
188            $(this).parent().addClass('active');
189            var id = $(this).attr('href');
190            $(id).addClass('active');
191        });
192
193        // Footer Parallax
194        if ($('body').hasClass('parallax-footer')) {
195            var footerHeight = $('.page-footer').height();
196            $('body').css('padding-bottom', footerHeight);
197        }
198
199        //Quick view mobile
200        if ($(".products-grid .product-item-info .actions-link a").hasClass('quickview-mobile')) {
201            $(".products-grid .product-item-info").each(function() {
202                if($(window).width() < 768) {
203                    $(this).find(".actions-secondary > a.action.quickview").appendTo($(this).find(".action-mobile"));
204                }else {
205                    $(this).find(".action-mobile > a.action.quickview").appendTo($(this).find(".actions-secondary"));
206                }
207            });
208            $(window).resize(function(){
209                $(".products-grid .product-item-info").each(function() {
210                    if($(window).width() < 768) {
211                        $(this).find(".actions-secondary > a.action.quickview").appendTo($(this).find(".action-mobile"));
212                    }else {
213                        $(this).find(".action-mobile > a.action.quickview").appendTo($(this).find(".actions-secondary"));
214                    }
215                });
216            });
217        }
218
219        // Closed minicart
220        $(document).on("click","#close-minicart",function(e){
221            $('.table-icon-menu .minicart-wrapper .action.showcart').click();
222        });
223        // Home metro
224        if ($(window).width() <= 767) {
225            $(".metro-new-sale-off").prependTo(".metro-product-middle");
226            $(".metro-third-product").appendTo(".metro-product-top>.frame>.line>div:nth-child(1)>.line ");
227        }
228
229    });
230
231    $(document).mouseup(function(e) {
232        var container = $(".top-wishlist");
233        if (container.is(e.target) && container.has(e.target).length === 0) {
234            container.removeClass('active');
235        }
236    });
237
238    function disableBodyScroll() {
239        $('body').addClass('fixed-content');
240    }
241
242    function activeBodyScroll($status) {
243        if(!$status){
244            $('body').removeClass('fixed-content');
245        }else {
246            if(!$('.page-header .header-top-links').hasClass('active') && !$('.page-header .top-wishlist').hasClass('active') && !$('.page-header .setting-site').hasClass('active') && !$('.page-header').hasClass('active-menu')){
247                $('body').removeClass('fixed-content');
248            }
249        }
250    }
251
252    $(document).ready(function() {
253
254        function changeNumber(el, classEl) {
255            if ($(".change-product-per-row a").hasClass('active')) {
256                $(".change-product-per-row a").removeClass('active')
257            }
258            el.addClass('active');
259
260            if($(window).width() >= 992) {
261                $('.product-list-masonry-change-product .product-item-masonry').removeClass(function (index, css) {
262                    return (css.match (/\bcol-des\S+/g) || []).join(' '); // removes anything that starts with "itemnx"
263                });
264                $('.product-list-masonry-change-product .product-item-masonry').removeClass(function (index, css) {
265                    return (css.match (/\bcol-tb\S+/g) || []).join(' '); // removes anything that starts with "itemnx"
266                });
267            }
268            $('.product-list-masonry-change-product .product-item-masonry').addClass(classEl);
269
270
271        }
272
273        if($(window).width() >= 992) {
274            $(".change-product-per-row .one").click(function(e) {
275                e.preventDefault();
276                changeNumber($(this), 'col-des-12 col-tb-12');
277            });
278            $(".change-product-per-row .two").click(function(e) {
279                e.preventDefault();
280                changeNumber($(this), 'col-des-6 col-tb-6');
281            });
282            $(".change-product-per-row .three").click(function(e) {
283                e.preventDefault();
284                changeNumber($(this), 'col-des-4 col-tb-4');
285            });
286            $(".change-product-per-row .four").click(function(e) {
287                e.preventDefault();
288                changeNumber($(this), 'col-des-3 col-tb-3');
289            });
290            $(".change-product-per-row .five").click(function(e) {
291                e.preventDefault();
292                changeNumber($(this), 'col-des-custom-5');
293            });
294            $(".change-product-per-row .six").click(function(e) {
295                e.preventDefault();
296                changeNumber($(this), 'col-des-2 col-tb-2');
297            });
298            $(".change-product-per-row .seven").click(function(e) {
299                e.preventDefault();
300                changeNumber($(this), 'col-des-custom-7');
301            });
302            $(".change-product-per-row .eight").click(function(e) {
303                e.preventDefault();
304                changeNumber($(this), 'col-des-custom-8');
305            });
306        }
307
308    });
309    $(document).ajaxComplete(function() {
310
311        function changeNumber(el, classEl) {
312            if ($(".change-product-per-row a").hasClass('active')) {
313                $(".change-product-per-row a").removeClass('active')
314            }
315            el.addClass('active');
316
317            if($(window).width() >= 992) {
318                $('.product-list-masonry-change-product .product-item-masonry').removeClass(function (index, css) {
319                    return (css.match (/\bcol-des\S+/g) || []).join(' '); // removes anything that starts with "itemnx"
320                });
321                $('.product-list-masonry-change-product .product-item-masonry').removeClass(function (index, css) {
322                    return (css.match (/\bcol-tb\S+/g) || []).join(' '); // removes anything that starts with "itemnx"
323                });
324            }
325            $('.product-list-masonry-change-product .product-item-masonry').addClass(classEl);
326
327
328        }
329
330        if($(window).width() >= 992) {
331            $(".change-product-per-row .one").click(function(e) {
332                e.preventDefault();
333                changeNumber($(this), 'col-des-12 col-tb-12');
334            });
335            $(".change-product-per-row .two").click(function(e) {
336                e.preventDefault();
337                changeNumber($(this), 'col-des-6 col-tb-6');
338            });
339            $(".change-product-per-row .three").click(function(e) {
340                e.preventDefault();
341                changeNumber($(this), 'col-des-4 col-tb-4');
342            });
343            $(".change-product-per-row .four").click(function(e) {
344                e.preventDefault();
345                changeNumber($(this), 'col-des-3 col-tb-3');
346            });
347            $(".change-product-per-row .five").click(function(e) {
348                e.preventDefault();
349                changeNumber($(this), 'col-des-custom-5');
350            });
351            $(".change-product-per-row .six").click(function(e) {
352                e.preventDefault();
353                changeNumber($(this), 'col-des-2 col-tb-2');
354            });
355            $(".change-product-per-row .seven").click(function(e) {
356                e.preventDefault();
357                changeNumber($(this), 'col-des-custom-7');
358            });
359            $(".change-product-per-row .eight").click(function(e) {
360                e.preventDefault();
361                changeNumber($(this), 'col-des-custom-8');
362            });
363        }
364
365    });
366
367
368
369
370    /* ++++++++++++ */
371    /* ++++++ Resize Function  ++++++ */
372    $(window).resize(function(){
373        // Home metro
374        if ($(window).width() <= 767) {
375            $(".metro-new-sale-off").prependTo(".metro-product-middle");
376            $(".metro-third-product").appendTo(".metro-product-top>.frame>.line>div:nth-child(1)>.line ");
377        }
378
379        if($(window).width() > 1199) {
380            if(!$('#main-Menucontent').hasClass('active')) {
381                $('#main-Accountcontent').removeClass('active');
382                $('#main-Settingcontent').removeClass('active');
383                $('#main-Menucontent').addClass('active');
384            }
385        } 
386
387        // Footer Parallax
388        var footerHeight = $('.page-footer').height();
389        if ($('body').hasClass('parallax-footer')) {
390            $('body').css('padding-bottom', footerHeight);
391        }
392    });
393    /* ++++++++++++ */
394});

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.