Sha256: fd715c3183eb78b2b1112422a7998bc89ff5aeb34649de47047e82171e037bf0
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
var HashiVMware = function() { var selectedProduct = ""; var $buyButton = $('#buy-fusion'); var $products = $('#buy-now input[name=product]'); function setSelectedProduct() { selectedProduct = $("input[name=product]:checked").val(); } $products.unbind().on('change', function() { setSelectedProduct(); var text = selectedProduct.charAt(0).toUpperCase() + selectedProduct.slice(1); }); $buyButton.unbind().on('click', function(e) { e.preventDefault(); var seats = parseInt($("#seats").val(), 10); if (isNaN(seats)) { alert("The number of seats you want to purchase must be a number."); return; } else if (seats <= 0) { alert("The number of seats you want must be greater than zero."); return; } var productId = ""; if (selectedProduct == "desktop") { productId = "7255390650419"; } else { alert("Unknown product selected. Please refresh and try again."); return; } window.location = "http://shopify.hashicorp.com/cart/" + productId + ":" + seats; }); if ($buyButton.length > 0) { setSelectedProduct(); } } $(document).on('ready turbolinks:load', HashiVMware)
Version data entries
6 entries across 2 versions & 1 rubygems