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

@@ -14,7 +14,7 @@ exports.initialize = function () {
$('#gear-menu a[data-toggle="tab"]').on('show', function (e) {
// Save the position of our old tab away, before we switch
var old_tab = $(e.relatedTarget).attr('href');
scroll_positions[old_tab] = viewport.scrollTop();
scroll_positions[old_tab] = message_viewport.scrollTop();
});
$('#gear-menu a[data-toggle="tab"]').on('shown', function (e) {
var target_tab = $(e.target).attr('href');
@@ -36,12 +36,12 @@ exports.initialize = function () {
// (we apparently have to do this after setting the hash,
// because otherwise that action may scroll us somewhere.)
if (scroll_positions.hasOwnProperty(target_tab)) {
viewport.scrollTop(scroll_positions[target_tab]);
message_viewport.scrollTop(scroll_positions[target_tab]);
} else {
if (target_tab === '#home') {
navigate.scroll_to_selected();
} else {
viewport.scrollTop(0);
message_viewport.scrollTop(0);
}
}
});