From e72ea19dcfa44b6e74330acb4d51c0431eddb561 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 14 Sep 2011 23:27:43 +0000 Subject: [PATCH] Adding settings for autoAccept and autoPass options. --- .../gemp-lotr-web/src/main/webapp/game.html | 9 +++++ .../src/main/webapp/js/gameUi.js | 40 ++++++++++++++++--- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html index 500dba6e5..a8ea26c5e 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html @@ -70,12 +70,21 @@ .warningMessage { color: #ff0000; } + + .ui-tabs-nav li { + font-size: 70%; + } + + #settingsBox label { + font-size: 70%; + } + diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js index 92e196863..8abbe258b 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js @@ -42,6 +42,8 @@ var GempLotrGameUI = Class.extend({ windowWidth: null, windowHeight: null, + tabPane: null, + init: function(communication) { log("ui initialized"); this.communication = communication; @@ -124,9 +126,37 @@ var GempLotrGameUI = Class.extend({ this.alert.css({"border-radius": "7px"}); $("#main").append(this.alert); - this.chatBoxDiv = $("
"); - this.chatBoxDiv.css({"border-radius": "7px"}); - $("#main").append(this.chatBoxDiv); + this.tabPane = $("
").tabs(); + + $("#main").append(this.tabPane); + + this.chatBoxDiv = $("#chatBox"); + + $("#settingsBox").append("
"); + $("#settingsBox").append("
"); + + var autoPass = $.cookie("autoPass"); + if (autoPass == "true") { + $("#autoPass").prop("checked", true); + this.settingsAutoPass = true; + } + var autoAccept = $.cookie("autoAccept"); + if (autoAccept == "true") { + $("#autoAccept").prop("checked", true); + this.settingsAutoAccept = true; + } + + $("#autoPass").bind("change", function() { + var selected = $("#autoPass").prop("checked"); + that.settingsAutoPass = selected; + $.cookie("autoPass", "" + selected, { expires: 365 }); + }); + + $("#autoAccept").bind("change", function() { + var selected = $("#autoAccept").prop("checked"); + that.settingsAutoAccept = selected; + $.cookie("autoAccept", "" + selected, { expires: 365 }); + }); this.chatBox = new ChatBoxUI("Game" + getUrlParam("gameId"), $("#chatBox"), this.communication); @@ -286,8 +316,8 @@ var GempLotrGameUI = Class.extend({ this.gameStateElem.css({ position: "absolute", left: padding * 2 + advPathWidth, top: padding, width: specialUiWidth - padding, height: height - padding * 4 - alertHeight - chatHeight}); this.alert.css({ position: "absolute", left: padding * 2 + advPathWidth, top: height - (padding * 2) - alertHeight - chatHeight, width: specialUiWidth - padding, height: alertHeight }); - this.chatBoxDiv.css({ position: "absolute", left: padding, top: height - padding - chatHeight, width: specialUiWidth + advPathWidth, height: chatHeight }); - this.chatBox.setBounds(4, 4, specialUiWidth + advPathWidth - 8, chatHeight - 8); + this.tabPane.css({ position: "absolute", left: padding, top: height - padding - chatHeight, width: specialUiWidth + advPathWidth - padding, height: chatHeight - padding}); + this.chatBox.setBounds(4, 4 + 25, specialUiWidth + advPathWidth - 8, chatHeight - 8 - 25); } },