1if (!funcDefined('showItems')) { 2 showItems = function ($viewedSlider, cookieItems, config) { 3 config = typeof config === 'object' && config ? config : {}; 4 config.SHOW_MEASURE = config.SHOW_MEASURE !== 'N' ? 'Y' : 'N'; 5 config.SHOW_BONUS = config.SHOW_BONUS !== 'Y' ? 'N' : 'Y'; 6 7 if ($viewedSlider.length) { 8 try { 9 let storageItems = cookieItems; 10 11 // This is a copy of function from that shows recent items 12 // For puprose of showing items from same category the function is disabled, otherwise it will not show the items on page 13 // remove some old item 14/* storageItems.forEach((item) => { 15 if (productId && typeof storageItems[productId] == 'undefined') { 16 $viewedSlider 17 .find('.catalog-viewed__item-wrap[data-id=' + productId + ']') 18 .closest('.catalog-viewed__item') 19 .remove(); 20 } 21 }); */ 22 23 storageItems.forEach((storageItem) => { 24 let productId = storageItem.PRODUCT_ID; 25 var $item = $viewedSlider.find('.catalog-viewed__item-wrap[data-id=' + productId + ']'); 26 27 if ($item.length) { 28 let picture = { 29 ID: false, 30 SRC: arAsproOptions.SITE_TEMPLATE_PATH + '/images/svg/noimage_product.svg', 31 ALT: storageItem.NAME, 32 TITLE: storageItem.NAME, 33 }; 34 35 if (typeof $item.attr('data-picture') !== 'undefined') { 36 picture = JSON.parse($item.attr('data-picture')); 37 } 38 39 let bSaleMode = arAsproOptions.MODULES.sale; 40 let isOffer = storageItem.IS_OFFER == 'Y'; 41 let bWithOffers = storageItem.WITH_OFFERS == 'Y'; 42 let bShowMeasure = config.SHOW_MEASURE == 'Y' && !bWithOffers && storageItem.CATALOG_MEASURE_NAME.length; 43 let bHasPrice = 44 typeof storageItem.PRICES === 'object' && 45 storageItem.PRICES && 46 (storageItem.PRICES.PRICE > 0 || (!bSaleMode && storageItem.PRICES.PRICE.length)); 47 let bHasEconomy = 48 typeof storageItem.PRICES === 'object' && 49 storageItem.PRICES && 50 (storageItem.PRICES.ECONOMY > 0 || (!bSaleMode && storageItem.PRICES.ECONOMY.length)); 51 52 let priceHtml = ''; 53 if (bHasPrice) { 54 let pricePrint = 55 typeof storageItem.PRICES.PRICE_PRINT !== 'undefined' ? storageItem.PRICES.PRICE_PRINT : storageItem.PRICES.PRICE; 56 priceHtml = 57 '<div class="price__new"><span class="price__new-val font_15">' + 58 (bWithOffers && bSaleMode ? BX.message('CATALOG_FROM_VIEWED') + ' ' : '') + 59 pricePrint.replace(BX.message('CATALOG_FROM_VIEWED'), '').trim() + 60 (bShowMeasure ? '/' + storageItem.CATALOG_MEASURE_NAME : '') + 61 '</span></div>'; 62 } 63 priceHtml = '<div class="price color_222">' + priceHtml + '</div>'; 64 65 let stickersHtml = ''; 66 let economyHtml = ''; 67 if (bHasEconomy) { 68 let economyPrint = 69 typeof storageItem.PRICES.ECONOMY_PRINT !== 'undefined' ? storageItem.PRICES.ECONOMY_PRINT : storageItem.PRICES.ECONOMY; 70 economyHtml = 71 '<div class="catalog-viewed__item-sticker-value rounded-x sticker__item sticker__item--sale">' + economyPrint + '</div>'; 72 } 73 74 let bonusHtml = ''; 75 // if (config.SHOW_BONUS == 'Y') { 76 // bonusHtml = '<div class="bonus-system-block lb_bonus lb_bonus_viewed lb_ajax_' + storageItem.productId + '" data-item="' + storageItem.productId + '"></div>'; 77 // } 78 79 if (economyHtml || bonusHtml) { 80 stickersHtml = '<div class="catalog-viewed__item-sticker">' + economyHtml + bonusHtml + '</div>'; 81 } 82 83 $item.html( 84 '<div class="catalog-viewed__item__inner flexbox flexbox--column">' + 85 '<div class="catalog-viewed__item__image__wrap">' + 86 '<div class="catalog-viewed__item__image">' + 87 '<a href="' + 88 storageItem.DETAIL_PAGE_URL + 89 '" class="thumb">' + 90 '<img border="0" src="' + 91 picture.SRC + 92 '" alt="' + 93 (picture.ALT.length ? picture.ALT : storageItem.NAME) + 94 '" title="' + 95 (picture.TITLE.length ? picture.TITLE : storageItem.NAME) + 96 '" />' + 97 '</a>' + 98 '</div>' +
99 stickersHtml + 100 '</div>' + 101 '<div class="catalog-viewed__item__info item_info">' + 102 priceHtml + 103 '<div class="catalog-viewed__item__title font_14 linecamp-2">' + 104 '<a class="dark_link switcher-title color-theme-target" href="' + 105 storageItem.DETAIL_PAGE_URL + 106 '"><span>' + 107 storageItem.NAME + 108 '</span></a>' + 109 '</div>' + 110 '</div>' + 111 '</div>' 112 ); 113 } else { 114 // item not finded 115 } 116 }); 117 118 if (!$viewedSlider.find('.catalog-viewed__item').length) { 119 $viewedSlider.closest('.catalog-viewed-list').remove(); 120 } 121 } catch (e) { 122 console.error(e); 123 } 124 } 125 }; 126}
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.