1(function($){"use strict";function getTotalQuantity(items){return items.reduce((total,item)=>total+item.quantity,0)} 2function updateMenuQuoteBadge(count){const $myQuote=$("#my-quote");if($myQuote.length){let $badge=$myQuote.find(".quote-count");if($badge.length){$badge.text(count)}else{$myQuote.append(`<span class="quote-count">${count}</span>`)}} 3const $myQuoteMobile=$("#my-quote-mobile");if($myQuoteMobile.length){let $badgeMobile=$myQuoteMobile.find(".quote-count-mobile");if($badgeMobile.length){$badgeMobile.text(count)}else{$myQuoteMobile.append(`<span class="quote-count-mobile">${count}</span>`)}}} 4function loadQuoteCounter(){if(!window.QuoteStorage){return} 5const items=window.QuoteStorage.getItems();const totalQuantity=getTotalQuantity(items);updateMenuQuoteBadge(totalQuantity)} 6function listenToStorageChanges(){window.addEventListener("storage",function(e){if(e.key==="aratice_quote"){loadQuoteCounter()}})} 7function listenToQuoteEvents(){$(document).on("aratice:product_added_to_quote",function(e,productId){setTimeout(loadQuoteCounter,100)});$(document).on("aratice:product_removed_from_quote",function(e,productId){setTimeout(loadQuoteCounter,100)});$(document).on("aratice:quote_updated",function(){setTimeout(loadQuoteCounter,100)})} 8function init(){loadQuoteCounter();listenToStorageChanges();listenToQuoteEvents();setInterval(function(){if(document.hidden){return} 9const $myQuote=$("#my-quote");const $myQuoteMobile=$("#my-quote-mobile");if($myQuote.length||$myQuoteMobile.length){const items=window.QuoteStorage?window.QuoteStorage.getItems():[];const totalQuantity=getTotalQuantity(items);const currentBadgeValue=parseInt($myQuote.find(".quote-count").text()||$myQuoteMobile.find(".quote-count-mobile").text()||"0");if(currentBadgeValue!==totalQuantity){updateMenuQuoteBadge(totalQuantity)}}},5000)} 10$(document).ready(function(){if(window.QuoteStorage){init()}else{setTimeout(function(){if(window.QuoteStorage){init()}},500)}})})(jQuery)
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.