- Chat in game can now be prevented from auto-scrolling using a button.

This commit is contained in:
marcins78@gmail.com
2012-04-11 18:14:17 +00:00
parent 0dde880fab
commit ab9eac1a89
3 changed files with 75 additions and 40 deletions

View File

@@ -1,4 +1,10 @@
<pre style="font-size:80%">
<b>11 Apr. 2012</b>
- 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.
<b>10 Apr. 2012</b>
- "Momentous Gathering" now can be played if you can spot only one Ent.

View File

@@ -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 id='lockChatButton'>Toggle lock chat</button>").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 = $("<div class='userList'></div>");
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"],

View File

@@ -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 = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
this.cardActionDialog = $("<div></div>")
.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 = $("<div></div>")
.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("<br />");
@@ -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();