PageSourceSearch

https://shadyrays.com/cdn/shop/t/1063/assets/igot2-script.js?v=133255880481007904861790017059

js shadyrays.com collected 2026-09-25 02:35:30 UTC 6,247 bytes, 48 lines download raw bytes

1class IGOT2MarkdownHandler{constructor(){this.config={code:"IGOT2",markdownId:"discount-igot2",multiplier:.75,percent:"25%",collections:["shade-shop","green-wolf","kids-snow-goggles","kids-snow-goggle","capitan-fishing-elite","cayman-fishing-elite","youth-sport","kids-snow-goggle","kids-snow-goggles","readers"]},this.cookieName="igot2_offer_unlocked",this.hasInitialized=!1,this.elements={}}init(){if(!document.body.classList.contains("full-cart-b"))return;this.refreshSelectors();const initialQty=this.getEligibleQty();this.refresh();const refreshIGOT2=()=>{setTimeout(()=>{this.refresh(),setTimeout(()=>{MarkdownPricePro.run()},400)},800)};document.addEventListener("on:cart:change",refreshIGOT2),document.addEventListener("dispatch:cart-drawer:refresh",refreshIGOT2),document.addEventListener("on:cart:after-merge",refreshIGOT2),document.addEventListener("change",event=>{event.target.matches('input[name="updates[]"], input[name="quantity"], .quantity__input, [data-quantity-input]')&&refreshIGOT2()}),document.addEventListener("click",event=>{event.target.closest('.quantity__button, [data-quantity-button], button[name="plus"], button[name="minus"]')&&refreshIGOT2()})}refresh(){this.refreshSelectors();const qty=this.getEligibleQty(),discount=this.getDiscountToApply(),isCartPage=window.location.pathname==="/cart";if(!this.hasInitialized&&isCartPage&&qty===1&&this.setCookie(this.cookieName,"true"),this.hasInitialized=!0,qty===1){this.clearDiscount(),this.renderBanner(qty,discount);return}if(qty>=2){this.isOfferUnlocked()?(this.applyDiscount(discount),this.renderBanner(qty,discount)):(this.removeIGOT2Markdown(),this.clearDiscount(),this.hideBanner());return}this.setCookie(this.cookieName,"false"),this.clearDiscount(),this.hideBanner()}removeIGOT2Markdown(){const updatedMarkdowns=(Cookies.getJSON("markdown_object")||[]).filter(item=>item.markdown_id!==this.config.markdownId);Cookies.set("markdown_object",updatedMarkdowns,{expires:7,path:"/"}),["markdown_discount_code","discount_code","discount_code_applied"].forEach(cookie=>{Cookies.remove(cookie,{path:"/"}),document.cookie=`${cookie}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`})}refreshSelectors(){this.elements={eligibleItems:document.querySelectorAll('.cart-item[data-item-discount-eligible="true"]'),wrappers:document.querySelectorAll(".sr-igot2-cart-main-wrapper, .sr-igot2-cart-drawer-wrapper")}}getEligibleQty(){let totalQty=0;return this.elements.eligibleItems.forEach(item=>{const qtyInput=item.querySelector('input[name="updates[]"]')||item.querySelector('input[name="quantity"]')||item.querySelector(".quantity__input")||item.querySelector("[data-quantity-input]"),qty=Number(qtyInput?qtyInput.value||0:item.dataset.qty||1);totalQty+=qty}),totalQty}getCurrentCode(){return(Cookies.get("vu_cc")||Cookies.get("markdown_discount_code")||Cookies.get("discount_code")||"").toUpperCase()}getDiscountToApply(){const activeIgot2Markdown=(Cookies.getJSON("markdown_object")||[]).find(item=>item.markdown_id===this.config.markdownId);if(activeIgot2Markdown?.markdown_discount_code){const code=activeIgot2Markdown.markdown_discount_code.toUpperCase(),multiplier=Number(activeIgot2Markdown.markdown_multiplier);return{code,multiplier,percent:this.getPercentFromMultiplier(multiplier)}}const currentCode=this.getCurrentCode();return{AT20:{code:"IGOT2",multiplier:.75,percent:"25%"},AT25:{code:"GOT30",multiplier:.7,percent:"30%"},"30AT":{code:"GOT35",multiplier:.65,percent:"35%"},"30SPARK":{code:"GOT35",multiplier:.65,percent:"35%"},SPARK:{code:"GOT35",multiplier:.65,percent:"35%"}}[currentCode]||{code:this.config.code,multiplier:this.config.multiplier,percent:this.config.percent}}getPercentFromMultiplier(multiplier){return{.75:"25%",.7:"30%",.65:"35%",.6:"40%"}[multiplier]||"25%"}applyDiscount(discount){MarkdownPricePro.init({discount_code:discount.code,multiplier:discount.multiplier,collections:this.config.collections,id:this.config.markdownId}),window.autoApplyCouponCode(discount.code),MarkdownPricePro.run()}clearDiscount(){MarkdownPricePro.clear(this.config.markdownId),MarkdownPricePro.run()}
1renderBanner(qty,discount){this.elements.wrappers.forEach(wrapper=>{wrapper.classList.remove("hidden"),qty===1?wrapper.innerHTML=this.getOnePairHTML(discount.percent):wrapper.innerHTML=this.getTwoPairHTML(discount.code,discount.percent)})}hideBanner(){this.elements.wrappers.forEach(wrapper=>{wrapper.innerHTML="",wrapper.classList.add("hidden")})}getOnePairHTML(discountPercent="25%"){return`
2      <div class="sr-igot2-content">
3        <div class="sr-igot2-copy">
4          <h3>GRAB ONE MORE PAIR FOR</h3>
5
6          <div class="discount-pill">
7            ${discountPercent} OFF BOTH PAIRS!
8          </div>
9
10          <div class="shop-links">
11            <a href="/collections/men-all-styles">
12              Shop Men
13              ${this.getArrowSVG()}
14            </a>
15
16            <a href="/collections/women-all-styles">
17              Shop Women
18              ${this.getArrowSVG()}
19            </a>
20          </div>
21
22          <p class="upsell-note">
23            Offer cannot be combined with other coupons.
24          </p>
25        </div>
26      </div>
27    `}getTwoPairHTML(discountCode,discountPercent){return`
28      <div class="sr-igot2-content">
29        <div class="sr-igot2-copy">
30          <div class="discount-pill">
31            Deal met! Use code: ${discountCode}
32          </div>
33
34          <h3>
35            at checkout for ${discountPercent} off both pairs
36          </h3>
37
38          <p class="upsell-note">
39            Offer cannot be combined with other coupons.
40          </p>
41        </div>
42      </div>
43    `}getArrowSVG(){return`
44      <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
45        <path d="M4.5 2.5L8 6L4.5 9.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
46      </svg>
47    `}getCookie(name){const match=document.cookie.split("; ").find(row=>row.startsWith(name+"="));return match?match.split("=")[1]:null}setCookie(name,value){document.cookie=`${name}=${value}; path=/`}isOfferUnlocked(){return this.getCookie(this.cookieName)==="true"}}
48//# sourceMappingURL=/cdn/shop/t/1063/assets/igot2-script.js.map?v=133255880481007904861790017059

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.