From 17b685c3ae1f70bda4aa0780266324a61175fd69 Mon Sep 17 00:00:00 2001 From: Gerome Matilla Date: Tue, 9 Jun 2020 15:55:50 +0800 Subject: [PATCH] fix searchbox not hiding if weatherscreen is opened, code clenaup --- js/dashboard.js | 12 ++++++------ js/mobile-swipe-callback.js | 2 +- js/weather-screen.js | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/js/dashboard.js b/js/dashboard.js index f6edebf..d1fe210 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -4,7 +4,7 @@ class Dashboard { this._dashboard = document.querySelector('#rightDashboard'); this._dashboardOverlay = document.querySelector('#dashboardOverlay'); - this.rightDashboardVisibility = false; + this._rightDashboardVisibility = false; this._dashboardOverlayMouseUpEvent = this._dashboardOverlayMouseUpEvent.bind(this); @@ -26,7 +26,7 @@ class Dashboard { } getRightDashboardVisibility = () => { - return this.rightDashboardVisibility; + return this._rightDashboardVisibility; } showDashboard = () => { @@ -38,7 +38,7 @@ class Dashboard { // Enable Inputs this._disableDashboardInputs(false); - this.rightDashboardVisibility = !this.rightDashboardVisibility; + this._rightDashboardVisibility = !this._rightDashboardVisibility; } hideDashboard = () => { @@ -51,14 +51,14 @@ class Dashboard { // Hide overlay this._dashboardOverlay.classList.remove('showDashboardOverlay'); - this.rightDashboardVisibility = !this.rightDashboardVisibility; + this._rightDashboardVisibility = !this._rightDashboardVisibility; } toggleDashboard = () => { console.log('toggle dashboard'); - if (this.rightDashboardVisibility) { + if (this._rightDashboardVisibility) { // Hide dashboard this.hideDashboard(); @@ -101,7 +101,7 @@ class Dashboard { } _dashboardOverlayMouseUpEvent = e => { - if (this.rightDashboardVisibility) { + if (this._rightDashboardVisibility) { this.toggleDashboard(); } console.log('dashboard overlay clicked...'); diff --git a/js/mobile-swipe-callback.js b/js/mobile-swipe-callback.js index 216f440..380aaaa 100644 --- a/js/mobile-swipe-callback.js +++ b/js/mobile-swipe-callback.js @@ -28,7 +28,7 @@ class SwipeEventCallbacks extends SwipeEventManager { _rightDashboardSwipeEvent = (el, d) => { // Swipe right will close dashboard - if (d === "right") { + if (d === 'right') { dashboard.toggleDashboard(); } } diff --git a/js/weather-screen.js b/js/weather-screen.js index a455d61..9f5c3f3 100644 --- a/js/weather-screen.js +++ b/js/weather-screen.js @@ -273,12 +273,11 @@ class WeatherScreen { } else if (this._searchBoxContainer.classList.contains('showSearchBox')) { console.log('searchbox is open, closing...'); - hideSearchBox(); + searchBoxShow.hideSearchBox(); } else if (this._dashboard.classList.contains('showRightDashboard')) { console.log('dashboard is open, closing...'); dashboard.hideDashboard(); - // return; } // Toggle center box