PgUp, PgDn will already call the scroll handler, which will
of its own accord call keep_pointer_in_view.
(imported from commit 8b6e53eaeda91d0f35775de72e16d63dc6c8340b)
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)
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)
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)
This allows us to put other stuff in the narrowbox and have
it also magically get resized. At least in theory.
(imported from commit 92975e3d0893b34d52cad910462cbf2ccaed2eab)
There were two issues:
* The people_list population changed and I failed to noticed
* Typeahead source updating never worked before because calling .typeahead()
more than once does not change the data source
(imported from commit fda14029f4cd37260d82e7bb5689f5022e1b0d28)
This also makes the people_list a list of objects containing the person's full name and email.
(imported from commit cff9b3de8cab0c9b2690ffa60d65d666302b989f)
When Bootstrap shrinks the divs down into 'tablet' mode, our selected
message might end up being even lower in the screen than it was before
(because more text wraps). But our scrollbar does not automatically
advance to keep it in view -- so we do it manually.
This implementation is a little hackish in that it does some
unnecessary recenter_view-ing in big views (which can be a touch
disorienting) to optimize recentering on resizing for small views.
If that behavior is annoying, we can deal with it by being
smarter about when we trigger the recenter code.
(imported from commit 6834e11f7a37833982c388f15174df661d7f55b3)