We'll use this internally for the commit bot. We might eventually disable it
for external users.
(imported from commit 3136cd9faadc6b81355889d2ee6472985da87fbe)
That andSelf is only necessary if a .recipient_row were immediately
followed by a .bookend_tr, which, I don't know, after a redesign could
very well be the case, so let's guard against it now, especially since
our performance on scroll is currently pretty good.
(imported from commit 1011555fbfd30943b4aa917997d6e35bcce959fc)
In my limited trial, this sped the call up, on average, from
0.507ms to 0.473 ms... so, admittedly, not a lot.
I think this is a little conceptually cleaner, though, and it handles
the common path with the least work, which I like.
(imported from commit c8b827a2e8111fbdd54bcabe05ac36f64523c466)
nextAll/prevAll walks the entire DOM, basically.
This code only walks the DOM until we find a new .message_row.
This speeds up the average time of a call to this function from about
6.38ms to 0.678ms, in my benchmarking.
Admittedly, the whole outer loop here could still use some
optimization, if we want to; do we really need to call this 1000
times?
(imported from commit 852e2f660a16f8cfd7be35d3271aedb1ac481663)
http://api.jquery.com/first-selector/ mentions that using ":first" in
query selectors can be a little slow since we can't use the browser's
native querySelectorForAll implementation.
In my tests, this cut the average time down from 6.70ms to 6.38ms.
So, not great, but this function is most frequently called
many times in a big while loop, so, better than nothing.
(imported from commit d7725edd0c81431829fe353c6dd2bc61b1de6b19)
If the client is not composing a message, we can just force a page
reload. However, if he is composing a message, we must preserve that
message while still reloading as soon as possible.
We take the following approach: if the client has not completed the
composition after 5 minutes, do a compose-preserving reload
(described below). If he sends the message before the timeout
expires, reload the page after a successful send. If the send fails
(not due to server timeout), however, we do a compose-perserving
reload in case the error was due to the data format changing. If the
send failed due to server timeout, we don't reload because the reload
will probably also fail.
In a compose-preserving reload, we redirect to an URI that has a
fragment indicating we are doing a reload and containing all the
necessary information for restoring the compose window to its
previous state. On page load, we check the fragment to see if we
just did a compose-preserving reload, and, if we did, we restore the
compose window (or just try the send again in the case of send
failure). The URI fragment looks like:
(imported from commit af4eeb3930c24118e088057d4da456748fbd2229)
There was this very cute problem where if you were narrowed and
scrolled to the top of the page, you couldn't seem to click on the
stream or subject name.
The issue was: the floating_recipient_row div was visibility: hidden,
which means that it made top_statusbar big enough to cover up that top
part, capturing the clicks.
So instead we make top_statusbar also visibility: hidden so that
the clicks get through.
(imported from commit 471e041ba1c429ad0b6e225da22585dc72120945)
Given that we now look at the top of the pointer rather than the
bottom for this check, our previous 4/5 number was far too permissive
(and led to your selected message often getting covered up by the
compose window).
Anecdotally, this feels a bit better to me.
(imported from commit 39ca7924db56272f7e623708ce0125b2a7012656)
In particular, we had this issue on huge messages. Suppose you had a
huge message and were scrolling up from the bottom. Initially it would
get selected as the message underneath it was below the
threshold. Then, when you scrolled again we said "oh, well, the top is
too tall, it's also *above* the threshold" and moved the pointer back
down. So it glitched back and forth.
Now we consider you above the view threshold by looking at your
bottom, and below the view threshold by looking at your top, which
seems to resolve this issue.
(imported from commit 2434d1103ab3fa894ade612ac1fb10b2f3cd66cf)
I think this'll allow for a slighlty more accurate drawing of our
floating recipient row in the even that some of these things have
borders and others don't.
(imported from commit 31714f7356604e1d9c64bcc7f6fd14b8a02a99b5)
If we make the recipient_rows the same size for huddles and stream
messages, this becomes a non-issue. (Previously, the border on huddles
was 2px, which I think caused our invisible row to have its height
grow by 1px -- which was a problem, because then it left a little 1px
gap that you could see through when we scrolled over non-huddle
messages.)
(imported from commit d1f24e5c536bdf9c0827a15b611ba680ee4e5e36)
I'm actually not sure if this is a performance gain or not; I guess it
depends if any of the stuff inside mousewheel or scroll took longer
than 50ms to call (and right now it does).
(imported from commit e3fcc4a14cd8787fa2357a43ed878ab08646e4f2)