mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 02:53:52 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user