From d7fe6072a56ebd1a6ded2c41b31d75a738b9414b Mon Sep 17 00:00:00 2001 From: Arthur Mayer Date: Sun, 20 Feb 2011 01:58:53 +0100 Subject: [PATCH 1/3] a lot of changes. chat and ui related. thanks FrozenCow & lechd --- web/chat_style.css | 18 ++++++------------ web/clock.timeofday.js | 4 ++-- web/clock_style.css | 16 ---------------- web/index.html | 1 - web/map.js | 37 +++++++++++-------------------------- 5 files changed, 19 insertions(+), 57 deletions(-) delete mode 100644 web/clock_style.css diff --git a/web/chat_style.css b/web/chat_style.css index 30e5bab5..089bd6c8 100644 --- a/web/chat_style.css +++ b/web/chat_style.css @@ -1,4 +1,4 @@ -#chat { +.chat { position:absolute; bottom:0px; left:14px; @@ -20,14 +20,7 @@ box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.4); border-radius: 3px 3px 0px 0px; } -#chatcursor { - position:absolute; - left:5px; - bottom:5px; - color: white; - padding:0px; -} -#chatinput { +.chatinput { margin:4px; width:608px; height:12px; @@ -36,17 +29,18 @@ color: white; border: 0px; background: rgba(0, 0, 0, 0.6); + background: url(chat_cursor.png) rgba(0,0,0,0.6); background-repeat: no-repeat; background-position:left; + outline: none; } -#messagelist { +.messagelist { margin:4px 4px 0px 4px; width:622px; max-height:198px; padding:1px; color: white; overflow:hidden; - display:none; } -#messagerow { +.messagerow { position:relative; left:0px; bottom:0px; diff --git a/web/clock.timeofday.js b/web/clock.timeofday.js index 93f90038..73946f06 100644 --- a/web/clock.timeofday.js +++ b/web/clock.timeofday.js @@ -24,8 +24,8 @@ MinecraftTimeOfDay.prototype = { this.elementmoon.addClass('timeofday'); this.elementmoon.addClass('moon'); this.elementmoon.html(" ‏ "); - this.elementsun.css("background-position", (-120) + "px " + (-120) + "px"); - this.elementmoon.css("background-position", (-120) + "px " + (-120) + "px"); + this.elementsun.css("background-position", (-150) + "px " + (-150) + "px"); + this.elementmoon.css("background-position", (-150) + "px " + (-150) + "px"); return element; }, diff --git a/web/clock_style.css b/web/clock_style.css deleted file mode 100644 index d75a00fa..00000000 --- a/web/clock_style.css +++ /dev/null @@ -1,16 +0,0 @@ -.clock { - padding-left: 16px; - color: #dede90; - background-repeat: no-repeat; -} -.clock.night { background-image: url(clock_night.png); } -.clock.day { background-image: url(clock_day.png); } - -.timeofday { background-repeat: no-repeat; } -.timeofday.sun { background-image: url(sun.png); } -.timeofday.moon { background-image: url(moon.png); } - -.compass { - background-repeat: no-repeat; - background-image: url(compass.png); -} \ No newline at end of file diff --git a/web/index.html b/web/index.html index 9886c1d6..8f20e627 100644 --- a/web/index.html +++ b/web/index.html @@ -11,7 +11,6 @@ - diff --git a/web/map.js b/web/map.js index 8d08cfa9..e6965c23 100644 --- a/web/map.js +++ b/web/map.js @@ -31,20 +31,6 @@ DynMapType.prototype = { updateTileSize: function(zoom) {} }; -function MinecraftCompass(element) { this.element = element; } -MinecraftCompass.prototype = { - element: null, - create: function(element) { - if (!element) element = $('
'); - this.element = element; - return element; - }, - initialize: function() { - this.element.html(" ‏ "); - this.element.height(120); - } -}; - function DynMap(options) { var me = this; me.options = options; @@ -195,28 +181,24 @@ DynMap.prototype = { .appendTo(panel); // The Compass - var compass = me.compass = new MinecraftCompass( - $('
') - .addClass('compass') - .appendTo(container) - ); + var compass = $('
') + .addClass('compass') + .appendTo(container) // The chat if (me.options.showchat == 'modal') { var chat = me.chat = $('
') .addClass('chat') - .attr({ id: 'chat' }) .appendTo(container); var messagelist = me.messagelist = $('
') .addClass('messagelist') - .attr({ id: 'messagelist' }) .appendTo(chat); var chatinput = me.chatinput = $('') .addClass('chatinput') .attr({ id: 'chatinput', type: 'text', - value: '' + value: '', }) .keydown(function(event) { if (event.keyCode == '13') { @@ -226,10 +208,6 @@ DynMap.prototype = { } }) .appendTo(chat); - var chatcursor = me.chatcursor = $('') - .attr({ id: 'chatcursor'}) - .text('>_') - .appendTo(chat); } // TODO: Enable hash-links. @@ -313,6 +291,10 @@ DynMap.prototype = { }, function(type) { console.log('Unknown type ', value, '!'); }); + /* remove older messages from chat*/ + //var timestamp = event.timeStamp; + //var divs = $('div[rel]'); + //divs.filter(function(i){return parseInt(divs[i].attr('rel')) > timestamp+me.options.messagettl;}).remove(); }); for(var m in me.markers) { @@ -412,9 +394,11 @@ DynMap.prototype = { } else if (me.options.showchat == 'modal') { var me = this; var messagelist = me.messagelist; + var timestamp = event.timeStamp; var messageRow = $('
') .addClass('messagerow') + .attr({ "rel": timestamp}) var playerIconContainer = $('') .addClass('messageicon') @@ -447,6 +431,7 @@ DynMap.prototype = { messageRow.append(playerIconContainer,playerNameContainer,playerMessageContainer); //messageRow.append(playerIconContainer,playerWorldContainer,playerGroupContainer,playerNameContainer,playerMessageContainer); + setTimeout(function() { messageRow.remove(); }, me.options.messagettl); messagelist.append(messageRow); me.messagelist.show(); From 02fb2263508197f5997e82b9e573664eef51f782 Mon Sep 17 00:00:00 2001 From: Arthur Mayer Date: Sun, 20 Feb 2011 02:02:45 +0100 Subject: [PATCH 2/3] removed forgotten comma --- web/map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/map.js b/web/map.js index e6965c23..3d7fea62 100644 --- a/web/map.js +++ b/web/map.js @@ -198,7 +198,7 @@ DynMap.prototype = { .attr({ id: 'chatinput', type: 'text', - value: '', + value: '' }) .keydown(function(event) { if (event.keyCode == '13') { From ad07d68d7e1fc900cb8471d6c51990a4e2348512 Mon Sep 17 00:00:00 2001 From: Arthur Mayer Date: Sun, 20 Feb 2011 02:11:44 +0100 Subject: [PATCH 3/3] added configuration option messagettl, TimeToLive for chatmessages, in Milliseconds! 15seconds: messagettl: 15000 --- configuration.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/configuration.txt b/configuration.txt index 533cad7a..fc655639 100644 --- a/configuration.txt +++ b/configuration.txt @@ -38,6 +38,7 @@ web: # showchat: modal/balloons showchat: modal + messagettl: 15000 showplayerfacesonmap: true showplayerfacesinmenu: true focuschatballoons: false