PageSourceSearch

https://myghana.com/wp-content/themes/classima/assets/js/main.js?ver=3.0.2

js myghana.com collected 2026-10-01 14:27:38 UTC 15,109 bytes, 431 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    jQuery(document).ready(function ($) {
5        /* Scroll to top */
6        $('.scrollToTop').on('click', function () {
7            $('html, body').animate({scrollTop: 0}, 800);
8            return false;
9        });
10        $(window).scroll(function () {
11            if ($(this).scrollTop() > 100) {
12                $('.scrollToTop').fadeIn();
13            } else {
14                $('.scrollToTop').fadeOut();
15            }
16        });
17
18        /* Bootstrap Tooltip */
19        $('body').tooltip({
20            selector: '[data-toggle=tooltip]'
21        });
22
23        /*  Mobile Menu */
24
25        var a = $('.offscreen-navigation .menu');
26        if (a.length) {
27            a.children("li").addClass("menu-item-parent");
28            a.find(".menu-item-has-children > a").on("click", function (e) {
29                e.preventDefault();
30                $(this).toggleClass("opened");
31                var n = $(this).next(".sub-menu"),
32                    s = $(this).closest(".menu-item-parent").find(".sub-menu");
33                a.find(".sub-menu").not(s).slideUp(250).prev('a').removeClass('opened'), n.slideToggle(250)
34            });
35            a.find('.menu-item:not(.menu-item-has-children) > a').on('click', function (e) {
36                $('.rt-slide-nav').slideUp();
37                $('body').removeClass('slidemenuon');
38            });
39        }
40
41        $('.sidebarBtn').on('click', function (e) {
42            e.preventDefault();
43            if ($('.rt-slide-nav').is(":visible")) {
44                $('.rt-slide-nav').slideUp();
45                $('body').removeClass('slidemenuon');
46            } else {
47                $('.rt-slide-nav').slideDown();
48                $('body').addClass('slidemenuon');
49            }
50
51        });
52
53        $('.classima-listing-cat-open-menu').on('click', function () {
54            $('.rt-listing-cat-list-2 .listing-category-list').slideToggle();
55        });
56
57        /* Mobile: Toggle subcategory list on arrow click */
58        if ($(window).width() <= 767) {
59            $('.rt-listing-cat-list-2 .sidebar-el-category__arrow').on('click', function (e) {
60                e.preventDefault();
61                e.stopPropagation();
62                var $li = $(this).closest('li');
63                $li.toggleClass('rt-subcategory-open');
64                $li.children('ul').slideToggle(300);
65            });
66        }
67
68        $('.classima-MyAccount-open-menu').on('click', function () {
69            $('.rtcl-MyAccount-mobile-navbar .rtcl-MyAccount-navigation').slideToggle();
70        });
71
72        /* Mega Menu */
73        $('.site-header .main-navigation ul > li.mega-menu').each(function () {
74            // total num of columns
75            var items = $(this).find(' > ul.sub-menu > li').length;
76            // screen width
77            var bodyWidth = $('body').outerWidth();
78            // main menu link width
79            var parentLinkWidth = $(this).find(' > a').outerWidth();
80            // main menu position from left
81            var parentLinkpos = $(this).find(' > a').offset().left;
82
83            var width = items * 240;
84            var left = (width / 2) - (parentLinkWidth / 2);
85
86            var linkleftWidth = parentLinkpos + (parentLinkWidth / 2);
87            var linkRightWidth = bodyWidth - (parentLinkpos + parentLinkWidth);
88
89            // exceeds left screen
90            if ((width / 2) > linkleftWidth) {
91                $(this).find(' > ul.sub-menu').css({
92                    width: width + 'px',
93                    right: 'inherit',
94                    left: '-' + parentLinkpos + 'px'
95                });
96            }
97            // exceeds right screen
98            else if ((width / 2) > linkRightWidth) {
99                $(this).find(' > ul.sub-menu').css({
100                    width: width + 'px',
101                    left: 'inherit',
102                    right: '-' + linkRightWidth + 'px'
103                });
104            } else {
105                $(this).find(' > ul.sub-menu').css({
106                    width: width + 'px',
107                    left: '-' + left + 'px'
108                });
109            }
110        });
111
112        /* Sticky Menu */
113
114        if (ClassimaObj.hasStickyMenu == 1) {
115            run_sticky_menu();
116        }
117
118        // Scripts needs loading inside content area
119        rdtheme_content_ready_scripts();
120
121        // resize autocomplete ui
122        if ($(window).width() < 992) {
123            var autocomplete_item = $(
124                ".rtcl-widget-search-form .rtcl-autocomplete"
125            );
126            if ($.fn.autocomplete && autocomplete_item.length) {
127                $.ui.autocomplete.prototype._resizeMenu = function () {
128                    var ul = this.menu.element;
129                    ul.outerWidth(this.element.closest('.form-group').outerWidth() - 35);
130                }
131            }
132        }
133
134    });
135
136    // Window Load
137    $(window).on('load', function () {
138
139        // Scripts needs loading inside content area
140        rdtheme_content_load_scripts();
141
142        // Preloader
143        $('#preloader').fadeOut('slow', function () {
144            $(this).remove();
145        });
146    });
147
148    // Elementor Frontend Load
149    $(window).on('elementor/frontend/init', function () {
150        if (elementorFrontend.isEditMode()) {
151            elementorFrontend.hooks.addAction('frontend/element_ready/widget', function () {
152                rdtheme_content_ready_scripts()
153                rdtheme_content_load_scripts();
154            });
155        }
156    });
157
158    function rdtheme_content_ready_scripts() {
159
160        /*---------------------------------------
161          Background Parallax
162          --------------------------------------- */
163        if ($(".rt-parallax-bg-yes").length) {
164            $(".rt-parallax-bg-yes").each(function () {
165                var speed = $(this).data('speed');
166                $(this).parallaxie({
167                    speed: speed ? speed : 0.5,
168                    offset: 0,
169                });
170            })
171        }
172
173        // Isotope
174        if (typeof $.fn.isotope == 'function' && typeof $.fn.imagesLoaded == 'function') {
175
176            // Blog Layout 2
177            var $blogIsotopeContainer = $('.post-isotope');
178            $blogIsotopeContainer.imagesLoaded(function () {
179                $blogIsotopeContainer.isotope();
180            });
181
182            // Run 1st time
183            var $isotopeContainer = $('.rt-el-isotope-container');
184            $isotopeContainer.imagesLoaded(function () {
185                $isotopeContainer.each(function () {
186                    var $container = $(this).find('.rt-el-isotope-wrapper'),
187                        filter = $(this).find('.rt-el-isotope-tab a.current').data('filter');
188                    runIsotope($container, filter);
189                });
190            });
191
192            // Run on click even
193            $('.rt-el-isotope-tab a').on('click', function () {
194                $(this).closest('.rt-el-isotope-tab').find('.current').removeClass('current');
195                $(this).addClass('current');
196                var $container = $(this).closest('.rt-el-isotope-container').find('.rt-el-isotope-wrapper'),
197                    filter = $(this).attr('data-filter');
198                runIsotope($container, filter);
199                return false;
200            });
201        }
202
203        /* Counter */
204        if (typeof $.fn.counterUp == 'function') {
205            $('.rt-el-counter .rt-counter-num').counterUp();
206        }
207
208        /* Zoom */
209        if (typeof $.fn.zoom == 'function') {
210            if (typeof rtcl_single_listing_params != 'undefined') {
211                if (rtcl_single_listing_params.zoom_enabled) {
212                    $('.classima-single-details .rtin-slider-box .rtcl-slider-item').zoom();
213                }
214            }
215        }
216
217        /* Listing Search Dropdown */
218        $('.classima-listing-search-dropdown .dropdown-item').on('click', function () {
219            var $parent = $(this).closest('.classima-listing-search-dropdown'),
220                type = $(this).data('adtype'),
221                text = $(this).text();
222
223            $parent.find('input').val(type);
224            $parent.find('button').text(text);
225            $parent.dropdown('hide');
226
227            return false;
228        });
229
230        /* Listing - Reveal Phone */
231        $(document).on('click', '.classima-phone-reveal', function (e) {
232            e.preventDefault();
233            if ($(this).hasClass('not-revealed')) {
234                $(this).removeClass('not-revealed').addClass('revealed');
235                var phone = $(this).data('phone');
236                $(this).find('span').text(phone);
237            }
238
239            return false;
240        });
241
242        $(".headerCategoriesMenu").on({
243            mouseenter: function () {
244                $('.headerCategoriesMenu__dropdown').css({
245                    'opacity': '1',
246                    'visibility': 'visible',
247                    'transform': 'translateY(0px)',
248                    '-webkit-transform': 'translateY(0px)'
249                });
250            },
251            mouseleave: function () {
252                $('.headerCategoriesMenu__dropdown').css({
253                    'opacity': '0',
254                    'visibility': 'hidden',
255                    'transform': 'translateY(20px)',
256                    '-webkit-transform': 'translateY(20px)'
257                });
258            }
259        });
260
261        $(".classima-load-more .load-more-btn").on("click", function (e) {
262            e.preventDefault();
263
264            var $this = $(this),
265                $btnWrapper = $this.closest('.load-more-wrapper'),
266                page = $btnWrapper.data('page'),
267                display_options = $btnWrapper.data('options'),
268                query = $btnWrapper.data('query'),
269                layout = $btnWrapper.data('layout'),
270                col_class = $btnWrapper.data('col-class'),
271                total_pages = $btnWrapper.data('total-pages'),
272                post_per_page = $btnWrapper.data('posts-per-page');
273
274            $.ajax({
275                // use the ajax object url
276                type: "POST",
277                url: ClassimaObj.ajax_url,
278                data: {
279                    action: "listing_load_more_ad",
280                    offset: page * post_per_page,
281                    layout: layout,
282                    col_class: col_class,
283                    post_per_page: post_per_page,
284                    display: display_options,
285                    queryArg: query
286                },
287                beforeSend: function () {
288                    $btnWrapper.addClass('rt-loading');
289                },
290                success: function (data) {
291                    // add the posts to the container and add to your page count
292                    page++;
293                    $btnWrapper.data('page', page);
294                    $btnWrapper.closest('.rt-el-listing-grid').find('.row').append(data);
295                    if (page > total_pages) {
296                        $btnWrapper.hide();
297                    }
298                    $btnWrapper.removeClass('rt-loading');
299                },
300                error: function (data) {
301                    // test to see what you get back on error
302                    console.log(data);
303                }
304            });
305
306        });
307
308        /* Listing Mapview - Sidebar top */
309        if ($('body').hasClass('mean-activated')) {
310            var height = $('#meanmenu').outerHeight();
311        } else {
312            var height = $('#site-header').outerHeight();
313        }
314
315        if (ClassimaObj.hasAdminBar == 1) {
316            height += $('#wpadminbar').outerHeight();
317        }
318
319        $('.listing-mapview-sidebar').css('top', height + 'px');
320
321        /* Listing Mapview - Sticky Map */
322        if (typeof StickySidebar == 'function') {
323            var topSpacing = 0;
324
325            if (ClassimaObj.hasStickyMenu == 1) {
326                topSpacing += $('#site-header').outerHeight();
327            }
328
329            if (ClassimaObj.hasAdminBar == 1) {
330                topSpacing += $('#wpadminbar').outerHeight();
331            }
332            if ($('.listing-mapview-map').length) {
333                var sidebar = new StickySidebar('.listing-mapview-map', {
334                    topSpacing: topSpacing,
335                    minWidth: 1200,
336                    containerSelector: '.listing-mapview-content-wrap',
337                    innerWrapperSelector: '.rtcl-map-view'
338                });
339            }
340        }
341    }
342
343    function rdtheme_content_load_scripts() {
344
345        /* Animated text */
346        if (typeof Typed == 'function' && $(window).width() > 1199.98) {
347            $('.title-typejs').each(function (index, el) {
348                var options = $(this).data('options');
349                new Typed(this, options);
350            });
351        } else {
352            $('.title-typejs').each(function (index, el) {
353                var options = $(this).data('options');
354                $(this).text(options.strings);
355            });
356        }
357    }
358
359    function run_sticky_menu() {
360
361        var wrapperHtml = $('<div class="main-header-sticky-wrapper"></div>');
362        var wrapperClass = '.main-header-sticky-wrapper';
363
364        $('.main-header').clone(true).appendTo(wrapperHtml);
365        $('body').append(wrapperHtml);
366
367        var height = $(wrapperClass).outerHeight() + 30;
368
369        $(wrapperClass).css('margin-top', '-' + height + 'px');
370
371        $(window).scroll(function () {
372            if ($(this).scrollTop() > 300) {
373                $('body').addClass('rdthemeSticky');
374            } else {
375                $('body').removeClass('rdthemeSticky');
376            }
377        });
378    }
379
380    function runIsotope($container, filter) {
381        $container.isotope({
382            filter: filter,
383            animationOptions: {
384                duration: 750,
385                easing: 'linear',
386                queue: false
387            }
388        });
389    }
390
391})(jQuery);
392
393
394/* Generate class based on container width */
395(function ($) {
396    "use strict";
397
398    $(window).on('load resize', elementWidth);
399
400    function elementWidth() {
401        $('.elementwidth').each(function () {
402            var $container = $(this),
403                width = $container.outerWidth(),
404                classes = $container.attr("class").split(' '); // get all class
405
406            var classes1 = startWith(classes, 'elwidth'); // class starting with "elwidth"
407            classes1 = classes1[0].split('-'); // "elwidth" classnames into array
408            classes1.splice(0, 1); // remove 1st element "elwidth"
409
410            var classes2 = startWith(classes, 'elmaxwidth'); // class starting with "elmaxwidth"
411            classes2.forEach(function (el) {
412                $container.removeClass(el);
413            });
414
415            classes1.forEach(function (el) {
416                var maxWidth = parseInt(el);
417
418                if (width <= maxWidth) {
419                    $container.addClass('elmaxwidth-' + maxWidth);
420                }
421            });
422        });
423    }
424
425    function startWith(item, stringName) {
426        return $.grep(item, function (elem) {
427            return elem.indexOf(stringName) == 0;
428        });
429    }
430
431}(jQuery));

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