aboutsummaryrefslogtreecommitdiffstats
path: root/js/craftmine.js~
diff options
context:
space:
mode:
authoralexichi <alexbankai96@gmail.com>2016-04-25 10:25:46 +0200
committeralexichi <alexbankai96@gmail.com>2016-04-25 10:25:46 +0200
commit3ece645cc83e36aaa36c0258afa0f1b36eb13ca2 (patch)
treeeda51cf0e00dd447c128b7b788627491c84e19e0 /js/craftmine.js~
parent8984aa2ecca7feacec93db35aee1570e40fa5123 (diff)
downloadcandybox-3ece645cc83e36aaa36c0258afa0f1b36eb13ca2.tar.gz
candybox-3ece645cc83e36aaa36c0258afa0f1b36eb13ca2.tar.bz2
candybox-3ece645cc83e36aaa36c0258afa0f1b36eb13ca2.tar.xz
candybox-3ece645cc83e36aaa36c0258afa0f1b36eb13ca2.zip
remove useless files and add .gitignore to not see them again
Diffstat (limited to 'js/craftmine.js~')
-rw-r--r--js/craftmine.js~51
1 files changed, 0 insertions, 51 deletions
diff --git a/js/craftmine.js~ b/js/craftmine.js~
deleted file mode 100644
index bc03d6c..0000000
--- a/js/craftmine.js~
+++ /dev/null
@@ -1,51 +0,0 @@
-datas = {
- gold: 0,
- mine: 0,
- miners: 1,
- level: 1
-}
-
-function sendRequest(url, params, callback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", url);
- xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xhr.onreadystatechange = function() {
- if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == "200") {
- callback(xhr);
- }
- }
- xhr.send(params);
-}
-
-
-function updateDatas(t) {
- document.getElementById(t).innerHTML = datas[t];
-}
-
-function withdrawMine() {
- sendRequest("craftmine.php", "op=withdrawMine", function() {
- datas.gold += parseInt(datas.mine);
- datas.mine = 0;
- updateDatas("gold");
- updateDatas("mine");
- })
-}
-
-function initCraftMine() {
- sendRequest("craftmine.php", "op=getCraftMine", function(xhr) {
- var ret = xhr.responseText;
- datas.gold = ret;
- updateDatas("gold");
- })
-}
-
-
-function updateMine() {
- datas.mine += (datas.mineurs+1);
- updateDatas("mine");
-}
-
-function init() {
- initCraftMine();
- window.setInterval(updateMine, 1000);
-}