Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/night_mode.js to ES6 module.
Anders Kaseorg8a07ec536595
diff --git a/.eslintrc.json b/.eslintrc.jsonindex f5813d99f2e..5f3c657e395 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -166,7 +166,6 @@"message_util": false,"narrow": false,"navigate": false,- "night_mode": false,"notifications": false,"overlays": false,"padded_widget": false,diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.jsindex 0eae997bf95..e118d09af82 100644--- a/frontend_tests/node_tests/dispatch.js+++ b/frontend_tests/node_tests/dispatch.js@@ -38,7 +38,8 @@ const message_events = set_global("message_events", {});const message_list = set_global("message_list", {});const muting_ui = {__esModule: true};rewiremock("../../static/js/muting_ui").with(muting_ui);-const night_mode = set_global("night_mode", {});+const night_mode = {__esModule: true};+rewiremock("../../static/js/night_mode").with(night_mode);const notifications = set_global("notifications", {});const reactions = set_global("reactions", {});const realm_icon = set_global("realm_icon", {});diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex 3ae9535d282..e67fc38b46c 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -27,7 +27,6 @@ import "../reload";import "../compose_actions";import "../subs";import "../ui";-import "../night_mode";import "../ui_util";import "../click_handlers";import "../settings_panel_menu";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex 924ea34e5a1..688e11bbaa9 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -40,7 +40,6 @@ declare let message_store: any;declare let message_util: any;declare let narrow: any;declare let navigate: any;-declare let night_mode: any;declare let notifications: any;declare let overlays: any;declare let padded_widget: any;diff --git a/static/js/night_mode.js b/static/js/night_mode.jsindex 9cbf9157a96..da6869c6d5e 100644--- a/static/js/night_mode.js+++ b/static/js/night_mode.js@@ -1,15 +1,11 @@-"use strict";--exports.enable = function () {+export function enable() {$("body").removeClass("color-scheme-automatic").addClass("night-mode");-};+}-exports.disable = function () {+export function disable() {$("body").removeClass("color-scheme-automatic").removeClass("night-mode");-};+}-exports.default_preference_checker = function () {+export function default_preference_checker() {$("body").removeClass("night-mode").addClass("color-scheme-automatic");-};--window.night_mode = exports;+}diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.jsindex cd46acd8318..07edad28e0f 100644--- a/static/js/server_events_dispatch.js+++ b/static/js/server_events_dispatch.js@@ -7,6 +7,7 @@ import * as markdown from "./markdown";import * as message_edit from "./message_edit";import * as muting_ui from "./muting_ui";import * as narrow_state from "./narrow_state";+import * as night_mode from "./night_mode";import * as peer_data from "./peer_data";import * as people from "./people";import * as reload from "./reload";diff --git a/static/js/zcommand.js b/static/js/zcommand.jsindex f43f2c8f71d..28ee951a11b 100644--- a/static/js/zcommand.js+++ b/static/js/zcommand.js@@ -3,6 +3,7 @@ import marked from "../third/marked/lib/marked";import * as channel from "./channel";import * as common from "./common";import * as feedback_widget from "./feedback_widget";+import * as night_mode from "./night_mode";/*