1/* vim: set ts=2 sw=2 sts=2 et: */ 2 3/** 4 * Sticky footer 5 * 6 * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved. 7 * See https://www.x-cart.com/license-agreement.html for license details. 8 */ 9 10(function() { 11 12 function loadWidget(widget, selector, dfd) { 13 core.get({ 14 target: "main", 15 widget: widget 16 }).done(function(data) { 17 if ($(selector).children().length > 0) { 18 dfd.resolve(); 19 return; 20 } 21 22 var widget = $(data); 23 24 var uuid = _.uniqueId(); 25 26 core.bind(['resources.ready', 'resources.empty'], _.bind( 27 function(event, args){ 28 if (args.uuid === uuid) { 29 var newContent = widget.find(selector); 30 $(selector).replaceWith(newContent); 31 32 dfd.resolve(); 33 } 34 }, 35 this) 36 ); 37 38 core.parsePreloadedLabels(widget, uuid); 39 core.parseResources(widget, uuid); 40 }); 41 } 42 43 function loadDesktopNavbar() { 44 var dfd = new jQuery.Deferred(); 45 var responsiveClass = getResponsiveClass(document.body); 46 47 if (responsiveClass !== 'mobile' || !responsiveClass) { 48 dfd.resolve(); 49 } else { 50 loadWidget("XLite\\View\\Layout\\Customer\\DesktopNavbar", "[data-desktop-navbar]", dfd); 51 } 52 53 return dfd; 54 } 55 56 function loadMobileNavbar() { 57 var dfd = new jQuery.Deferred(); 58 var responsiveClass = getResponsiveClass(document.body); 59 60 if (responsiveClass !== 'desktop' || !responsiveClass) { 61 dfd.resolve(); 62 } else { 63 loadWidget("XLite\\View\\Slidebar", "[data-mobile-navbar]", dfd); 64 } 65 66 return dfd; 67 } 68 69 function getResponsiveClass(element) { 70 var matches = element.className.match(/responsive-(\w+)/); //get a match to match the pattern some-class-somenumber and extract that classname 71 72 if (matches) { 73 return matches[1]; 74 } 75 76 return null; 77 } 78 79 function loadNavbars() { 80 loadDesktopNavbar().then(function() { 81 core.trigger('navbar.desktop.loaded'); 82 }); 83 84 loadMobileNavbar().then(function() { 85 core.trigger('navbar.mobile.loaded'); 86 }); 87 } 88 89 loadNavbars(); 90})();
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.