aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-04-27 19:51:32 +0200
committerpiernov <piernov@piernov.org>2016-04-27 19:51:32 +0200
commit0133251e523b1c984b2b5cdb60c7392c18e6bd73 (patch)
tree8a7813cdcb7d9675d51e1b9ba1d27f284b7608ea
parent3c3d48c02730a826c7677dad2aaa01caf8e6de8b (diff)
downloadcandybox-0133251e523b1c984b2b5cdb60c7392c18e6bd73.tar.gz
candybox-0133251e523b1c984b2b5cdb60c7392c18e6bd73.tar.bz2
candybox-0133251e523b1c984b2b5cdb60c7392c18e6bd73.tar.xz
candybox-0133251e523b1c984b2b5cdb60c7392c18e6bd73.zip
Add button for saving on server/downloading the game
-rw-r--r--index.xhtml2
-rw-r--r--js/craftmine.js8
2 files changed, 10 insertions, 0 deletions
diff --git a/index.xhtml b/index.xhtml
index aa29615..d12585f 100644
--- a/index.xhtml
+++ b/index.xhtml
@@ -32,6 +32,8 @@
<form class="form-horizontal" method="post" action="craftmine.php">
<button class="btn btn-default" type="button" name="withdraw" onclick="withdrawMine()">Withdraw</button>
<button class="btn btn-default" type="button" name="HireMiner" onclick="hireMiner()">Hire one miner</button>
+ <button class="btn btn-default" type="button" onclick="saveGame()">Save game</button>
+ <button class="btn btn-default" type="button" onclick="downGame()">Download game</button>
</form>
</div>
</div>
diff --git a/js/craftmine.js b/js/craftmine.js
index 92fa45a..13dd0a2 100644
--- a/js/craftmine.js
+++ b/js/craftmine.js
@@ -60,6 +60,14 @@ function updateMine() {
updateData("mine");
}
+function saveGame() {
+ sendRequest("craftmine.php", "op=saveGame");
+}
+
+function downGame() {
+ window.open("craftmine.php?op=downGame", "_blank");
+}
+
function init() {
initCraftMine();
changeTab();