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)