1(function ($) { 2 'use strict'; 3 4 var pluginUrl = typeof manElementorAddons !== 'undefined' ? manElementorAddons.pluginUrl : ''; 5 6 var icons = { 7 arrowLeftDark: pluginUrl + 'assets/icons/arrow_blue_left.png', 8 arrowLeftLight: pluginUrl + 'assets/icons/arrow_blue_left.png', 9 arrowRightDark: pluginUrl + 'assets/icons/arrow_blue_right.png', 10 arrowRightLight: pluginUrl + 'assets/icons/arrow_blue_right.png' 11 }; 12 13 function initManCarousel($scope) { 14 const $carousel = $scope.find('.man-carousel, .man-pricing-carousel'); 15 const itemCount = $carousel.find('.box, .man-image-box, .pricing-box').length; 16 17 if (!$carousel.length || $carousel.hasClass('owl-loaded')) return; 18 19 const columns = parseInt($carousel.data('columns')) || 3; 20 const loopEnabled = itemCount > columns; 21 const navEnabled = itemCount > 1; 22 23 $carousel.owlCarousel({ 24 loop: false, 25 margin: 20, 26 nav: navEnabled, 27 dots: false, 28 autoplay: false, 29 autoplayTimeout: 4000, 30 navText: [ 31 '<img class="custom-prev-arrow" src="' + icons.arrowLeftDark + '" alt="Previous">', 32 '<img class="custom-next-arrow" src="' + icons.arrowRightDark + '" alt="Next">' 33 ], 34 responsive: { 35 0: { items: 1, margin: 10, autoWidth: false }, 36 350: { items: 2, margin: 10, autoWidth: false }, 37 600: { items: Math.min(2, columns), autoWidth: false }, 38 768: { items: Math.min(2, columns), autoWidth: false }, 39 1024: { items: columns, autoWidth: false } 40 }, 41 onInitialized: updateNavArrows, 42 onChanged: updateNavArrows 43 }); 44 45 function updateNavArrows(event) { 46 const current = event.item.index; 47 const total = event.item.count; 48 const visible = event.page.size; 49 50 if (current === 0) { 51 $carousel.find('.custom-prev-arrow').attr('src', icons.arrowLeftLight); 52 } else { 53 $carousel.find('.custom-prev-arrow').attr('src', icons.arrowLeftDark); 54 } 55 56 if (current + visible >= total) { 57 $carousel.find('.custom-next-arrow').attr('src', icons.arrowRightLight); 58 } else { 59 $carousel.find('.custom-next-arrow').attr('src', icons.arrowRightDark); 60 } 61 } 62 } 63 64 // Initialize Pricing Toggle with AJAX 65 function initPricingToggle($scope) { 66 const $toggleWrapper = $scope.find('.man-pricing-toggle-wrapper'); 67 const $carousel = $scope.find('.man-pricing-carousel'); 68 69 if (!$toggleWrapper.length) return; 70 71 const $checkbox = $toggleWrapper.find('.toggle-checkbox'); 72 const $label1 = $toggleWrapper.find('.toggle-label-1'); 73 const $label2 = $toggleWrapper.find('.toggle-label-2'); 74 const ajaxUrl = $toggleWrapper.data('ajax-url'); 75 const ajaxData = $toggleWrapper.data('settings'); 76 77 if (!ajaxData) return; 78 79 $checkbox.on('change', function() { 80 const isOneTime = $(this).is(':checked'); 81 const pricingType = isOneTime ? 'onetime' : 'unlimited'; 82 83 // Update labels 84 if (isOneTime) { 85 $label1.removeClass('active'); 86 $label2.addClass('active'); 87 } else { 88 $label1.addClass('active'); 89 $label2.removeClass('active'); 90 } 91 92 // Show loading 93 $carousel.addClass('loading').css('opacity', '0.5'); 94 95 // AJAX call 96 $.ajax({
97 url: ajaxUrl, 98 type: 'POST', 99 data: { 100 action: 'man_pricing_toggle', 101 nonce: ajaxData.nonce, 102 settings: ajaxData.settings, 103 pricing_type: pricingType 104 }, 105 success: function(response) { 106 if (response.success && response.data.html) { 107 // Destroy owl carousel 108 if ($carousel.hasClass('owl-loaded')) { 109 $carousel.trigger('destroy.owl.carousel'); 110 } 111 112 // Update HTML 113 $carousel.html(response.data.html); 114 115 // Reinitialize carousel 116 $carousel.removeClass('owl-loaded owl-hidden'); 117 initManCarousel($scope); 118 } 119 $carousel.removeClass('loading').css('opacity', '1'); 120 }, 121 error: function() { 122 $carousel.removeClass('loading').css('opacity', '1'); 123 console.error('AJAX error'); 124 } 125 }); 126 }); 127 128 // Also make labels clickable 129 $label1.on('click', function() { 130 if ($checkbox.is(':checked')) { 131 $checkbox.prop('checked', false).trigger('change'); 132 } 133 }); 134 135 $label2.on('click', function() { 136 if (!$checkbox.is(':checked')) { 137 $checkbox.prop('checked', true).trigger('change'); 138 } 139 }); 140 } 141 142 // Register the function for multiple widgets 143 $(window).on('elementor/frontend/init', function () { 144 const widgets = [ 145 'man_image_box_carousel_widget.default', 146 'man_pricing_carousel_widget.default' 147 ]; 148 149 widgets.forEach(function(widgetName) { 150 elementorFrontend.hooks.addAction(`frontend/element_ready/${widgetName}`, function ($scope) { 151 initManCarousel($scope); 152 153 // Initialize toggle for pricing widget 154 if (widgetName === 'man_pricing_carousel_widget.default') { 155 initPricingToggle($scope); 156 } 157 }); 158 }); 159 }); 160 161 162 /* 163 * Location Review Card Widget âââââââââââââââââââââââââââââââââââââââââââ 164 */ 165 $(document).on('click', '.mlrc-card .button_wrapper .js-mlrc-open-modal', function () { 166 var id = $(this).data('widget-id'); 167 var $modal = $('#mlrc-modal-' + id); 168 169 $modal.find('.mlrc-rating-btn').removeClass('active'); 170 $modal.find('.mlrc-rating-wrap').show(); 171 $modal.find('.mlrc-footer-note').show(); 172 $modal.find('.mlrc-response').hide(); 173 $modal.fadeIn(200); 174 }); 175 176 $(document).on('click', '.mlrc-modal .js-mlrc-close', function () { 177 var id = $(this).data('widget-id'); 178 $('#mlrc-modal-' + id).fadeOut(200); 179 }); 180 181 $(document).on('click', '.mlrc-modal .mlrc-modal-overlay', function (e) { 182 if ($(e.target).hasClass('mlrc-modal-overlay')) { 183 $(this).fadeOut(200); 184 } 185 }); 186 187 $(document).on('click', '.mlrc-modal .js-mlrc-rating', function () { 188 var rating = parseInt( $(this).data('rating') ); 189 var widgetId = $(this).data('widget-id'); 190 var threshold = parseInt( $('#mlrc-modal-' + widgetId).data('threshold') ) || 3; 191 192 $('.mlrc-modal .js-mlrc-rating[data-widget-id="' + widgetId + '"]').removeClass('active'); 193 $(this).addClass('active'); 194 195 // Rating wrap aur footer hide karo 196 $('#mlrc-modal-' + widgetId).find('.mlrc-rating-wrap').hide(); 197 $('#mlrc-modal-' + widgetId).find('.mlrc-footer-note').hide(); 198 199 if ( rating <= threshold ) { 200 $('#mlrc-high-' + widgetId).hide(); 201 $('#mlrc-low-' + widgetId).show(); 202 } else { 203 $('#mlrc-low-' + widgetId).hide(); 204 $('#mlrc-high-' + widgetId).show(); 205 } 206 }); 207 208})(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.