js: Convert static/js/scroll_bar.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:01:53 -08:00 committed by Tim Abbott
parent 5b647e3d72
commit fb93be0d94
9 changed files with 12 additions and 14 deletions

View File

@ -179,7 +179,6 @@
"realm_night_logo": false,
"recent_topics": false,
"reminder": false,
"scroll_bar": false,
"search": false,
"search_pill_widget": false,
"search_suggestion": false,

View File

@ -46,7 +46,8 @@ const realm_icon = set_global("realm_icon", {});
const realm_logo = set_global("realm_logo", {});
const reload = {__esModule: true};
rewiremock("../../static/js/reload").with(reload);
const scroll_bar = set_global("scroll_bar", {});
const scroll_bar = {__esModule: true};
rewiremock("../../static/js/scroll_bar").with(scroll_bar);
const settings_account = set_global("settings_account", {});
const settings_bots = set_global("settings_bots", {});
const settings_display = set_global("settings_display", {});

View File

@ -86,7 +86,7 @@ rewiremock("../../static/js/message_viewport").with(message_viewport);
set_global("panels", {initialize() {}});
set_global("popovers", {initialize() {}});
rewiremock("../../static/js/reload").with({initialize() {}});
set_global("scroll_bar", {initialize() {}});
rewiremock("../../static/js/scroll_bar").with({initialize() {}});
const server_events = set_global("server_events", {initialize() {}});
set_global("settings_sections", {initialize() {}});
rewiremock("../../static/js/settings_panel_menu").with({initialize() {}});

View File

@ -27,7 +27,6 @@ import "../reload";
import "../compose_actions";
import "../subs";
import "../ui";
import "../scroll_bar";
import "../gear_menu";
import "../stream_popover";
import "../popovers";

View File

@ -52,7 +52,6 @@ declare let realm_icon: any;
declare let realm_logo: any;
declare let recent_topics: any;
declare let reminder: any;
declare let scroll_bar: any;
declare let search: any;
declare let search_pill_widget: any;
declare let search_suggestion: any;

View File

@ -1,6 +1,5 @@
"use strict";
import {media_breakpoints} from "./css_variables";
const {media_breakpoints} = require("./css_variables");
// A few of our width properties in Zulip depend on the width of the
// browser scrollbar that is generated at the far right side of the
// page, which unfortunately varies depending on the browser and
@ -35,7 +34,7 @@ function getScrollbarWidth() {
let sbWidth;
exports.initialize = function () {
export function initialize() {
// Workaround for browsers with fixed scrollbars
sbWidth = getScrollbarWidth();
@ -71,10 +70,10 @@ exports.initialize = function () {
"</style>",
);
}
exports.set_layout_width();
};
set_layout_width();
}
exports.set_layout_width = function () {
export function set_layout_width() {
// This logic unfortunately leads to a flash of mispositioned
// content when reloading a Zulip browser window. More details
// are available in the comments on the max-width of 1400px in
@ -90,6 +89,4 @@ exports.set_layout_width = function () {
$(".fixed-app .app-main").css("max-width", 1400 + sbWidth + "px");
$("#compose-container").css("max-width", 1400 + sbWidth + "px");
}
};
window.scroll_bar = exports;
}

View File

@ -11,6 +11,7 @@ import * as night_mode from "./night_mode";
import * as peer_data from "./peer_data";
import * as people from "./people";
import * as reload from "./reload";
import * as scroll_bar from "./scroll_bar";
import * as settings_config from "./settings_config";
import * as stream_data from "./stream_data";
import * as stream_events from "./stream_events";

View File

@ -31,6 +31,7 @@ const pm_list = require("./pm_list");
const reload = require("./reload");
const resize = require("./resize");
const rows = require("./rows");
const scroll_bar = require("./scroll_bar");
const sent_messages = require("./sent_messages");
const settings_panel_menu = require("./settings_panel_menu");
const settings_toggle = require("./settings_toggle");

View File

@ -4,6 +4,7 @@ import * as channel from "./channel";
import * as common from "./common";
import * as feedback_widget from "./feedback_widget";
import * as night_mode from "./night_mode";
import * as scroll_bar from "./scroll_bar";
/*