Server IP : 192.64.112.168 / Your IP : 18.223.210.196 Web Server : Apache System : Linux nc-ph-2300-85.bluforrest.com 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Sat Dec 2 05:23:44 EST 2023 x86_64 User : expressoneac ( 1128) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/expressoneac/www/wp-content/themes/woodmart/js/scripts/menu/ |
Upload File : |
/* global woodmart_settings */ (function($) { woodmartThemeModule.menuDropdownsAJAX = function() { woodmartThemeModule.$body.on('mousemove', function(){ $('.menu').has('.dropdown-load-ajax').each(function() { var $menu = $(this); if ($menu.hasClass('dropdowns-loading') || $menu.hasClass('dropdowns-loaded')) { return; } loadDropdowns($menu); }); }); function loadDropdowns($menu) { $menu.addClass('dropdowns-loading'); var storageKey = woodmart_settings.menu_storage_key + '_' + $menu.attr('id'); var storedData = false; var $items = $menu.find('.dropdown-load-ajax'), ids = []; $items.each(function() { ids.push($(this).find('.dropdown-html-placeholder').data('id')); }); if (woodmart_settings.ajax_dropdowns_save && woodmartThemeModule.supports_html5_storage) { var unparsedData = localStorage.getItem(storageKey); try { storedData = JSON.parse(unparsedData); } catch (e) { console.log('cant parse Json', e); } } if (storedData) { renderResults(storedData); } else { $.ajax({ url : woodmart_settings.ajaxurl, data : { action: 'woodmart_load_html_dropdowns', ids : ids }, dataType: 'json', method : 'POST', success : function(response) { if (response.status === 'success') { renderResults(response.data); if (woodmart_settings.ajax_dropdowns_save && woodmartThemeModule.supports_html5_storage) { localStorage.setItem(storageKey, JSON.stringify(response.data)); } } else { console.log('loading html dropdowns returns wrong data - ', response.message); } }, error : function() { console.log('loading html dropdowns ajax error'); } }); } function renderResults(data) { Object.keys(data).forEach(function(id) { woodmartThemeModule.removeDuplicatedStylesFromHTML(data[id], function(html) { $menu.find('[data-id="' + id + '"]').replaceWith(html); $menu.addClass('dropdowns-loaded'); setTimeout(function() { $menu.removeClass('dropdowns-loading'); }, 1000); }); }); woodmartThemeModule.$document.trigger('wdLoadDropdownsSuccess'); } } }; $(document).ready(function() { woodmartThemeModule.menuDropdownsAJAX(); }); })(jQuery);