// calculator-input $(document).ready(function() { $('.btn-minus').click(function () { var $input = $(this).parent().find('input'); var count = parseInt($input.val()) - 1; count = count < 1 ? 1 : count; $input.val(count); $input.change(); return false; }); $('.btn-plus').click(function () { var $input = $(this).parent().find('input'); $input.val(parseInt($input.val()) + 1); $input.change(); return false; }); }); // left-block-data var data = { cores : 4, ram : 4, storage:512, transfer:8 }; var toggle= false; var totalCost = {}; // total-cost-and-savings for (let i = 0; i < 100 ; i++) { let value = i+1; totalCost[value] = { total : { monthly : value* 1000, yearly : value*12000}, serversCost : { Hireserver : { price: { monthly : value*10, yearly : value*100 }, savings: { monthly : value*10/2, yearly : value*100/2 } }, Aws : { price: { monthly : value*10, yearly : value*100 }, savings: { monthly : value*10/2, yearly : value*100/2 } }, Google : { price: { monthly : value*10, yearly : value*100 }, savings: { monthly : value*10/2, yearly : value*100/2 } }, Azure : { price: { monthly : value*10, yearly : value*100 }, savings: { monthly : value*10/2, yearly : value*100/2 } }, Digital : { price: { monthly : value*10, yearly : value*100 }, savings: { monthly : value*10/2, yearly : value*100/2 } }, Linode : { price: { monthly : value*10, yearly : value*100 }, savings: { monthly : value*10/2, yearly : value*100/2 } } } } } var blockValue = 1; var subscriptionType = "monthly"; // purchase-btn $("#total-cost").html(totalCost[1].total.monthly); // calculator-input $(document).ready(function() { // toggleswitch $('#block-calculator-toggle-switch').change(function() { blockValue = $("#block-input").val(); if(blockValue == 0) return; if(this.checked) { subscriptionType = "yearly"; toggle=true; }else{ subscriptionType = "monthly"; toggle=false; } changeTotalCost(); }); $("#block-input").change(function(){ let blockInp=$(this).val(); if(blockInp==0 || blockInp >= 100) return; data.cores=4*blockInp; data.ram =4*blockInp; data.storage =512*blockInp; data.transfer = 8*blockInp; addLeftBlockHTML(); }) $("#btn-plus").click(function () { let value = $("#block-input").val(); data.cores *= 2; data.ram *= 2; data.storage *= 2; data.transfer *= 2; addLeftBlockHTML(); }) $("#btn-minus").click(function () { let value1 = $("#block-input").val(); if(value1==1){ return } data.cores /= 2; data.ram /= 2; data.storage /= 2; data.transfer /= 2; addLeftBlockHTML(); }); // input addLeftBlockHTML(); }); // leftblock function addLeftBlockHTML(){ let html = `
CPU's
Core AMD EPYC 7003
${data.cores} cores
RAM
${data.ram}GB
STORAGE
NVMe SSD
${data.storage}GB
TRANSFER
${data.transfer}TB