1/** 2 * @plugin Auto Infinite Scroll 3 * @author Dave Hilditch 4 */ 5// We need to detect specifically when the back button is used 6// Using modern Navigation API with fallback to deprecated performance.navigation.type 7function isBackNavigation() { 8 if (performance.getEntriesByType && performance.getEntriesByType("navigation").length > 0) { 9 // Modern Navigation Timing API 10 return performance.getEntriesByType("navigation")[0].type === "back_forward"; 11 } else { 12 // Legacy fallback 13 return performance.navigation && performance.navigation.type === 2; 14 } 15} 16 17if (jQuery('body.archive.woocommerce').length > 0 && 18 localStorage.getItem("wpia_storedarchiveURL") == window.location.href && 19 isBackNavigation()) { 20 if (localStorage.getItem("wpi_savedpagination")) { 21 jQuery(ais_settings.wrapper_products).html(localStorage.getItem("wpi_savedproducts")); 22 jQuery(ais_settings.wrapper_pagination).html(localStorage.getItem("wpi_savedpagination")); 23 24 window.scroll(0, localStorage.getItem("scrollYarchive")); 25 } 26} else { 27 // We're either not on an archive page, or the URL doesn't match, or it's not a back button navigation 28 if (jQuery('body.archive.woocommerce').length > 0 || jQuery('body.shop.archive').length > 0) { 29 // Only clear the storage if we're not using back navigation 30 if (!isBackNavigation()) { 31 //reset the localstorage since we're either on a fresh archive or didn't use the back button 32 localStorage.setItem("wpia_storedarchiveURL", ""); 33 localStorage.setItem("wpi_savedproducts", ""); 34 localStorage.setItem("wpi_savedpagination", ""); 35 localStorage.setItem("scrollYarchive", 0); 36 } 37 } 38} 39 40var wpi_savedarchivehtml, wpi_saveddetailhtml; 41 42// Store page state when a product link is clicked 43jQuery(document).on('click', 'body.archive.woocommerce .product a', function (e) { 44 wpi_savedarchivehtml = jQuery(ais_settings.wrapper_products).html(); 45 localStorage.setItem("wpi_savedproducts", wpi_savedarchivehtml); 46 localStorage.setItem("wpia_storedarchiveURL", window.location.href); 47 localStorage.setItem("wpi_savedpagination", jQuery(ais_settings.wrapper_pagination).html()); 48 var doc = document.documentElement; 49 var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); 50 localStorage.setItem("scrollYarchive", top); 51});
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.