1/*=================================== 2= Item page 15 = 3===================================*/ 4 5// is this still a thing??? 6$(function () { 7 // Attach click event handler to toggle truncate class 8 $(document).on('click', '.item-page-15 .content-slider__sku', function () { 9 $(this).removeClass('truncate'); 10 11 // Re-check for SKU truncation after toggle 12 checkForSkuTruncation(); 13 }); 14}); 15 16/* Initialize Images Swipers */ 17$(function () { 18 const isMobile = window.matchMedia('(max-width: 767.98px)').matches; 19 let thumbSwiper = (!isMobile && imageSectionHasMultipleImages) ? new Swiper('.iplv15-images .gallery-thumbs', { 20 slidesPerView: 'auto', 21 spaceBetween: 10, 22 slideToClickedSlide: true, 23 watchSlidesProgress: true, 24 watchSlidesVisibility: true 25 }) : undefined; 26 27 let imagesSwiper = new Swiper('.iplv15-images .gallery-slider', { 28 zoom: false, 29 slidesPerView: 1, 30 preloadImages: false, 31 threshold: 10, 32 // Conditionally add navigation, pagination, and thumbs options if applicable 33 ...(imageSectionHasMultipleImages ? { 34 navigation: { 35 nextEl: '.swiper-button-next', 36 prevEl: '.swiper-button-prev', 37 }, 38 pagination: { 39 el: '.swiper-pagination', 40 clickable: true, 41 }, 42 ...(thumbSwiper ? { thumbs: { swiper: thumbSwiper } } : {}) 43 } : {}) 44 }); 45 46 if (imagesSwiper && thumbSwiper) { 47 // Add listener to update thumbnail position on slide change (both when image swiper changes 48 // via arrow click or when thumbnail is clicked) 49 imagesSwiper.on('slideChange', () => { 50 let activeIndex = imagesSwiper.activeIndex; 51 let thumbnailSlide = thumbSwiper.slides[activeIndex]; 52 let thumbnailsContainer = thumbSwiper.el; // Get thumbnail swiper container 53 54 // Calculate total width of all thumbnail slides (including whitespace, thumbSwiper.params.spaceBetween) 55 let totalThumbnailsWidth = Array.from(thumbSwiper.slides).reduce((total, slide) => { 56 return total + slide.clientWidth + thumbSwiper.params.spaceBetween; 57 }, 0); 58 59 // Only apply offsetting behavior if there are hidden thumbnails (total width exceeds container width) 60 if (totalThumbnailsWidth > thumbnailsContainer.clientWidth && thumbnailSlide) { 61 // Calculate offset to make active thumbnail second from left, if possible 62 let offset = activeIndex > 0 ? thumbSwiper.slides[activeIndex - 1].offsetLeft : thumbnailSlide.offsetLeft; 63 64 // Apply offset to make active thumbnail appear second from left 65 thumbSwiper.setTranslate(-offset); 66 } 67 }); 68 } 69 70 let offsetTop = $("#topInfo").offset().top; 71 let isElementVisible = false; 72 73 $(window).scroll(function () { 74 // Get current scroll position from top 75 var scrollTop = window.pageYOffset || document.documentElement.scrollTop; 76 77 // Get maximum scroll height 78 var scrollHeight = Math.max( 79 document.body.scrollHeight, document.documentElement.scrollHeight, 80 document.body.offsetHeight, document.documentElement.offsetHeight, 81 document.body.clientHeight, document.documentElement.clientHeight 82 ); 83 84 // Calculate distance from bottom 85 var scrollBottom = scrollHeight - scrollTop - window.innerHeight; 86 87 if (scrollTop > offsetTop && scrollBottom >= 300 && !isElementVisible) { 88 $(".__item-page-card").removeClass('slideOutDown').addClass('slideInUp').show(); 89 isElementVisible = true; 90 } 91 else if ((scrollTop <= offsetTop || scrollBottom < 300) && isElementVisible) { 92 $(".__item-page-card").removeClass('slideInUp').addClass('slideOutDown'); 93 isElementVisible = false; 94 } 95 });
96}); 97 98function ProductSelectedOptionsLoaded() { 99 $('#product-select-options-loading').remove(); 100 101 const selectedOptions = document.getElementById("product-select-options"); 102 103 if (!selectedOptions || selectedOptions.childElementCount === 0) { 104 $('#product-select-options-section').remove(); 105 } 106} 107 108function ProductAvailabilityByLocationLoaded() { 109 $('#productavailabilitybylocationloading').remove(); 110} 111 112 113/* View in 3D / AR functions */ 114function check3DAssetContent() { 115 const modalBody = $("#item3DAssetViewerModal .modal-body"); 116 117 // Check if modal body has content (ignoring whitespace) 118 if (modalBody.html().trim().length > 0) { 119 // Show 3D model button 120 $(".btn-3D-model").removeClass("d-none").addClass("d-flex"); 121 } else if (modalBody.html().trim().length <= 0 && has3dModelUrl) { 122 // Fall back to Ashley model buttons/modals 123 useAshley3DButtons(); 124 } 125} 126 127function checkArAssetContentMobile(url) { 128 if (url) { 129 // Hide desktop AR button 130 /*$('#view-in-ar-desktop').addClass('d-none').removeClass('d-flex');*/ 131 132 // Add URL to href 133 $("#view-in-ar-hidden-btn").attr("href", url); 134 $("#view-in-ar").removeClass("d-none").addClass("d-flex"); 135 136 $("#view-in-ar").on('click', function () { 137 document.getElementById('view-in-ar-hidden-btn').click(); 138 }); 139 140 // Show AR button 141 $(".btn-ar").removeClass("d-none").addClass("d-flex"); 142 } 143} 144 145function checkArAssetContent() { 146 const modalBody = $("#marxentArAssetViewerModal .modal-body"); 147 148 // Check if modal body has content (ignoring whitespace) 149 if (modalBody.html().trim().length > 0) { 150 // Show AR button 151 $(".btn-ar").removeClass("d-none").addClass("d-flex"); 152 } else if (modalBody.html().trim().length <= 0 && has3dModelUrl) { 153 // Fall back to Ashley model buttons/modals 154 useAshleyARButtons(); 155 } 156} 157 158function check360AssetContent() { 159 const modalBody = $("#item360AssetViewerModal .modal-body"); 160 161 // Check if modal body has content (ignoring whitespace) 162 if (modalBody.html().trim().length > 0) { 163 // Show 360 model button 164 $(".btn-360-model").removeClass("d-none").addClass("d-flex"); 165 } 166} 167 168// Function to check if SKU is truncated 169function isTruncated(element) { 170 return element.scrollWidth > element.clientWidth; 171} 172 173function handleItemListLoaded(element) { 174 175 if (element && typeof (element) === 'object') { 176 177 var container = element.classList.contains('product-list') 178 ? element 179 : element.querySelector('.product-list'); 180 181 if (container && typeof (container) != 'undefined') 182 watchItemList(container); 183 184 checkForSkuTruncation(); 185 } 186 187} 188 189// Function to check each SKU for truncation 190function checkForSkuTruncation() { 191 $('.item-page-15 .content-slider__sku').each(function () { 192 var $this = $(this); 193 194 if (isTruncated(this)) { 195 $this.attr('title', 'Click to show more'); 196 $this.addClass('has-tooltip'); 197 } else { 198 $this.removeAttr('title'); 199 $this.removeClass('has-tooltip'); 200 } 201 }); 202} 203 204// Hide image page card when 3D/360 asset viewer modal is showing 205$('#item360AssetViewerModal').on('show.bs.modal', function (e) { 206 $('.__item-page-card').addClass('d-none'); 207}); 208 209$('#item360AssetViewerModal').on('hidden.bs.modal', function (e) { 210 $('.__item-page-card').removeClass('slideOutDown').removeClass('d-none'); 211}); 212 213$('#marxentArAssetViewerModal').on('show.bs.modal', function (e) { 214 $('.__item-page-card').addClass('d-none'); 215}); 216 217$('#marxentArAssetViewerModal').on('hidden.bs.modal', function (e) { 218 $('.__item-page-card').removeClass('slideOutDown').removeClass('d-none'); 219}); 220 221$('#item3DAssetViewerModal').on('show.bs.modal', function (e) { 222 $('.__item-page-card').addClass('d-none'); 223}); 224 225$('#item3DAssetViewerModal').on('hidden.bs.modal', function (e) { 226 $('.__item-page-card').removeClass('slideOutDown').removeClass('d-none'); 227}); 228 229 230// misc functions / events (not sure what here is real anymore or not) 231$(function () { 232 // Set offset for pricing section based on height of top sticky section 233 if ($('.hlvk').length > 0) { 234 $('#pricing').css('top', $('.hlvk').outerHeight() + $('#topInfo').outerHeight() - 1 + 'px'); 235 } else { 236 $('#pricing').css('top', $('#topInfo').outerHeight() - 1 + 'px'); 237 } 238 239 const fabricSectionHtml = $('#fabricSection').html() || ""; 240 241 if (fabricSectionHtml.trim().length === 0) { 242 $('#fabricSection').removeClass('my-3 border-top border-bottom'); 243 } 244 245 // Mattress sizes 246 $('.iplv14-mattress-sizes select, select#FoundationSelectedValue').change(function () { 247 248 var url = $(this).val(); 249 var values = $(this).val().split('|'); 250 var ItemId = values[0]; 251 var ItemNum = encodeURIComponent(values[1]); 252 253 window.location.href = itemPageUrl; 254 });
255 256 $('.iplv15-bed-frames select').on('change', function () { 257 258 var url = $(this).val(); 259 var values = $(this).val().split('|'); 260 var ItemId = values[0]; 261 var ItemNum = encodeURIComponent(values[1]); 262 263 window.location.href = Utils.baseUrl + "item.aspx?itemid=" + ItemId + "&itemnum=" + ItemNum; 264 265 }); 266}); 267 268// initialize glightbox (zoom for images) 269function waitForGLightbox() { 270 if (typeof GLightbox !== 'undefined') { 271 GLightbox(); 272 } else { 273 setTimeout(waitForGLightbox, 50); 274 } 275} 276 277waitForGLightbox();
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.