PageSourceSearch

https://international.gpbatteries.com/cdn/shop/t/30/assets/mini-cart.js?v=145842941042101816151709088918

js gpbatteries.com collected 2026-09-24 18:30:17 UTC 10,326 bytes, 2 lines download raw bytes

1window.gred=window.gred||{},gred.init=function(){gred.updateP(),gred.showPopup(),gred.hidePopup(),gred.btnAddtocart(),gred.removeItemsInMiniCart(),gred.quantity(),gred.btnAddtoCartBundle(),gred.urlAddtoCartBundle(),gred.showFreeShipping()},jQuery(document).ready(function(){"use strict";$(".x-offcanvas").on("click",function(e){return e.preventDefault(),$(".backdrop").toggleClass("active"),$(".offcanvas-cart").toggleClass("active"),$("body").toggleClass("ov-h"),setTimeout(function(){$(".Drawer--right").toggleClass("active")},500),!1}),$(".header-cart-link.header-cart-link").on("click",function(e){return e.preventDefault(),$(".Drawer--right").addClass("active"),$(".offcanvas-cart").addClass("active"),$(".backdrop").addClass("active"),$("body").addClass("ov-h"),!1}),$(".backdrop").on("click",function(e){return e.preventDefault(),$(".backdrop").toggleClass("active"),$(".offcanvas-cart").toggleClass("active"),$("body").toggleClass("ov-h"),setTimeout(function(){$(".Drawer--right").toggleClass("active")},500),!1})}),gred.removeItemsInMiniCart=function(){$(".btn-remove").on("click",function(event){event.preventDefault();var productId=$(this).closest(".item").attr("id"),item=$(this).closest(".item");return $(this).closest(".item").fadeOut("slow"),productId=productId.match(/\d+/g),Shopify.removeItem(productId,function(cart){gred.updateMinicart(cart)}),!1})},gred.showPopup=function(selector){$(selector).addClass("active")},gred.hidePopup=function(selector){$(selector).removeClass("active")},gred.quantity=function(){$(".x-qty").click(function(e){var currentVal=$(this).parent().find(".xx-qty").html();currentVal=parseInt(currentVal);var fieldName=$(this).attr("data-v");fieldName=="minus"?currentVal=currentVal-1:currentVal=currentVal+1,currentVal>=0&&$(this).parent().find(".xx-qty").html(currentVal),currentVal==0&&($(this).closest(".cart__row").fadeOut(300,function(){$(this).remove()}),$(this).closest("li.item").fadeOut(300,function(){$(this).remove()}));var quantity=currentVal,variant_id=$(this).parent().find(".xx-qty").attr("data-vid");gred.updateP2(quantity,variant_id)})},gred.updateP=function(){$(".cart__qty .cart__qty-input").on("change",function(){var quantity=$(this).val(),variant_id=$(this).attr("data-vid");gred.doAjaxUpdateQty(variant_id,quantity);var new_val=$(this).val();new_val==0&&($(this).closest(".cart__row").fadeOut(300,function(){$(this).remove()}),$(this).closest("li.item").fadeOut(300,function(){$(this).remove()}))})},gred.updateP2=function(quantity,variant_id){gred.doAjaxUpdateQty(variant_id,quantity)},gred.convertToSlug=function(text){return text.toLowerCase().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},gred.btnAddtocart=function(){$("body").on("click",".add-to-cart input.add-to-cart-button, .add-to-cart button.add-to-cart-button",function(event){if($(this).attr("disabled")!="disabled"){var productOpt=$(this).parents(".cl-product-action"),variant_id=$(productOpt).find(".product-options .js-required .single-option-selector option:selected").attr("data-variant");variant_id||(variant_id=$(productOpt).find('input[name="id"]').val()),$(".product-wrap .product-details").length>0&&(variant_id=$(productOpt).find('.product-select[name="id"] option:selected').val(),variant_id||(variant_id=$(productOpt).find('input[name="id"]').val()));var quantity=$(productOpt).find(".quantity").val();quantity||(quantity=1),gred.doAjaxAddToCart(variant_id,quantity)}return event.preventDefault(),!1})},gred.doAjaxAddToCart=function(variant_id,quantity){$.ajax({type:"post",url:"/cart/add.js",data:"quantity="+quantity+"&id="+variant_id,dataType:"json",beforeSend:function(){},success:function(msg){$(".error-message").text(""),$(".Drawer--right").addClass("active"),$(".offcanvas-cart").addClass("active"),$(".backdrop").addClass("active"),$("body").addClass("ov-h"),gred.updateMinicart()},error:function(xhr,text){$(".error-message").text($.parseJSON(xhr.responseText).description),setTimeout(function(){$(".error-message").text("")},8e3),$(".Drawer--right").addClass("active"),$(".offcanvas-cart").addClass("active"),$(".backdrop").addClass("active"),$("body").addClass("ov-h")}})},gred.doAjaxUpdateQty=function(variant_id,quantity){$.ajax({type:"post",url:"/cart/change.js",data:"quantity="+quantity+"&id="+variant_id,dataType:"json",beforeSend:function(){},success:function(msg){gred.updateMinicart(),gred.updatePrice()},error:function(xhr,text){$(".error-message").text($.parseJSON(xhr.responseText).description)}})},gred.updatePrice=function(){Shopify.getCart(function(cart){gred.doUpdatePrice(cart)})},gred.doUpdatePrice=function(cart){for(var i=0;i<cart.items.length;i++){var t_price=cart.items[i].line_price,v_id=cart.items[i].variant_id;$(".total-price.i-"+v_id).html(Shopify.formatMoney(cart.items[i].line_price,window.money_format)),$(".total-price2.i-"+v_id).html(Shopify.formatMoney(cart.items[i].line_price,window.money_format))}},gred.updateMinicart=function(){Shopify.getCart(function(cart){gred.doUpdateMinicart(cart)})},gred.doUpdateMinicart=function(cart){var total=Shopify.formatMoney(cart.total_price,window.money_format),item_count=cart.item_count;$(".cart__subtotal #bk-cart-subtotal-price").html(total),$(".offcanvas-cart .total .cart-total").html(total);var total=total.replace("$","");$(".header-cart-link .header-cart-count").html(item_count),$(".header-cart-link .header-cart-count").addClass("active"),item_count<1?($(".offcanvas-cart .summary").addClass("hide"),$(".offcanvas-cart .c-title .count").html("(<span>"+item_count+"</span> Product)")):($(".offcanvas-cart .summary").removeClass("hide"),$(".offcanvas-cart .c-title .count").html("(<span>"+item_count+"</span> Products)"));var template='<li class="item clearfix" id="cart-item-{id}"><a href="javascript:void(0)" title="" class="btn-remove">{close}</a><a href="{url}" class="product-image"><img src="{img}" alt=""></a><div class="product-details"><a class="product-name" href="{url}">{title}</a><div class="product-meta"><span>{meta}</span></div><div class="cart__qty clearfix"><span class="money hide">{price}</span><span class="x-qty xx-qtyminus hide" data-v="minus">-</span><div class="qty__box"><span class="label">{quantitytext}</span><span class="xx-qty" data-vid="{v_id}">{quantity}</span></div><span class="x-qty xx-qtyplus hide" data-v="plus">+</span><div class="total-price2 i-{v_id}">{price2}</div></div></div></li>',total=Shopify.formatMoney(cart.total_price,window.money_format),item_count=cart.item_count,closeHTML=$(".x-offcanvas").html();if($(".header-cart-link .header-cart-count").html(item_count),$(".header-cart-link .header-cart-count").addClass("active"),item_count<1?($(".offcanvas-cart .summary").addClass("hide"),$(".offcanvas-cart .c-title .count").html("(<span>"+item_count+"</span> Product)")):($(".offcanvas-cart .summary").removeClass("hide"),$(".offcanvas-cart .c-title .count").html("(<span>"+item_count+"</span> Products)")),$(".miniCart-list").html(""),cart.item_count>0){for(var i=0;i<cart.items.length;i++){var item=template,show_price=cart.items[i].line_price>0;$.trim(cart.items[i].variant_title)!=""?item=item.replace(/\{meta\}/g,cart.items[i].variant_title):item=item.replace(/\{meta\}
1/g," "),item=item.replace(/\{close\}/g,closeHTML),item=item.replace(/\{id\}/g,cart.items[i].id),item=item.replace(/\{url\}/g,cart.items[i].url),item=item.replace(/\{img\}/g,Shopify.resizeImage(cart.items[i].image,"85x")),item=item.replace(/\{title\}/g,cart.items[i].product_title),item=item.replace(/\{price\}/g,show_price?Shopify.formatMoney(cart.items[i].price,window.money_format):"");var quantityText="Quantity:";item=item.replace(/\{quantitytext\}/g,show_price?quantityText:""),item=item.replace(/\{quantity\}/g,show_price?cart.items[i].quantity:""),item=item.replace(/\{v_id\}/g,cart.items[i].variant_id),item=item.replace(/\{price2\}/g,show_price?Shopify.formatMoney(cart.items[i].line_price,window.money_format):""),$(".miniCart-list").append(item)}gred.removeItemsInMiniCart()}gred.showFreeShipping()},gred.showFreeShipping=function(){$.get(window.location.pathname+"?section_id=dynamic-free-shipping",function(res){$(".offcanvas-cart #shopify-section-dynamic-free-shipping").remove(),$(res).insertAfter(".offcanvas-cart .c-title")})},gred.btnAddtoCartBundle=function(){$(".add-to-cart-bundle").click(function(event){var arr_res=[],data_products=[],products=$(this).parents(".page-offer-bundle-product").find(".product-list-item");products.each(function(){var product_id=$(this).data("product-id"),variant_id=$(this).data("variant-id");data_products.push({quantity:1,id:variant_id})}),$.ajax({type:"post",url:"/cart/add.js",data:{items:data_products},dataType:"json",success:function(data,text,xhr){$(".error-message").text(""),$(".Drawer--right").addClass("active"),$(".offcanvas-cart").addClass("active"),$(".backdrop").addClass("active"),$("body").addClass("ov-h"),gred.updateMinicart()},error:function(xhr,text,err){$(".error-message").text($.parseJSON(xhr.responseText).description),setTimeout(function(){$(".error-message").text("")},8e3),$(".Drawer--right").addClass("active"),$(".offcanvas-cart").addClass("active"),$(".backdrop").addClass("active"),$("body").addClass("ov-h")}})})},gred.urlAddtoCartBundle=function(){var data_products=[],params=general.getUrlVars(),products=params.bundle||"";if(products=="")return!1;products=products.split(","),$.each(products,function(i,datas){var data=datas.split(":"),variant_id=data[0],quantity=data[1]||1;data_products.push({quantity:quantity,id:variant_id})}),data_products.length>0&&$.ajax({type:"post",url:"/cart/add.js",data:{items:data_products},dataType:"json",success:function(data,text,xhr){$(".error-message").text(""),$(".Drawer--right").addClass("active"),$(".offcanvas-cart").addClass("active"),$(".backdrop").addClass("active"),$("body").addClass("ov-h"),gred.updateMinicart()},error:function(xhr,text,err){$(".error-message").text($.parseJSON(xhr.responseText).description),setTimeout(function(){$(".error-message").text("")},8e3),$(".Drawer--right").addClass("active"),$(".offcanvas-cart").addClass("active"),$(".backdrop").addClass("active"),$("body").addClass("ov-h")},complete:function(xhr,text,err){history.replaceState({},document.title,location.origin)}})},jQuery(gred.init);
2//# sourceMappingURL=/cdn/shop/t/30/assets/mini-cart.js.map?v=145842941042101816151709088918

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.