aboutsummaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/craftmine.js7
-rw-r--r--js/dungeon.js6
-rw-r--r--js/gui.js4
-rw-r--r--js/savegame.js8
-rw-r--r--js/shop.js8
5 files changed, 19 insertions, 14 deletions
diff --git a/js/craftmine.js b/js/craftmine.js
index b87f946..347ce65 100644
--- a/js/craftmine.js
+++ b/js/craftmine.js
@@ -80,7 +80,8 @@ function updateMine() {
function init() {
initCraftMine();
- changeTab();
- listSaves();
- window.setInterval(updateMine, 1000);
+ changeTab(); // Switch to tab specified in URL
+ listSaves(); // Update save list on page load
+ window.setInterval(updateMine, 1000); // Increase mine amount every 1 second
+ window.onhashchange = changeTab; // Hook changeTab from js/gui.js to hashchange event
}
diff --git a/js/dungeon.js b/js/dungeon.js
index 982dcf6..c23b549 100644
--- a/js/dungeon.js
+++ b/js/dungeon.js
@@ -10,7 +10,7 @@ function buildDungeon(){
function displayDungeon(nb,f,firstTime){
var tmphtml = "<br/>";
- tmphtml += "<button id=\"launch\" type=\"button\" class=\"btn btn-primary\" onclick=\"launchDungeon("+nb+","+f+","+firstTime+")\">Launch</button>";
+ tmphtml += "<button id=\"launch\" type=\"button\" class=\"btn btn-success\" onclick=\"launchDungeon("+nb+","+f+","+firstTime+")\">Launch</button>";
document.getElementById("tab4").innerHTML = tmphtml;
}
@@ -28,8 +28,8 @@ function displayBattle(ret,nb,f){
tmphtml += "<h4>Battle floor "+ f +"</h4>";
tmphtml += "<ul class=\"list-inline\">";
tmphtml += "<li>";
- tmphtml += "<button type=\"button\" class=\"btn btn-primary\" id=\"perso\" style=\"margin-left:30px;\"><span class=\"item-icon\">" + data.icon + "</span><br />" + data.name + "<br/> lv: " + data.level + " hp: <span id=\"lifePerso\">" + data.hp + "</span></button>";
- tmphtml += "<button type=\"button\" class=\"btn btn-primary\" id=\"mob\" style=\"margin-left:30px;\">"
+ tmphtml += "<button type=\"button\" class=\"btn btn-success\" id=\"perso\" style=\"margin-left:30px;\"><span class=\"item-icon\">" + data.icon + "</span><br />" + data.name + "<br/> lv: " + data.level + " hp: <span id=\"lifePerso\">" + data.hp + "</span></button>";
+ tmphtml += "<button type=\"button\" class=\"btn btn-success\" id=\"mob\" style=\"margin-left:30px;\">"
+"<span class=\"item-icon\">" + ret[nb].icon + "</span><br />" + ret[nb].name + "<br/>"
+" lv: " + ret[nb].level + " hp: <span id=\"lifeMob\">" + ret[nb].hp + "</span></button>";
tmphtml += "</li>";
diff --git a/js/gui.js b/js/gui.js
index 89fa0fa..ee29622 100644
--- a/js/gui.js
+++ b/js/gui.js
@@ -15,7 +15,7 @@ function changeTab() {
function showMessage(type, msg) {
var msg_box = document.getElementById(type+"-box");
msg_box.style.display = "initial";
- var msg_list = msg_box.firstElementChild.firstElementChild.firstElementChild;
+ var msg_list = msg_box.firstElementChild.firstElementChild;
msg_list.innerHTML = "<li>" + msg + "</li>\n" + msg_list.innerHTML;
window.setTimeout(hideMessage.bind(null, type), MESSAGE_TIMEOUT);
@@ -23,7 +23,7 @@ function showMessage(type, msg) {
function hideMessage(type) {
var msg_box = document.getElementById(type+"-box");
- var msg_list = msg_box.firstElementChild.firstElementChild.firstElementChild;
+ var msg_list = msg_box.firstElementChild.firstElementChild;
var item = msg_list.lastElementChild;
msg_list.removeChild(item);
diff --git a/js/savegame.js b/js/savegame.js
index d5a9ba1..c069b5c 100644
--- a/js/savegame.js
+++ b/js/savegame.js
@@ -2,7 +2,13 @@ function listSaves() {
sendRequest("craftmine.php", "op=listSaves", function(ret) {
var tmphtml=""
for(var i=0; i<ret.length; i++) {
- tmphtml += "<label class=\"radio\"><input name=\"saveRadio\" value=\"" + i + "\" type=\"radio\" />" + ret[i] + "</label>\n";
+ tmphtml += "<div class=\"input-group\">";
+ tmphtml += "<span class=\"input-group-addon\">";
+ tmphtml += "<input name=\"saveRadio\" value=\"" + i + "\" type=\"radio\" />";
+ tmphtml += "</span>";
+ tmphtml += "<input class=\"form-control\" type=\"text\" value=\"" + ret[i] + "\" readonly=\"readonly\" />";
+
+ tmphtml += "</div>"
}
console.log(tmphtml);
document.getElementById("listsaves").innerHTML = tmphtml;
diff --git a/js/shop.js b/js/shop.js
index efb347a..ce0ecd8 100644
--- a/js/shop.js
+++ b/js/shop.js
@@ -3,16 +3,14 @@ function displayShop(ret) {
for(var key in ret.items){
if(ret.items.hasOwnProperty(key)){
var category = ret.items[key];
- tmphtml += "<div class=\"row\">";
tmphtml += "<h4>"+key+"</h4>";
tmphtml += "<ul class=\"list-inline\">";
for(var i=0; i < category.length; i++) {
tmphtml += "<li>";
- tmphtml += "<button type=\"button\" class=\"btn btn-primary\" onclick=\"buyItem('" + category[i].name + "')\"><span class=\"item-icon\">" + category[i].icon + "</span><br />" + category[i].name + "</button>";
+ tmphtml += "<button type=\"button\" class=\"btn btn-success\" onclick=\"buyItem('" + category[i].name + "')\"><span class=\"item-icon\">" + category[i].icon + "</span><br />" + category[i].name + "</button>";
tmphtml += "</li>";
}
tmphtml += "</ul>";
- tmphtml += "</div>";
}
}
document.getElementById("tab2").innerHTML = tmphtml;
@@ -37,7 +35,7 @@ function addItem(ret) {
var itemtag = document.querySelector("[data-name=\""+ret[0].name+"\"]");
if(!itemtag){ //si c'est la première itération de l'objet
itemhtml += "<li>";
- itemhtml += "<button type=\"button\" class=\"btn btn-primary\" onclick=\"useItem('" + ret[0].name + "')\"><span class=\"item-icon\">" + ret[0].icon + "</span><br />" + ret[0].name + "(<span id=\"nbItem\" data-name=\""+ ret[0].name + "\">"+ret[1]+"</span>)</button>";
+ itemhtml += "<button type=\"button\" class=\"btn btn-success\" onclick=\"useItem('" + ret[0].name + "')\"><span class=\"item-icon\">" + ret[0].icon + "</span><br />" + ret[0].name + "(<span data-name=\""+ ret[0].name + "\">"+ret[1]+"</span>)</button>";
itemhtml += "</li>";
}
else{ // si c'est une n-ième itération
@@ -48,7 +46,7 @@ function addItem(ret) {
if(invcontent.children.length <= 1)
{
- var tmphtml = "<h4>Your bag contains the following items:</h4>";
+ var tmphtml = "<h3>Your bag contains the following items:</h3>";
tmphtml += "<ul class=\"list-inline\">";
tmphtml += itemhtml;
tmphtml += "</ul>"