11 Commits

Author SHA1 Message Date
Stefan Breunig
360f6f8336 rework chat handling completely
The old system was getting too complicated to add new features to.
The new one should be easier to understand and will be explained
below. This patch should fix #140 and fix #16.

There are several places where new data requests may come from:
- chat.needMoreMessages checks if we are scrolled too far up or
  there is no scrollbar. It then requests new messages.
- scrolling up
- switching the chat tab via chat.chooser
- auto refresh
- once on boot
The latter two always request both types of chat.

Faction and public are handled the same way. Public is later split
into categories. I will explain the faction chat here because it’s
easier.

It starts in chat.requestFaction. This will initialize the query to
the server for data. The exact query is determined by chat.
genPostData. There can only be one faction chat request at a time.
Clearing on map move is handled automatically in code/requests.js.

Let’s assume the data query is successful. It is now passed to
chat.handleFaction which runs some basic checks before the data is
processed and stored in chat._factionData. This is done by chat.
writeDataToHash. The hash keys are the message GUIDs to avoid
duplicates. The hash values are an array of timestamp, processed
message and other meta data.

There is only one way to render faction chat, so data is directly
handed to chat.renderFaction which immediately hands it to chat
.renderData. renderData discards the GUIDs and sorts the values
by their timestamp. It then iterates over the data to insert
date break lines and finally renders the data in the DOM. It also
does some magic to keep the correct scrolling position.

Chat data will be cleared on map move or zoom. However, the
display is not refreshed, so the old, invalid chat data is still
displayed. Only once the data query is finished the data is
rendered. The upside is that small map operations within your
local area appear to never lose their chat data. Downside is that
there’s invalid chat for some time when changing cities.
2013-02-13 02:52:27 +01:00
Stefan Breunig
4a45570f40 make more use of the empty space below the sidebar now that there’s a map rendered behind it all the time 2013-02-11 12:10:40 +01:00
Stefan Breunig
f5edc84635 add ability to filter by portal level. You can access the feature from the layer selector just as before. Fixes #8 and some of #12 2013-02-08 17:39:37 +01:00
Stefan Breunig
71bfeff678 remove array with portal details references that might have been leaking. Instead, store the details with the rendered portals so removal is handled automatically 2013-02-04 16:15:25 +01:00
Stefan Breunig
f85a3b2443 revert last commit, it broke scrolling. also replace expensive CSS rules with differen solution 2013-02-04 14:21:49 +01:00
Stefan Breunig
f92c963a54 finish chat feature; hide low level portal on zoom out; introduce render limit 2013-02-04 02:52:24 +01:00
Stefan Breunig
ecfaca7f9b more chat related stuff. public user chat and message posting is still missing though 2013-02-03 19:44:35 +01:00
Stefan Breunig
b7f1270ff6 make faction chat display almost work 2013-02-03 13:19:56 +01:00
Stefan Breunig
25d6b4cdc5 preliminary chat support 2013-02-01 22:27:43 +01:00
Stefan Breunig
50d21ce03a display which portals are being requested 2013-02-01 15:36:42 +01:00
Stefan Breunig
a07ee0cc3d so others may contribute 2013-02-01 13:11:14 +01:00