1// jQuery(document).ready(function() { 2 3// let calculator_button = jQuery('button.cv-calculator'); 4// let clone_row = jQuery('.calculator-container .row.clone'); 5// let table = jQuery('.calculator-container > .calculator.grid'); 6// let total_elem = jQuery('.calculator-container > .result.grid .total > span'); 7 8// if (calculator_button.length) { 9 10// // Init 11// updateCalculator(table.find('.row.body').first()); 12 13// calculator_button.click(function() { 14// table.append(clone_row.clone().removeClass('hidden')); 15// updateCalculator(table.find('.row.body').last()); 16// }); 17 18// table.on('change', '.column.species > select', function() { 19// updateCalculator(jQuery(this).closest('.row.body')); 20// }); 21 22// table.on('change keyup', 'input.column.quantity', function() { 23// updateCalculator(jQuery(this).closest('.row.body')); 24// }); 25 26// table.on('change keyup', 'input.column.conditions', function() { 27// updateCalculator(jQuery(this).closest('.row.body')); 28// }); 29 30// } 31 32 33// function updateCalculator(row) { 34// let price_per = jQuery(row).find('option:selected').val(); 35// let conditions = jQuery(row).find('.column.conditions').val(); 36// let quantity = jQuery(row).find('.column.quantity').val(); 37 38// jQuery(row).find('.column.price > span').text(formatMoney((price_per * conditions) * quantity)); 39// jQuery(row).find('.column.price').attr("data-row-price", ((price_per * conditions) * quantity)); 40 41// total_elem.text(formatMoney(calculateTotal())); 42// } 43 44 45// function calculateTotal() { 46// let total = 0; 47 48// table.find('.column.price').each(function() { 49// total += parseInt(jQuery(this).attr("data-row-price")); 50// }); 51 52// return total; 53// } 54 55 56// function formatMoney(amount) { 57// return amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); 58// } 59 60// }); 61 62// Cost Calculator Feedback Form 63jQuery(document).ready(function() { 64 65 jQuery('.calculator-feedback .show-calculator-feedback').click(function() { 66 67 jQuery('.calculator-feedback .wp-block-emulate-custom-blocks-hubspot-form').show(); 68 69 }); 70 71}); 72 73 74jQuery(document).ready(function() { 75 76 let table = jQuery('.calculator-container > .calculator.grid'); 77 let row_1; 78 let row_2; 79 80 if (table.length) { 81 82 row_1 = jQuery('.calculator-container > .calculator.grid > *:nth-child(2)'); 83 row_2 = jQuery('.calculator-container > .calculator.grid > *:nth-child(3)'); 84 85 // Init 86 updateCalculator(table.find('.row.body').first()); 87 88 table.on('change keyup', 'input.column.conditions', function() { 89 updateCalculator(jQuery(this).closest('.row.body')); 90 }); 91 92 } 93 94 95 function updateCalculator() { 96 97 let compounds = table.find('input.column.conditions').val(); 98 99 let study_groups_1 = Math.ceil(compounds / 6); 100 let study_groups_2 = Math.ceil(compounds / 1.8); 101 102 // let controls = study_groups_1 * 3; ??? 103 104 let study_cost_1 = 200000 + (compounds * 3000) + (study_groups_1 * 3000); 105 let study_cost_2 = 150000 * compounds; 106 107 let study_length_1 = 21 * study_groups_1 / 30; 108 let study_length_2 = 90 * study_groups_2 / 30; 109 110 console.log('emulate cost', formatMoney(study_cost_1)); 111 console.log('emulate length', study_length_1); 112 113 console.log('other cost', formatMoney(study_cost_2)); 114 console.log('other length', study_length_2); 115 116 row_1.find('.time').html(study_length_1 + " months"); 117 row_1.find('.cost').html(formatMoney(study_cost_1)); 118 119 row_2.find('.time').html(study_length_2 + " months"); 120 row_2.find('.cost').html(formatMoney(study_cost_2)); 121 122 } 123 124 125 function formatMoney(amount) { 126 return '$' + amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); 127 } 128 129});
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.