PageSourceSearch

https://www.diggingbits.com.au/cdn/shop/t/5/assets/jquery.cart.min.js?v=182204012852489870821498107666

js diggingbits.com.au collected 2026-10-08 09:37:01 UTC 6,289 bytes, 11 lines download raw bytes

1/**
2 * Module to add a shipping rates calculator to cart page.
3 *
4 * Copyright (c) 2011-2014 Caroline Schnapp (11heavens.com)
5 * Dual licensed under the MIT and GPL licenses:
6 * http://www.opensource.org/licenses/mit-license.php
7 * http://www.gnu.org/licenses/gpl.html
8 *
9 */
10
11if(typeof Countries==="object"){Countries.updateProvinceLabel=function(d,a){if(typeof d==="string"&&Countries[d]&&Countries[d].provinces){if(typeof a!=="object"){a=document.getElementById("address_province_label");if(a===null){return}}a.innerHTML=Countries[d].label;var c=jQuery(a).parent();var b=c.find("select");c.find(".custom-style-select-box-inner").html(Countries[d].provinces[0])}}}if(typeof Shopify.Cart==="undefined"){Shopify.Cart={}}Shopify.Cart.ShippingCalculator=(function(){var _config={submitButton:"Calculate shipping",submitButtonDisabled:"Calculating...",templateId:"shipping-calculator-response-template",wrapperId:"wrapper-response",customerIsLoggedIn:false,moneyFormat:"${{amount}}"};var _render=function(response){var template=jQuery("#"+_config.templateId);var wrapper=jQuery("#"+_config.wrapperId);if(template.length&&wrapper.length){var myTemplate=_.template(jQuery.trim(template.text()));var compiled=myTemplate(response);jQuery(compiled).appendTo(wrapper);if(typeof Currency!=="undefined"&&typeof Currency.convertAll==="function"){var newCurrency="";if(jQuery("[name=currencies]").size()){newCurrency=jQuery("[name=currencies]").val()}else{if(jQuery("#currencies span.selected").size()){newCurrency=jQuery("#currencies span.selected").attr("data-currency")}}if(newCurrency!==""){Currency.convertAll(shopCurrency,newCurrency,"#wrapper-response span.money, #estimated-shipping span.money")}}}};var _enableButtons=function(){jQuery(".get-rates").removeAttr("disabled").removeClass("disabled").val(_config.submitButton)};var _disableButtons=function(){jQuery(".get-rates").val(_config.submitButtonDisabled).attr("disabled","disabled").addClass("disabled")};var _getCartShippingRatesForDestination=function(shippingAddress){var params={type:"POST",url:"/cart/prepare_shipping_rates",data:jQuery.param({shipping_address:shippingAddress}),success:_pollForCartShippingRatesForDestination(shippingAddress),error:_onError};jQuery.ajax(params)};var _pollForCartShippingRatesForDestination=function(shippingAddress){var poller=function(){jQuery.ajax("/cart/async_shipping_rates",{dataType:"json",success:function(response,textStatus,xhr){if(xhr.status===200){_onCartShippingRatesUpdate(response.shipping_rates,shippingAddress)}else{setTimeout(poller,500)}},error:_onError})};return poller};var _fullMessagesFromErrors=function(errors){var fullMessages=[];jQuery.each(errors,function(attribute,messages){jQuery.each(messages,function(index,message){fullMessages.push(attribute+" "+message)})});return fullMessages};var _onError=function(XMLHttpRequest,textStatus){jQuery("#estimated-shipping").hide();jQuery("#estimated-shipping em").empty();_enableButtons();var feedback="";var data=eval("("+XMLHttpRequest.responseText+")");if(!!data.message){feedback=data.message+"("+data.status+"): "+data.description}else{feedback="Error : "+_fullMessagesFromErrors(data).join("; ")+"."}if(feedback==="Error : country is not supported."){feedback="We do not ship to this destination."}_render({rates:[],errorFeedback:feedback,success:false});jQuery("#"+_config.wrapperId).show()};var _onCartShippingRatesUpdate=function(rates,shipping_address){_enableButtons();var readable_address="";if(shipping_address.zip){readable_address+=shipping_address.zip+", "}if(shipping_address.province){readable_address+=shipping_address.province+", "}readable_address+=shipping_address.country;if(rates.length){if(rates[0].price=="0.00"){jQuery("#estimated-shipping em").html("FREE")}else{jQuery("#estimated-shipping em").html(_formatRate(rates[0].price))}for(var i=0;i<rates.length;i++){rates[i].price=_formatRate(rates[i].price)}}_render({rates:rates,address:readable_address,success:true});jQuery("#"+_config.wrapperId+", #estimated-shipping").fadeIn()};var _formatRate=function(cents){if(typeof Shopify.formatMoney==="function"){return Shopify.formatMoney(cents,_config.moneyFormat)}if(typeof cents=="string"){cents=cents.replace(".","")}var value="";var placeholderRegex=/\{\{\s*(\w+)\s*\}\}/;var formatString=_config.moneyFormat;function defaultOption(opt,def){return(typeof opt=="undefined"?def:opt)}function formatWithDelimiters(number,precision,thousands,decimal){precision=defaultOption(precision,2);thousands=defaultOption(thousands,",");decimal=defaultOption(decimal,".");if(isNaN(number)||number==null){return 0}number=(number/100).toFixed(precision);var parts=number.split("."),dollars=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),cents=parts[
111]?(decimal+parts[1]):"";return dollars+cents}switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break}return formatString.replace(placeholderRegex,value)};_init=function(){new Shopify.CountryProvinceSelector("address_country","address_province",{hideElement:"address_province_container"});var countriesSelect=jQuery("#address_country");var addressProvinceLabelEl=jQuery("#address_province_label").get(0);if(typeof Countries!=="undefined"){Countries.updateProvinceLabel(countriesSelect.val(),addressProvinceLabelEl);countriesSelect.change(function(){Countries.updateProvinceLabel(countriesSelect.val(),addressProvinceLabelEl)})}jQuery(".get-rates").click(function(){_disableButtons();jQuery("#"+_config.wrapperId).empty().hide();var shippingAddress={};shippingAddress.zip=jQuery("#address_zip").val()||"";shippingAddress.country=jQuery("#address_country").val()||"";shippingAddress.province=jQuery("#address_province").val()||"";_getCartShippingRatesForDestination(shippingAddress)});if(_config.customerIsLoggedIn){jQuery(".get-rates:eq(0)").trigger("click")}};return{show:function(params){params=params||{};jQuery.extend(_config,params);jQuery(function(){_init()})},getConfig:function(){return _config},formatRate:function(cents){return _formatRate(cents)}}})();

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.