make chat code remember and restore the last chat tab used on reload

This commit is contained in:
Jon Atkins 2013-09-03 19:40:49 +01:00
parent fb30e2530d
commit 2f40571ee1

View File

@ -489,6 +489,8 @@ window.chat.needMoreMessages = function() {
window.chat.chooseAnchor = function(t) {
var tt = t.text();
localStorage['iitc-chat-tab'] = tt;
var mark = $('#chatinput mark');
var input = $('#chatinput input');
@ -578,6 +580,11 @@ window.chat.keepScrollPosition = function(box, scrollBefore, isOldMsgs) {
window.chat.setup = function() {
window.chat._localRangeCircle = L.circle(map.getCenter(), CHAT_MIN_RANGE*1000);
if (localStorage['iitc-chat-tab']) {
var t = $('<a>'+localStorage['iitc-chat-tab']+'</a>');
window.chat.chooseAnchor(t);
}
$('#chatcontrols, #chat, #chatinput').show();
$('#chatcontrols a:first').click(window.chat.toggle);