This is an issue where in jQuery v3 the result of outerHeight on a node
that doesn’t exist is now “undefined” rather than “null”, which means
it will no longer cast to a Number but rather NaN. For this, we create
the safeOuterHeight and safeOuterWidth functions to safely return a
result (or 0).
This is a better solution than manually going to each instance and
ORing it with 0 for type safety.
https://stackoverflow.com/questions/41454285/jquery-outerheight-returns-
undefined-instead-of-null
Rather than having get_stream_li() look up stream id using
stream name, we force the callers to pass in the stream id.
This adds an extra line to most of the callers for now, but
this will eventually change as we fix some of the callers to
have their callers pass in stream_id.
In places where we now call stream_data.get_stream_id() to
get the stream id, we will be more resilient toward stream
renamings, at least until the next reload, since
stream_data.get_stream_id() can resolve old names that
are stored when we process stream-rename events.
Despite the length of this commit, it is a very straightforward
moving of code from narrow.js -> narrow_state.js, and then
everything else is just s/narrow.foo()/narrow_state.foo()/
(with a few tiny cleanups to remove some code duplication
in certain callers).
The only new functions are simple setter/getters that
encapsulate the current_filter variable:
narrow_state.reset_current_filter()
narrow_state.set_current_filter()
narrow_state.get_current_filter()
We removed narrow.predicate() as part of this, since it was dead
code.
Also, we removed the shim for narrow_state.set_compose_defaults(),
and since that was the last shim, we removed shim.js from the app.
This fixes the mobile web experience for Chrome on iOS.
Apparently, Chrome-on-iOS silently has a `viewport` module that
overrides and user-defined module by that name, causing all of our
code that accesses the viewport module to not work on that platform.
We fix this by renaming it.
This restores the feature that hitting down when you are at the
last message automatically centers the last message. This is not
a pure revert, because some additional code now goes through
navigate.down.
(imported from commit 2db1f247692ba068613a2d6c93f18ca7c13a16b8)
We had a feature that if you hit the down arrow key when you
were at the last message, it would recenter you. Waseem has bought
into temporarily removing this feature. Justifications:
1) We can always put it back.
2) Autoscrolling makes it less relevant.
3) The feature complicated the code a bit.
4) The feature worked different for End than down arrow, due to
a FIXME.
5) It might have been a misfeature for users that want more
control over their own scrolling.
6) You can achieve the same essential effect by using PgDn
or space.
(imported from commit fa6874bb5d29d7057bb1601f0b6d577bac1272c7)