From 09e12affe8d5bb5218e70eeea6faa5e004c39a1d Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 18 Feb 2019 11:18:32 +0200 Subject: [PATCH 001/111] Begin moving windows to Vue --- client/components/App.vue | 14 +- client/components/RevealPassword.vue | 33 ++ client/components/Windows/Changelog.vue | 42 ++ client/components/Windows/Help.vue | 655 ++++++++++++++++++++++ client/components/Windows/NetworkEdit.vue | 243 ++++++++ client/components/Windows/Settings.vue | 415 ++++++++++++++ client/components/Windows/SignIn.vue | 104 ++++ client/css/style.css | 11 +- client/js/lounge.js | 3 +- client/js/socket-events/auth.js | 42 +- client/js/socket-events/configuration.js | 4 - client/js/socket-events/init.js | 1 - client/js/socket-events/network.js | 2 - client/js/utils.js | 20 - client/js/vue.js | 7 + client/views/reveal-password.tpl | 3 - client/views/windows/changelog.tpl | 20 - client/views/windows/connect.tpl | 114 ---- client/views/windows/help.tpl | 608 -------------------- client/views/windows/settings.tpl | 239 -------- client/views/windows/sign_in.tpl | 17 - 21 files changed, 1516 insertions(+), 1081 deletions(-) create mode 100644 client/components/RevealPassword.vue create mode 100644 client/components/Windows/Changelog.vue create mode 100644 client/components/Windows/Help.vue create mode 100644 client/components/Windows/NetworkEdit.vue create mode 100644 client/components/Windows/Settings.vue create mode 100644 client/components/Windows/SignIn.vue delete mode 100644 client/views/reveal-password.tpl delete mode 100644 client/views/windows/changelog.tpl delete mode 100644 client/views/windows/connect.tpl delete mode 100644 client/views/windows/help.tpl delete mode 100644 client/views/windows/settings.tpl delete mode 100644 client/views/windows/sign_in.tpl diff --git a/client/components/App.vue b/client/components/App.vue index 76820e4d..211b785a 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -64,13 +64,10 @@ -
-
-
-
-
+ :channel="activeChannel.channel" /> +
@@ -80,14 +77,17 @@ const throttle = require("lodash/throttle"); import NetworkList from "./NetworkList.vue"; import Chat from "./Chat.vue"; +import SignIn from "./Windows/SignIn.vue"; export default { name: "App", components: { NetworkList, Chat, + SignIn, }, props: { + activeWindow: String, activeChannel: Object, networks: Array, }, diff --git a/client/components/RevealPassword.vue b/client/components/RevealPassword.vue new file mode 100644 index 00000000..1c629077 --- /dev/null +++ b/client/components/RevealPassword.vue @@ -0,0 +1,33 @@ + + + diff --git a/client/components/Windows/Changelog.vue b/client/components/Windows/Changelog.vue new file mode 100644 index 00000000..448bb969 --- /dev/null +++ b/client/components/Windows/Changelog.vue @@ -0,0 +1,42 @@ + + + diff --git a/client/components/Windows/Help.vue b/client/components/Windows/Help.vue new file mode 100644 index 00000000..a4dfb02f --- /dev/null +++ b/client/components/Windows/Help.vue @@ -0,0 +1,655 @@ + + + diff --git a/client/components/Windows/NetworkEdit.vue b/client/components/Windows/NetworkEdit.vue new file mode 100644 index 00000000..e6cf4a37 --- /dev/null +++ b/client/components/Windows/NetworkEdit.vue @@ -0,0 +1,243 @@ + + + diff --git a/client/components/Windows/Settings.vue b/client/components/Windows/Settings.vue new file mode 100644 index 00000000..5448cf64 --- /dev/null +++ b/client/components/Windows/Settings.vue @@ -0,0 +1,415 @@ + diff --git a/client/js/options.js b/client/js/options.js index edd3df8b..8bfe5408 100644 --- a/client/js/options.js +++ b/client/js/options.js @@ -116,8 +116,6 @@ function applySetting(name, value) { if (("Notification" in window) && value && Notification.permission !== "granted") { Notification.requestPermission(updateDesktopNotificationStatus); } - } else if (name === "advanced") { - $("#settings [data-advanced]").toggle(settings[name]); } } @@ -219,6 +217,7 @@ function initialize() { vueApp.desktopNotificationState = "unsupported"; } + /* $settings.on("change", "input, select, textarea", function(e) { // We only want to trigger on human triggered changes. if (e.originalEvent) { @@ -238,27 +237,10 @@ function initialize() { } } }); + */ // Local init is done, let's sync // We always ask for synced settings even if it is disabled. // Settings can be mandatory to sync and it is used to determine sync base state. socket.emit("setting:get"); - - // Protocol handler - const defaultClientButton = $("#make-default-client"); - - if (window.navigator.registerProtocolHandler) { - defaultClientButton.on("click", function() { - const uri = document.location.origin + document.location.pathname + "?uri=%s"; - - window.navigator.registerProtocolHandler("irc", uri, "The Lounge"); - window.navigator.registerProtocolHandler("ircs", uri, "The Lounge"); - - return false; - }); - - $("#native-app").prop("hidden", false); - } else { - defaultClientButton.hide(); - } } diff --git a/client/js/socket-events/change_password.js b/client/js/socket-events/change_password.js deleted file mode 100644 index 09bb144e..00000000 --- a/client/js/socket-events/change_password.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -const $ = require("jquery"); -const socket = require("../socket"); - -socket.on("change-password", function(data) { - const passwordForm = $("#change-password"); - - if (data.error || data.success) { - const message = data.success ? data.success : data.error; - const feedback = passwordForm.find(".feedback"); - - if (data.success) { - feedback.addClass("success").removeClass("error"); - } else { - feedback.addClass("error").removeClass("success"); - } - - feedback.text(message).show(); - feedback.closest("form").one("submit", function() { - feedback.hide(); - }); - } - - passwordForm - .find("input") - .val("") - .end() - .find(".btn") - .prop("disabled", false); -}); diff --git a/client/js/socket-events/configuration.js b/client/js/socket-events/configuration.js index 8fef5fcc..5fba3be6 100644 --- a/client/js/socket-events/configuration.js +++ b/client/js/socket-events/configuration.js @@ -39,12 +39,6 @@ socket.on("configuration", function(data) { socket.emit("sessions:get"); }); - $("#play").on("click", () => { - const pop = new Audio(); - pop.src = "audio/pop.wav"; - pop.play(); - }); - if (data.fileUpload) { upload.initialize(data.fileUploadMaxFileSize); } @@ -62,6 +56,7 @@ socket.on("configuration", function(data) { document.querySelector('meta[name="theme-color"]').content = currentTheme.themeColor; } + /* function handleFormSubmit() { const form = $(this); const event = form.data("event"); @@ -79,10 +74,9 @@ socket.on("configuration", function(data) { return false; } + */ - $("#change-password form").on("submit", handleFormSubmit); - connect.on("submit", "form", handleFormSubmit); - + // TODO: move to component (this mirrors the nick to the username field if the username is empty) connect.on("show", function() { connect .html(templates.windows.connect(data)) diff --git a/src/server.js b/src/server.js index bf7191ea..6e49bc1a 100644 --- a/src/server.js +++ b/src/server.js @@ -423,16 +423,9 @@ function initializeClient(socket, client, token, lastMessage, openChannel) { const p1 = data.new_password; const p2 = data.verify_password; - if (typeof p1 === "undefined" || p1 === "") { + if (typeof p1 === "undefined" || p1 === "" || p1 !== p2) { socket.emit("change-password", { - error: "Please enter a new password", - }); - return; - } - - if (p1 !== p2) { - socket.emit("change-password", { - error: "Both new password fields must match", + error: "", }); return; } @@ -442,8 +435,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) { .then((matching) => { if (!matching) { socket.emit("change-password", { - error: - "The current password field does not match your account password", + error: "password_incorrect", }); return; } @@ -454,9 +446,9 @@ function initializeClient(socket, client, token, lastMessage, openChannel) { const obj = {}; if (success) { - obj.success = "Successfully updated your password"; + obj.success = true; } else { - obj.error = "Failed to update your password"; + obj.error = "update_failed"; } socket.emit("change-password", obj); From 2ef3e3e5b42610483a19b6b229e6f5f5fd30408c Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Sun, 3 Mar 2019 17:27:57 +0200 Subject: [PATCH 012/111] Add success: false to change-password error emits. --- src/server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index 6e49bc1a..70566c71 100644 --- a/src/server.js +++ b/src/server.js @@ -426,6 +426,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) { if (typeof p1 === "undefined" || p1 === "" || p1 !== p2) { socket.emit("change-password", { error: "", + success: false, }); return; } @@ -436,6 +437,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) { if (!matching) { socket.emit("change-password", { error: "password_incorrect", + success: false, }); return; } @@ -443,7 +445,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) { const hash = Helper.password.hash(p1); client.setPassword(hash, (success) => { - const obj = {}; + const obj = {success: false}; if (success) { obj.success = true; From 111beb5f1224c9dec1d9549490abed8dcee4feb5 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Sun, 3 Mar 2019 18:28:57 +0200 Subject: [PATCH 013/111] Run updateSetting from Settings component and get rid of unused code. --- client/components/App.vue | 1 + client/components/Windows/Settings.vue | 10 +-- client/js/options.js | 87 ++++-------------------- client/js/socket-events/configuration.js | 20 ------ 4 files changed, 18 insertions(+), 100 deletions(-) diff --git a/client/components/App.vue b/client/components/App.vue index 6b531255..ca5d990a 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -1,4 +1,5 @@ diff --git a/client/components/Windows/Changelog.vue b/client/components/Windows/Changelog.vue index 449b62e1..04d705ff 100644 --- a/client/components/Windows/Changelog.vue +++ b/client/components/Windows/Changelog.vue @@ -5,10 +5,7 @@ aria-label="Changelog" >
-
diff --git a/client/components/Windows/Settings.vue b/client/components/Windows/Settings.vue index 2c754340..b8a0283b 100644 --- a/client/components/Windows/Settings.vue +++ b/client/components/Windows/Settings.vue @@ -6,10 +6,7 @@ aria-label="Settings" >
-
{ require("./socket-events"); - const slideoutMenu = require("./slideout"); const contextMenuFactory = require("./contextMenuFactory"); - const storage = require("./localStorage"); const utils = require("./utils"); require("./webpush"); require("./keybinds"); @@ -20,40 +18,6 @@ window.vueMounted = () => { const sidebar = $("#sidebar, #footer"); const viewport = $("#viewport"); - function storeSidebarVisibility(name, state) { - storage.set(name, state); - - vueApp.$emit("resize"); - } - - // If sidebar overlay is visible and it is clicked, close the sidebar - $("#sidebar-overlay").on("click", () => { - slideoutMenu.toggle(false); - - if ($(window).outerWidth() > utils.mobileViewportPixels) { - storeSidebarVisibility("thelounge.state.sidebar", false); - } - }); - - $("#windows").on("click", "button.lt", () => { - const isOpen = !slideoutMenu.isOpen(); - - slideoutMenu.toggle(isOpen); - - if ($(window).outerWidth() > utils.mobileViewportPixels) { - storeSidebarVisibility("thelounge.state.sidebar", isOpen); - } - }); - - viewport.on("click", ".rt", function() { - const isOpen = !viewport.hasClass("userlist-open"); - - viewport.toggleClass("userlist-open", isOpen); - storeSidebarVisibility("thelounge.state.userlist", isOpen); - - return false; - }); - viewport.on("contextmenu", ".network .chan", function(e) { return contextMenuFactory.createContextMenu($(this), e).show(); }); @@ -138,8 +102,8 @@ window.vueMounted = () => { socket.emit("open", channel ? channel.channel.id : null); - if ($(window).outerWidth() <= utils.mobileViewportPixels) { - slideoutMenu.toggle(false); + if (!keepSidebarOpen && $(window).outerWidth() <= utils.mobileViewportPixels) { + vueApp.setSidebar(false); } } else { vueApp.activeChannel = null; diff --git a/client/js/slideout.js b/client/js/slideout.js index f285ac3b..ecab355b 100644 --- a/client/js/slideout.js +++ b/client/js/slideout.js @@ -1,112 +1,112 @@ "use strict"; -const viewport = document.getElementById("viewport"); -const menu = document.getElementById("sidebar"); -const sidebarOverlay = document.getElementById("sidebar-overlay"); - -let touchStartPos = null; -let touchCurPos = null; -let touchStartTime = 0; -let menuWidth = 0; -let menuIsOpen = false; -let menuIsMoving = false; -let menuIsAbsolute = false; - class SlideoutMenu { - static enable() { - document.body.addEventListener("touchstart", onTouchStart, {passive: true}); + enable() { + this.viewport = document.getElementById("viewport"); + this.menu = document.getElementById("sidebar"); + this.sidebarOverlay = document.getElementById("sidebar-overlay"); + + this.touchStartPos = null; + this.touchCurPos = null; + this.touchStartTime = 0; + this.menuWidth = 0; + this.menuIsOpen = false; + this.menuIsMoving = false; + this.menuIsAbsolute = false; + + this.onTouchStart = (e) => { + this.touchStartPos = this.touchCurPos = e.touches.item(0); + + if (e.touches.length !== 1) { + this.onTouchEnd(); + return; + } + + const styles = window.getComputedStyle(this.menu); + + this.menuWidth = parseFloat(styles.width); + this.menuIsAbsolute = styles.position === "absolute"; + + if (!this.menuIsOpen || this.touchStartPos.screenX > this.menuWidth) { + this.touchStartTime = Date.now(); + + document.body.addEventListener("touchmove", this.onTouchMove, {passive: true}); + document.body.addEventListener("touchend", this.onTouchEnd, {passive: true}); + } + }; + + this.onTouchMove = (e) => { + const touch = this.touchCurPos = e.touches.item(0); + let distX = touch.screenX - this.touchStartPos.screenX; + const distY = touch.screenY - this.touchStartPos.screenY; + + if (!this.menuIsMoving) { + // tan(45°) is 1. Gestures in 0°-45° (< 1) are considered horizontal, so + // menu must be open; gestures in 45°-90° (>1) are considered vertical, so + // chat windows must be scrolled. + if (Math.abs(distY / distX) >= 1) { + this.onTouchEnd(); + return; + } + + const devicePixelRatio = window.devicePixelRatio || 2; + + if (Math.abs(distX) > devicePixelRatio) { + this.viewport.classList.toggle("menu-dragging", true); + this.menuIsMoving = true; + } + } + + // Do not animate the menu on desktop view + if (!this.menuIsAbsolute) { + return; + } + + if (this.menuIsOpen) { + distX += this.menuWidth; + } + + if (distX > this.menuWidth) { + distX = this.menuWidth; + } else if (distX < 0) { + distX = 0; + } + + this.menu.style.transform = "translate3d(" + distX + "px, 0, 0)"; + this.sidebarOverlay.style.opacity = distX / this.menuWidth; + }; + + this.onTouchEnd = () => { + const diff = this.touchCurPos.screenX - this.touchStartPos.screenX; + const absDiff = Math.abs(diff); + + if (absDiff > this.menuWidth / 2 || Date.now() - this.touchStartTime < 180 && absDiff > 50) { + this.toggle(diff > 0); + } + + document.body.removeEventListener("touchmove", this.onTouchMove); + document.body.removeEventListener("touchend", this.onTouchEnd); + this.viewport.classList.toggle("menu-dragging", false); + this.menu.style.transform = null; + this.sidebarOverlay.style.opacity = null; + + this.touchStartPos = null; + this.touchCurPos = null; + this.touchStartTime = 0; + this.menuIsMoving = false; + }; + + document.body.addEventListener("touchstart", this.onTouchStart, {passive: true}); } - static toggle(state) { - menuIsOpen = state; - viewport.classList.toggle("menu-open", state); + toggle(state) { + this.menuIsOpen = state; + this.viewport.classList.toggle("menu-open", state); } - static isOpen() { - return menuIsOpen; + isOpen() { + return this.menuIsOpen; } } -function onTouchStart(e) { - touchStartPos = touchCurPos = e.touches.item(0); - - if (e.touches.length !== 1) { - onTouchEnd(); - return; - } - - const styles = window.getComputedStyle(menu); - - menuWidth = parseFloat(styles.width); - menuIsAbsolute = styles.position === "absolute"; - - if (!menuIsOpen || touchStartPos.screenX > menuWidth) { - touchStartTime = Date.now(); - - document.body.addEventListener("touchmove", onTouchMove, {passive: true}); - document.body.addEventListener("touchend", onTouchEnd, {passive: true}); - } -} - -function onTouchMove(e) { - const touch = (touchCurPos = e.touches.item(0)); - let distX = touch.screenX - touchStartPos.screenX; - const distY = touch.screenY - touchStartPos.screenY; - - if (!menuIsMoving) { - // tan(45°) is 1. Gestures in 0°-45° (< 1) are considered horizontal, so - // menu must be open; gestures in 45°-90° (>1) are considered vertical, so - // chat windows must be scrolled. - if (Math.abs(distY / distX) >= 1) { - onTouchEnd(); - return; - } - - const devicePixelRatio = window.devicePixelRatio || 2; - - if (Math.abs(distX) > devicePixelRatio) { - viewport.classList.toggle("menu-dragging", true); - menuIsMoving = true; - } - } - - // Do not animate the menu on desktop view - if (!menuIsAbsolute) { - return; - } - - if (menuIsOpen) { - distX += menuWidth; - } - - if (distX > menuWidth) { - distX = menuWidth; - } else if (distX < 0) { - distX = 0; - } - - menu.style.transform = "translate3d(" + distX + "px, 0, 0)"; - sidebarOverlay.style.opacity = distX / menuWidth; -} - -function onTouchEnd() { - const diff = touchCurPos.screenX - touchStartPos.screenX; - const absDiff = Math.abs(diff); - - if (absDiff > menuWidth / 2 || (Date.now() - touchStartTime < 180 && absDiff > 50)) { - SlideoutMenu.toggle(diff > 0); - } - - document.body.removeEventListener("touchmove", onTouchMove); - document.body.removeEventListener("touchend", onTouchEnd); - viewport.classList.toggle("menu-dragging", false); - menu.style.transform = null; - sidebarOverlay.style.opacity = null; - - touchStartPos = null; - touchCurPos = null; - touchStartTime = 0; - menuIsMoving = false; -} - -module.exports = SlideoutMenu; +module.exports = (new SlideoutMenu); diff --git a/client/js/socket-events/init.js b/client/js/socket-events/init.js index ac90434f..40d1de23 100644 --- a/client/js/socket-events/init.js +++ b/client/js/socket-events/init.js @@ -4,7 +4,6 @@ const $ = require("jquery"); const escape = require("css.escape"); const socket = require("../socket"); const webpush = require("../webpush"); -const slideoutMenu = require("../slideout"); const sidebar = $("#sidebar"); const storage = require("../localStorage"); const utils = require("../utils"); @@ -21,7 +20,7 @@ socket.on("init", function(data) { vueApp.currentUserVisibleError = null; if (!vueApp.initialized) { - vueApp.initialized = true; + vueApp.onSocketInit(); if (data.token) { storage.set("token", data.token); @@ -29,14 +28,11 @@ socket.on("init", function(data) { webpush.configurePushNotifications(data.pushSubscription, data.applicationServerKey); - slideoutMenu.enable(); - - const viewport = $("#viewport"); - const viewportWidth = $(window).outerWidth(); + const viewportWidth = window.outerWidth; let isUserlistOpen = storage.get("thelounge.state.userlist"); if (viewportWidth > utils.mobileViewportPixels) { - slideoutMenu.toggle(storage.get("thelounge.state.sidebar") !== "false"); + vueApp.setSidebar(storage.get("thelounge.state.sidebar") !== "false"); } // If The Lounge is opened on a small screen (less than 1024px), and we don't have stored @@ -45,7 +41,7 @@ socket.on("init", function(data) { isUserlistOpen = "true"; } - viewport.toggleClass("userlist-open", isUserlistOpen === "true"); + vueApp.setUserlist(isUserlistOpen === "true"); $(document.body).removeClass("signed-out"); $("#loading").remove(); diff --git a/client/js/store.js b/client/js/store.js index bab7f57d..f334fa65 100644 --- a/client/js/store.js +++ b/client/js/store.js @@ -1,5 +1,6 @@ import Vue from "vue"; import Vuex from "vuex"; +const storage = require("./localStorage"); Vue.use(Vuex); @@ -9,6 +10,8 @@ export default new Vuex.Store({ isNotified: false, activeWindow: null, sessions: [], + sidebarOpen: false, + userlistOpen: storage.get("thelounge.state.userlist") !== "false", }, mutations: { isConnected(state, payload) { @@ -26,6 +29,12 @@ export default new Vuex.Store({ sessions(state, payload) { state.sessions = payload; }, + sidebarOpen(state, payload) { + state.sidebarOpen = payload; + }, + userlistOpen(state, payload) { + state.userlistOpen = payload; + }, }, getters: { currentSession: (state) => state.sessions.find((item) => item.current), diff --git a/client/js/vue.js b/client/js/vue.js index 2bec7e5e..cbd2cf33 100644 --- a/client/js/vue.js +++ b/client/js/vue.js @@ -7,6 +7,8 @@ const roundBadgeNumber = require("./libs/handlebars/roundBadgeNumber"); const localetime = require("./libs/handlebars/localetime"); const friendlysize = require("./libs/handlebars/friendlysize"); const colorClass = require("./libs/handlebars/colorClass"); +const slideoutMenu = require("../js/slideout"); +const storage = require("./localStorage"); Vue.filter("localetime", localetime); Vue.filter("friendlysize", friendlysize); @@ -48,6 +50,38 @@ const vueApp = new Vue({ mounted() { Vue.nextTick(() => window.vueMounted()); }, + methods: { + onSocketInit() { + this.initialized = true; + this.$store.commit("isConnected", true); + + // TODO: handle slideut in vue + slideoutMenu.enable(); + }, + setSidebar(state) { + const utils = require("./utils"); + + this.$store.commit("sidebarOpen", state); + slideoutMenu.toggle(false); + + if (window.outerWidth > utils.mobileViewportPixels) { + storage.set("thelounge.state.sidebar", state); + } + + this.$emit("resize"); + }, + toggleSidebar() { + this.setSidebar(!this.$store.state.sidebarOpen); + }, + setUserlist(state) { + storage.set("thelounge.state.userlist", state); + this.$store.commit("userlistOpen", state); + this.$emit("resize"); + }, + toggleUserlist() { + this.setUserlist(!this.$store.state.userlistOpen); + }, + }, render(createElement) { return createElement(App, { ref: "app", From 7fd48d8155b20deb077812826c7a361e5295e8ac Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 2 Aug 2019 15:53:31 +0300 Subject: [PATCH 017/111] Fix enabling and disabling push notifications. --- client/components/Windows/Settings.vue | 11 ++++++++++- client/js/webpush.js | 13 ++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/components/Windows/Settings.vue b/client/components/Windows/Settings.vue index b8a0283b..ed33cc3e 100644 --- a/client/components/Windows/Settings.vue +++ b/client/components/Windows/Settings.vue @@ -264,8 +264,9 @@ id="pushNotifications" type="button" class="btn" - disabled + :disabled="$root.pushNotificationState !== 'supported'" data-text-alternate="Unsubscribe from push notifications" + @click="onPushButtonClick" >Subscribe to push notifications
diff --git a/client/js/webpush.js b/client/js/webpush.js index 4e757cf1..5b55b8aa 100644 --- a/client/js/webpush.js +++ b/client/js/webpush.js @@ -67,13 +67,16 @@ module.exports.initialize = () => { alternatePushButton(); } }); - }).catch(() => { - vueApp.pushNotificationState = "unsupported"; - }); + }) + .catch(() => { + vueApp.pushNotificationState = "unsupported"; + }); } }; -function onPushButton() { +module.exports.onPushButton = () => { + // TODO: move dom logic to Settings.vue + pushNotificationsButton = $("#pushNotifications"); pushNotificationsButton.prop("disabled", true); navigator.serviceWorker.ready @@ -127,7 +130,7 @@ function onPushButton() { }); return false; -} +}; function alternatePushButton() { const text = pushNotificationsButton.text(); From addd4124bf00f11ba33e47f3bba303727d39ce36 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 2 Aug 2019 16:12:01 +0300 Subject: [PATCH 018/111] Close sidebar when opening settings, help etc. --- client/js/lounge.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/js/lounge.js b/client/js/lounge.js index dafb6011..5a1062c0 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -108,6 +108,10 @@ window.vueMounted = () => { } else { vueApp.activeChannel = null; vueApp.$store.commit("activeWindow", target); + + if (!keepSidebarOpen && $(window).outerWidth() <= utils.mobileViewportPixels) { + vueApp.setSidebar(false); + } } utils.synchronizeNotifiedState(); From b994ecd1f13183cffe16dad0f1243d9ec380bd66 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 2 Aug 2019 16:29:30 +0300 Subject: [PATCH 019/111] Fix hash navigation for sidebar footer buttons. --- client/components/Sidebar.vue | 12 ++++++++---- client/js/lounge.js | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/components/Sidebar.vue b/client/components/Sidebar.vue index 0f3a2170..e7445bcb 100644 --- a/client/components/Sidebar.vue +++ b/client/components/Sidebar.vue @@ -25,7 +25,8 @@ aria-label="Sign in" >