summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2019-07-15 21:02:34 -0400
committerKyle Gunger <kgunger12@gmail.com>2019-07-15 21:02:34 -0400
commit278f2ff2d0888893b30b4179dd3400201af1fa1b (patch)
tree58549fba5f325ced8b91bb103f3e875eff18da7d /index.html
parenta85f13d5019b5313cd2edc9e6a5441185a7b521e (diff)
[RELEASE] Loading and saving (plus some bugfixes)
Additions: + Loading and saving game states now supported (from app-created save files) + Code taken from Kanchu (and contributors) on StackOverflow for saving files + 3x3 minimum area implemented for game starts + Bugfix for disappearing mines on local repo Other: ~ More concise CSS ~ Probably the final version unless I find another cool feature which I feel like putting in
Diffstat (limited to 'index.html')
-rw-r--r--index.html10
1 files changed, 8 insertions, 2 deletions
diff --git a/index.html b/index.html
index 27fe72f..5b27806 100644
--- a/index.html
+++ b/index.html
@@ -26,13 +26,17 @@
<option value="0.25">Impossible</option>
<option value="0">Custom</option>
</select>
+ <br>
+ <label>- OR -</label>
+ <br>
+ <button id="save" onclick="game.save()">Save Game</button> | <label for="fin">Choose Save File</label><input id="fin" type="file" accept=".mgs"/> <button id="load" onclick="game.loadFromFile()">Load Game</button>
</div>
<br>
<div class="game">
<h1 id="mines">0</h1><button id="circle" onclick="game.reset()"></button><h1 id="time">0</h1>
<br>
<table>
- <tbody id="gtable"><tr><td class="wt">&#9673</td></tr></tbody>
+ <tbody id="gtable"><tr><td class="wt">&#9673;</td></tr></tbody>
</table>
</div>
<script>
@@ -41,13 +45,15 @@
var mIn = document.getElementById("m");
var dIn = document.getElementById("d");
- var sMines = document.getElementById("mines");
+ var sMines = document.getElementById("mines");
var sTime = document.getElementById("time");
var circle = document.getElementById("circle");
var table = document.getElementById("gtable");
+ var fileSel = document.getElementById("fin");
+
var game = new Board();
mIn.addEventListener("change", function(){