From ab9eac1a892e38c56e3f556eb9240e6070e44733 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 11 Apr 2012 18:14:17 +0000 Subject: [PATCH] - Chat in game can now be prevented from auto-scrolling using a button. --- .../src/main/webapp/includes/changeLog.html | 6 ++ .../src/main/webapp/js/gemp-002/chat.js | 45 ++++++++++--- .../src/main/webapp/js/gemp-002/gameUi.js | 64 +++++++++---------- 3 files changed, 75 insertions(+), 40 deletions(-) diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html index 7010ed004..b41a75900 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html @@ -1,4 +1,10 @@
+11 Apr. 2012
+- Added sets 01-06 starters to merchant.
+- Merchant starting filter shows cards only.
+- System messages in Game Hall can now be hidden with a button.
+- Chat in game can now be prevented from auto-scrolling using a button.
+
 10 Apr. 2012
 - "Momentous Gathering" now can be played if you can spot only one Ent.
 
diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/chat.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/chat.js
index 8e653d872..fda6d04fa 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/chat.js
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/chat.js
@@ -15,8 +15,10 @@ var ChatBoxUI = Class.extend({
     playerListener: null,
     hiddenClasses: null,
     hideSystemButton: null,
+    lockButton: null,
+    lockChat: false,
 
-    init: function(name, div, url, showList, playerListener, showHideSystemButton) {
+    init: function(name, div, url, showList, playerListener, showHideSystemButton, showLockButton) {
         var that = this;
         this.hiddenClasses = new Array();
         this.playerListener = playerListener;
@@ -64,21 +66,41 @@ var ChatBoxUI = Class.extend({
                 this.hideSystemButton.click(
                         function() {
                             if (that.isShowingMessageClass("systemMessage")) {
-                                $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomin'})
+                                $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomin'});
                                 that.hideMessageClass("systemMessage");
                             } else {
-                                $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomout'})
+                                $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomout'});
                                 that.showMessageClass("systemMessage");
                             }
                         });
                 this.hideMessageClass("systemMessage");
             }
 
+            if (showLockButton) {
+                this.lockButton = $("").button(
+                {icons: {
+                    primary: "ui-icon-locked"
+                }, text: false});
+                this.lockButton.click(
+                        function() {
+                            if (that.lockChat) {
+                                $('#lockChatButton').button("option", "icons", {primary:'ui-icon-locked'});
+                                that.lockChat = false;
+                            } else {
+                                $('#lockChatButton').button("option", "icons", {primary:'ui-icon-unlocked'});
+                                that.lockChat = true;
+                            }
+                        });
+            }
+
             if (showList) {
                 this.chatListDiv = $("
"); this.div.append(this.chatListDiv); } - this.div.append(this.hideSystemButton); + if (this.hideSystemButton != null) + this.div.append(this.hideSystemButton); + if (this.lockButton != null) + this.div.append(this.lockButton); this.div.append(this.chatTalkDiv); this.communication.startChat(this.name, @@ -145,12 +167,18 @@ var ChatBoxUI = Class.extend({ this.chatListDiv.css({ position: "absolute", left: x + width - userListWidth + "px", top: y + "px", width: userListWidth, height: height - this.talkBoxHeight - 3 * talkBoxPadding, overflow: "auto" }); this.chatMessagesDiv.css({ position: "absolute", left: x + "px", top: y + "px", width: width - userListWidth, height: height - this.talkBoxHeight - 3 * talkBoxPadding, overflow: "auto" }); if (this.chatTalkDiv != null) { + var leftTextBoxPadding = 0; + if (this.hideSystemButton != null) { this.hideSystemButton.css({position: "absolute", left: x + width - talkBoxPadding - this.talkBoxHeight + "px", top: y - 2 * talkBoxPadding + (height - this.talkBoxHeight) + "px", width: this.talkBoxHeight, height: this.talkBoxHeight}); - this.chatTalkDiv.css({ position: "absolute", left: x + talkBoxPadding + "px", top: y - 2 * talkBoxPadding + (height - this.talkBoxHeight) + "px", width: width - 4 * talkBoxPadding - this.talkBoxHeight, height: this.talkBoxHeight }); - } else { - this.chatTalkDiv.css({ position: "absolute", left: x + talkBoxPadding + "px", top: y - 2 * talkBoxPadding + (height - this.talkBoxHeight) + "px", width: width - 3 * talkBoxPadding , height: this.talkBoxHeight }); + leftTextBoxPadding += this.talkBoxHeight + talkBoxPadding; } + if (this.lockButton != null) { + this.lockButton.css({position: "absolute", left: x + width - talkBoxPadding - this.talkBoxHeight - leftTextBoxPadding + "px", top: y - 2 * talkBoxPadding + (height - this.talkBoxHeight) + "px", width: this.talkBoxHeight, height: this.talkBoxHeight}); + leftTextBoxPadding += this.talkBoxHeight + talkBoxPadding; + } + + this.chatTalkDiv.css({ position: "absolute", left: x + talkBoxPadding + "px", top: y - 2 * talkBoxPadding + (height - this.talkBoxHeight) + "px", width: width - 3 * talkBoxPadding - leftTextBoxPadding, height: this.talkBoxHeight }); } }, @@ -168,7 +196,8 @@ var ChatBoxUI = Class.extend({ if ($("div.message", this.chatMessagesDiv).length > 150) { $("div.message", this.chatMessagesDiv).first().remove(); } - this.chatMessagesDiv.prop({ scrollTop: this.chatMessagesDiv.prop("scrollHeight") }); + if (!this.lockChat) + this.chatMessagesDiv.prop({ scrollTop: this.chatMessagesDiv.prop("scrollHeight") }); }, monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/gameUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/gameUi.js index cebb8391d..e5d10e664 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/gameUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-002/gameUi.js @@ -459,7 +459,7 @@ var GempLotrGameUI = Class.extend({ }; var chatRoomName = (this.replayMode ? null : ("Game" + getUrlParam("gameId"))); - this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener); + this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener, false, true); this.chatBox.chatUpdateInterval = 3000; if (!this.spectatorMode && !this.replayMode) { @@ -659,21 +659,21 @@ var GempLotrGameUI = Class.extend({ initializeDialogs: function() { this.smallDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: false, - resizable: false, - width: 400, - height: 200 - }); + autoOpen: false, + closeOnEscape: false, + resizable: false, + width: 400, + height: 200 + }); this.cardActionDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: false, - resizable: true, - width: 600, - height: 300 - }); + autoOpen: false, + closeOnEscape: false, + resizable: true, + width: 600, + height: 300 + }); var that = this; @@ -688,11 +688,11 @@ var GempLotrGameUI = Class.extend({ this.infoDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: false, - title: "Card information" - }); + autoOpen: false, + closeOnEscape: true, + resizable: false, + title: "Card information" + }); var swipeOptions = { threshold: 20, @@ -1203,12 +1203,12 @@ var GempLotrGameUI = Class.extend({ if (!this.replayMode) { this.smallDialog.dialog("option", "buttons", - { - "OK": function() { - $(this).dialog("close"); - that.decisionFunction(id, $("#integerDecision").val()); - } - }); + { + "OK": function() { + $(this).dialog("close"); + that.decisionFunction(id, $("#integerDecision").val()); + } + }); } $("#integerDecision").SpinnerControl({ type: 'range', @@ -1246,12 +1246,12 @@ var GempLotrGameUI = Class.extend({ if (!this.replayMode) { this.smallDialog.dialog("option", "buttons", - { - "OK": function() { - that.smallDialog.dialog("close"); - that.decisionFunction(id, $("#multipleChoiceDecision").val()); - } - }); + { + "OK": function() { + that.smallDialog.dialog("close"); + that.decisionFunction(id, $("#multipleChoiceDecision").val()); + } + }); } } else { this.smallDialog.append("
"); @@ -1644,8 +1644,8 @@ var GempLotrGameUI = Class.extend({ $(div).find('LI.hover').removeClass('hover'); $(this).parent().addClass('hover'); }).mouseout(function() { - $(div).find('LI.hover').removeClass('hover'); - }); + $(div).find('LI.hover').removeClass('hover'); + }); var getRidOfContextMenu = function() { $(div).remove();