js: Rename viewport.js to message_viewport.js.

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 commit is contained in:
Tim Abbott
2017-03-10 14:48:51 -08:00
parent b1f12133be
commit 5e39ccd642
21 changed files with 67 additions and 65 deletions

View File

@@ -76,7 +76,7 @@ exports.fast_forward_pointer = function () {
};
exports.keep_pointer_in_view = function () {
// See viewport.recenter_view() for related logic to keep the pointer onscreen.
// See message_viewport.recenter_view() for related logic to keep the pointer onscreen.
// This function mostly comes into place for mouse scrollers, and it
// keeps the pointer in view. For people who purely scroll with the
// mouse, the pointer is kind of meaningless to them, but keyboard
@@ -89,12 +89,12 @@ exports.keep_pointer_in_view = function () {
return;
}
var info = viewport.message_viewport_info();
var info = message_viewport.message_viewport_info();
var top_threshold = info.visible_top + (1/10 * info.visible_height);
var bottom_threshold = info.visible_top + (9/10 * info.visible_height);
function message_is_far_enough_down() {
if (viewport.at_top()) {
if (message_viewport.at_top()) {
return true;
}
@@ -120,7 +120,7 @@ exports.keep_pointer_in_view = function () {
}
function message_is_far_enough_up() {
return viewport.at_bottom() ||
return message_viewport.at_bottom() ||
(next_row.offset().top <= bottom_threshold);
}