1var _RecentlyViewItem = /** @class */ (function () { 2 function _RecentlyViewItem() { 3 } 4 _RecentlyViewItem.prototype.PageScripts = function () { 5 _RecentlyViewItem.prototype.OnLoadScripts(); 6 }; 7 _RecentlyViewItem.prototype.OnLoadScripts = function () { 8 if ($("._RecentlyViewItem").length > 0) { 9 var isInitCalled = false; 10 var hasScrollBar = document.body.scrollHeight > window.innerHeight; 11 var viewpoint = 175; // The desired viewpoint in pixels 12 // Calculate the current scroll position 13 if (hasScrollBar) { 14 if (_RecentlyViewItem.prototype.isElementInView() && !isInitCalled) { 15 _RecentlyViewItem.prototype.GetRecentlyViewProduct(); 16 isInitCalled = true; 17 } 18 else { 19 $(window).scroll(function () { 20 var scrollPosition = window.pageYOffset || document.documentElement.scrollTop; 21 if (scrollPosition >= viewpoint && !isInitCalled) { 22 _RecentlyViewItem.prototype.GetRecentlyViewProduct(); 23 isInitCalled = true; 24 } 25 }); 26 } 27 } 28 else if (!hasScrollBar && _RecentlyViewItem.prototype.isElementInView() && !isInitCalled) { 29 _RecentlyViewItem.prototype.GetRecentlyViewProduct(); 30 isInitCalled = true; 31 } 32 } 33 }; 34 _RecentlyViewItem.prototype.isElementInView = function () { 35 var recentlyViewedElement = document.getElementById('recent-view-products'); 36 if (!recentlyViewedElement) 37 return false; 38 var rect = recentlyViewedElement.getBoundingClientRect(); 39 var windowHeight = window.innerHeight || document.documentElement.clientHeight; 40 // Check if the recently viewed element is visible in the viewport 41 return rect.top <= windowHeight; 42 }; 43 _RecentlyViewItem.prototype.GetRecentlyViewProduct = function () { 44 var ProductId = $("div[id='layout-product']").attr("data-id"); 45 CustomProduct.prototype.GetRecentlyViewProducts(ProductId); 46 }; 47 return _RecentlyViewItem; 48}()); 49$(document).ready(function () { 50 _RecentlyViewItem.prototype.PageScripts(); 51 var notification = new ZnodeNotification(); 52 notification.DisplayNotificationMessages(); 53}); 54//# sourceMappingURL=_RecentlyViewItem.js.map
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.