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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:00:07 -08:00 committed by Tim Abbott
parent 3a90ec30d5
commit 8a07ec5365
7 changed files with 10 additions and 14 deletions

View File

@ -166,7 +166,6 @@
"message_util": false, "message_util": false,
"narrow": false, "narrow": false,
"navigate": false, "navigate": false,
"night_mode": false,
"notifications": false, "notifications": false,
"overlays": false, "overlays": false,
"padded_widget": false, "padded_widget": false,

View File

@ -38,7 +38,8 @@ const message_events = set_global("message_events", {});
const message_list = set_global("message_list", {}); const message_list = set_global("message_list", {});
const muting_ui = {__esModule: true}; const muting_ui = {__esModule: true};
rewiremock("../../static/js/muting_ui").with(muting_ui); 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 notifications = set_global("notifications", {});
const reactions = set_global("reactions", {}); const reactions = set_global("reactions", {});
const realm_icon = set_global("realm_icon", {}); const realm_icon = set_global("realm_icon", {});

View File

@ -27,7 +27,6 @@ import "../reload";
import "../compose_actions"; import "../compose_actions";
import "../subs"; import "../subs";
import "../ui"; import "../ui";
import "../night_mode";
import "../ui_util"; import "../ui_util";
import "../click_handlers"; import "../click_handlers";
import "../settings_panel_menu"; import "../settings_panel_menu";

View File

@ -40,7 +40,6 @@ declare let message_store: any;
declare let message_util: any; declare let message_util: any;
declare let narrow: any; declare let narrow: any;
declare let navigate: any; declare let navigate: any;
declare let night_mode: any;
declare let notifications: any; declare let notifications: any;
declare let overlays: any; declare let overlays: any;
declare let padded_widget: any; declare let padded_widget: any;

View File

@ -1,15 +1,11 @@
"use strict"; export function enable() {
exports.enable = function () {
$("body").removeClass("color-scheme-automatic").addClass("night-mode"); $("body").removeClass("color-scheme-automatic").addClass("night-mode");
}; }
exports.disable = function () { export function disable() {
$("body").removeClass("color-scheme-automatic").removeClass("night-mode"); $("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"); $("body").removeClass("night-mode").addClass("color-scheme-automatic");
}; }
window.night_mode = exports;

View File

@ -7,6 +7,7 @@ import * as markdown from "./markdown";
import * as message_edit from "./message_edit"; import * as message_edit from "./message_edit";
import * as muting_ui from "./muting_ui"; import * as muting_ui from "./muting_ui";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import * as night_mode from "./night_mode";
import * as peer_data from "./peer_data"; import * as peer_data from "./peer_data";
import * as people from "./people"; import * as people from "./people";
import * as reload from "./reload"; import * as reload from "./reload";

View File

@ -3,6 +3,7 @@ import marked from "../third/marked/lib/marked";
import * as channel from "./channel"; import * as channel from "./channel";
import * as common from "./common"; import * as common from "./common";
import * as feedback_widget from "./feedback_widget"; import * as feedback_widget from "./feedback_widget";
import * as night_mode from "./night_mode";
/* /*