From 714b166035f71a2707ff7485a94254c9f82df6aa Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 29 Sep 2017 09:13:21 -0400 Subject: [PATCH] sidebar is only available in newer ff versions --- src/services/lockService.js | 15 +++++++++++++-- src/services/utilsService.js | 11 ----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/services/lockService.js b/src/services/lockService.js index 78d463be72..d77b1adab3 100644 --- a/src/services/lockService.js +++ b/src/services/lockService.js @@ -24,8 +24,8 @@ function initLockService(self) { self.lastLockCheck = now; var popupOpen = chrome.extension.getViews({ type: 'popup' }).length > 0; - var sidebarViewName = self.utilsService.sidebarViewName(); - var sidebarOpen = sidebarViewName && chrome.extension.getViews({ type: sidebarViewName }).length > 0; + var sidebarView = sidebarViewName(self.utilsService); + var sidebarOpen = sidebarView && chrome.extension.getViews({ type: sidebarView }).length > 0; if (popupOpen || sidebarOpen) { // Do not lock @@ -133,4 +133,15 @@ function initLockService(self) { return deferred.promise; } + + function sidebarViewName(utilsService) { + if (chrome.sidebarAction && utilsService.isFirefox()) { + return 'sidebar'; + } + else if (utilsService.isOpera() && (typeof opr !== 'undefined') && opr.sidebarAction) { + return 'sidebar_panel'; + } + + return null; + }; } diff --git a/src/services/utilsService.js b/src/services/utilsService.js index cdafd55824..4f64d4931f 100644 --- a/src/services/utilsService.js +++ b/src/services/utilsService.js @@ -232,17 +232,6 @@ function initUtilsService() { return theWindow.location.search && theWindow.location.search.indexOf('sidebar=true') > -1; }; - UtilsService.prototype.sidebarViewName = function () { - if (this.isFirefox()) { - return 'sidebar'; - } - else if (this.isOpera()) { - return 'sidebar_panel'; - } - - return null; - }; - function validIpAddress(ipString) { var ipRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; return ipRegex.test(ipString);