mirror of https://github.com/zulip/zulip.git
scroll_bar: Initialize scroll_bar in ui_init.js.
This will help in making the order of ui modules initialization more explicit and clear.
This commit is contained in:
parent
e5d2e953bd
commit
9387efc399
|
@ -33,6 +33,7 @@
|
||||||
"popovers": false,
|
"popovers": false,
|
||||||
"server_events": false,
|
"server_events": false,
|
||||||
"server_events_dispatch": false,
|
"server_events_dispatch": false,
|
||||||
|
"scroll_bar": false,
|
||||||
"message_scroll": false,
|
"message_scroll": false,
|
||||||
"keydown_util": false,
|
"keydown_util": false,
|
||||||
"info_overlay": false,
|
"info_overlay": false,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
$(function () {
|
|
||||||
ui.set_up_scrollbar($("#stream-filters-container"));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
var scroll_bar = (function () {
|
||||||
|
|
||||||
|
var exports = {};
|
||||||
|
|
||||||
// From https://stackoverflow.com/questions/13382516/getting-scroll-bar-width-using-javascript
|
// From https://stackoverflow.com/questions/13382516/getting-scroll-bar-width-using-javascript
|
||||||
function getScrollbarWidth() {
|
function getScrollbarWidth() {
|
||||||
|
@ -29,9 +29,8 @@ function getScrollbarWidth() {
|
||||||
return widthNoScroll - widthWithScroll;
|
return widthNoScroll - widthWithScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.initialize = function () {
|
||||||
// Workaround for browsers with fixed scrollbars
|
// Workaround for browsers with fixed scrollbars
|
||||||
$(function () {
|
|
||||||
var sbWidth = getScrollbarWidth();
|
var sbWidth = getScrollbarWidth();
|
||||||
|
|
||||||
if (sbWidth > 0) {
|
if (sbWidth > 0) {
|
||||||
|
@ -59,4 +58,11 @@ $(function () {
|
||||||
"</style>");
|
"</style>");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
ui.set_up_scrollbar($("#stream-filters-container"));
|
||||||
|
};
|
||||||
|
|
||||||
|
return exports;
|
||||||
|
}());
|
||||||
|
if (typeof module !== 'undefined') {
|
||||||
|
module.exports = scroll_bar;
|
||||||
|
}
|
||||||
|
|
|
@ -275,6 +275,7 @@ function initialize_kitchen_sink_stuff() {
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
// initialize other stuff
|
// initialize other stuff
|
||||||
|
scroll_bar.initialize();
|
||||||
muting_ui.initialize();
|
muting_ui.initialize();
|
||||||
message_viewport.initialize();
|
message_viewport.initialize();
|
||||||
initialize_kitchen_sink_stuff();
|
initialize_kitchen_sink_stuff();
|
||||||
|
|
Loading…
Reference in New Issue