COMM fixes
- when on global view, clamp the lat/lng so it's not beyond +-180 E/W and +-90 N/S - otherwise the server no longer returns data - fix refresh on chat tab changing - it was firing too early on first page load
This commit is contained in:
parent
5710cb511a
commit
5dd108c922
18
code/chat.js
18
code/chat.js
@ -41,7 +41,7 @@ window.chat._oldBBox = null;
|
||||
window.chat.genPostData = function(isFaction, storageHash, getOlderMsgs) {
|
||||
if(typeof isFaction !== 'boolean') throw('Need to know if public or faction chat.');
|
||||
|
||||
var b = map.getBounds();
|
||||
var b = clampLatLngBounds(map.getBounds());
|
||||
|
||||
// set a current bounding box if none set so far
|
||||
if (!chat._oldBBox) chat._oldBBox = b;
|
||||
@ -430,6 +430,13 @@ window.chat.getActive = function() {
|
||||
return $('#chatcontrols .active').text();
|
||||
}
|
||||
|
||||
window.chat.tabToChannel = function(tab) {
|
||||
if (tab == 'faction') return 'faction';
|
||||
if (tab == 'alerts') return 'alerts';
|
||||
return 'public'; //for 'full', 'compact' and 'public'
|
||||
};
|
||||
|
||||
|
||||
|
||||
window.chat.toggle = function() {
|
||||
var c = $('#chat, #chatcontrols');
|
||||
@ -481,9 +488,13 @@ window.chat.needMoreMessages = function() {
|
||||
chat.requestFaction(true);
|
||||
else
|
||||
chat.requestPublic(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
window.chat.chooseAnchor = function(t) {
|
||||
var oldTab = chat.getActive();
|
||||
var oldChannel = chat.tabToChannel(oldTab);
|
||||
|
||||
var tt = t.text();
|
||||
|
||||
localStorage['iitc-chat-tab'] = tt;
|
||||
@ -494,6 +505,9 @@ window.chat.chooseAnchor = function(t) {
|
||||
$('#chatcontrols .active').removeClass('active');
|
||||
$("#chatcontrols a:contains('" + tt + "')").addClass('active');
|
||||
|
||||
var newChannel = chat.tabToChannel(tt);
|
||||
if (newChannel != oldChannel) setTimeout(chat.request,1);
|
||||
|
||||
$('#chat > div').hide();
|
||||
|
||||
var elm;
|
||||
|
Loading…
x
Reference in New Issue
Block a user