1/* vim: set ts=2 sw=2 sts=2 et: */ 2 3/** 4 * Copyright (c) 2001-present X-Cart Holdings LLC. All rights reserved. 5 * See https://www.x-cart.com/license-agreement.html for license details. 6 */ 7 8jQuery(document).ready(function () { 9 let ajaxCategories = { 10 init: function () { 11 let self = this; 12 13 $('#sidebar-first .ajax-category').each(function () { 14 self.initCommonHandler($(this)); 15 }); 16 }, 17 ajaxConfig: function (categoryId) { 18 return { 19 url: xliteConfig.script + 20 '?target=category&widget=\\QSL\\FlyoutCategoriesMenu\\View\\TopCategories' + 21 '&mode=ajax' + 22 '&category_id=' + categoryId 23 }; 24 }, 25 setLoadingState: function (elem) { 26 elem.append($('<ul class="sublevel"><li class="loading"><a>Loading</a></li></ul>')); 27 }, 28 unsetLoadingState: function (elem) { 29 elem.find('ul').remove(); 30 }, 31 initCommonHandler: function (elem) { 32 let self = this; 33 34 elem.off('mouseenter').on('mouseenter', function () { 35 let item = $(this); 36 37 if (item.find('ul').length === 0) { 38 let categoryId = item.attr('class').replace(/^.*category-id-(\d+).*$/, '$1'); 39 40 self.setLoadingState(item); 41 42 jQuery.ajax(self.ajaxConfig(categoryId)).done(function (data) { 43 let loadedList = $(data).find('ul'); 44 45 self.unsetLoadingState(item); 46 item.off('mouseenter').removeClass('ajax-category').append(loadedList); 47 self.init(); 48 }); 49 } 50 }); 51 } 52 }; 53 54 ajaxCategories.init(); 55});
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.