Automatically load previous values.

This commit is contained in:
Josh Mudge 2017-10-21 21:25:23 -06:00
parent f9190d3969
commit 79c338ea3c
2 changed files with 41 additions and 4 deletions

View File

@ -1,9 +1,45 @@
"use strict"; "use strict";
//Licensed under the Apache License 2.0. See license file for information. //Licensed under the Apache License 2.0. See license file for information.
// Ardon Income Calculator v3.5 stable. // Ardon Income Calculator v3.6 stable.
// Written by Josh Mudge // Written by Josh Mudge
// Ad Mejorem Dei Glorium // Ad Mejorem Dei Glorium
function loadsaved() {
var blocks = localStorage.blocks // Put this section in it's own function, pass the variables to the other functions when usevalues() is run.
var soldiers = localStorage.soldiers
var one = localStorage.one
var hotel = localStorage.hotel
var gov = localStorage.gov
var govspecial = localStorage.govspecial
var indesign = localStorage.indesign
var outdesign = localStorage.outdesign
var embassies = localStorage.embassies
var capital = localStorage.capital
var infra = localStorage.infra
var chain = localStorage.chain
var town = localStorage.town
var city = localStorage.city
var metro = localStorage.metro
document.getElementById("blocks").value = blocks;
document.getElementById("soldiers").value = soldiers;
document.getElementById("one").value = one;
document.getElementById("gov").value = hotel;
document.getElementById("gov").value = gov;
document.getElementById("govspecial").value = govspecial;
document.getElementById("indesign").value = indesign;
document.getElementById("outdesign").value = outdesign;
document.getElementById("embassies").value = embassies;
document.getElementById("capital").value = capital;
document.getElementById("infra").value = infra;
document.getElementById("chain").value = chain;
document.getElementById("town").value = town;
document.getElementById("city").value = city;
document.getElementById("metro").value = metro;
}
function usesaved() { function usesaved() {
var blocks = localStorage.blocks var blocks = localStorage.blocks
var soldiers = localStorage.soldiers var soldiers = localStorage.soldiers

View File

@ -2,9 +2,11 @@
<!--Copyright 2016 Joshua Mudge Licensed under the Apache License 2.0. See license file for information.--> <!--Copyright 2016 Joshua Mudge Licensed under the Apache License 2.0. See license file for information.-->
<html> <html>
<head> <head>
<script src="calculate.js"></script>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Minecraft Income Calculator</title> <title>Minecraft Income Calculator</title>
</head> </head>
<body onload="loadsaved()">
<h1>Minecraft Income Calculator</h1> <h1>Minecraft Income Calculator</h1>
<br> <br>
<p>Enter the number of blocks eligable for rent excluding one "base of operations" you change. (1000 blocks = 1 emerald)</p> <p>Enter the number of blocks eligable for rent excluding one "base of operations" you change. (1000 blocks = 1 emerald)</p>
@ -67,11 +69,10 @@ Enter the number of metropolises in your empire. (See: https://mc.cityofardon.co
<input type="number" id="metro"></input> <input type="number" id="metro"></input>
<br><br> <br><br>
<input type="button" value="Calculate Income" onclick="usesaved()" /> <input type="button" value="Calculate Income" onclick="usesaved()" />
<input type="button" value="Calulate Using Saved Values" onclick="calculate()" />
<p id="Income"></p> <p id="Income"></p>
<p id="Bonus"></p> <p id="Bonus"></p>
<br><br><br><br><br> <br><br><br><br><br>
<script src="calculate.js"></script>
<p>&copy; Copyright 2017 Joshua Mudge</p> <p>&copy; Copyright 2017 Joshua Mudge</p>
<p>Licensed under the Apache License 2.0, see the <a href="LICENSE.txt">license</a> file for details.</p> <p>Licensed under the Apache License 2.0, see the <a href="LICENSE.txt">license</a> file for details.</p>
</body>
</html> </html>