"use strict"; //Licensed under the Apache License 2.0. See license file for information. // Ardon Income Calculator v3.1.1 stable. // Written by Josh Mudge // Ad Mejorem Dei Glorium function calculate() { var numReg = /^\d+$/; //Get input var blocks = document.getElementById("blocks").value; var one = document.getElementById("one").value; var gov = document.getElementById("gov").value; var design = document.getElementById("design").value; var embassies = document.getElementById("embassies").value; var capital = document.getElementById("capital").value; var infra = document.getElementById("infra").value; var chain = document.getElementById("chain").value; var town = document.getElementById("town").value; var city = document.getElementById("city").value; var metro = document.getElementById("metro").value; if (blocks.match(numReg)) { //Do nothing. } else { //Tells them to enter only numbers. alert("Please enter only numbers in this field."); } var gold = +blocks / 1000 * 100 console.log(gold) var infra = +infra / 1000 * 0.001 console.log(infra) var one = +one / 1000 * 0.01 console.log(one) var chain = +chain * 0.0025 console.log(chain) var design = +design / 1000 * 0.015 console.log(design) var gov = +gov * 0.02 console.log(gov) var embassies = +embassies * 0.02 console.log(embassies) var capital = +capital * 0.025 console.log(capital) var town = +town * 0.005 console.log(town) var city = +city * 0.01 console.log(city) var metro = +metro * 0.01 console.log(metro) var percent = +one + +design + +gov + +embassies + +capital + +infra + +chain + +town + +city + +metro console.log(percent) var total = +gold * +percent console.log(total) var total = +total + +gold console.log(total) var total = total.toFixed(0); console.log(total) var date = Date(); console.log(date) //Show result alert("Your income is " + total + " Gold"); document.getElementById("Income").innerHTML = "Your Income is " + total + " Gold per Minecraft Year (5 days)"; }