From 997080593875d2457e59f881974f54efc0e67a22 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 26 Oct 2017 20:20:01 +0200 Subject: [PATCH] Scrutinizer fixes --- Animation/Canvas/ParticleAnimation.js | 2 ++ Event/EventManager.js | 2 +- Message/Notification/Browser/BrowserNotification.js | 2 ++ Message/Request/OSType.enum.js | 3 ++- Message/Request/Request.js | 5 +++++ UI/Component/Input.js | 3 ++- UI/GeneralUI.js | 1 + UI/Input/Touch/TouchManager.js | 3 ++- UI/Input/Voice/ReadManager.js | 9 +++++++++ UI/UIManager.js | 1 + UnhandledException.js | 1 + Views/FormView.js | 2 ++ 12 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Animation/Canvas/ParticleAnimation.js b/Animation/Canvas/ParticleAnimation.js index 661d10a..26deb82 100644 --- a/Animation/Canvas/ParticleAnimation.js +++ b/Animation/Canvas/ParticleAnimation.js @@ -25,6 +25,8 @@ { this.canvas = canvas; this.ctx = canvas.getContext('2d'); + + /** global: screen */ this.width = screen.width; this.height = screen.height; diff --git a/Event/EventManager.js b/Event/EventManager.js index 159f157..59ff8d2 100644 --- a/Event/EventManager.js +++ b/Event/EventManager.js @@ -153,7 +153,7 @@ * @param {string|int} group Group id * @param {function} callback Callback * @param {boolean} remove Should be removed after execution - * @param {boolean} remove Reset after triggering + * @param {boolean} reset Reset after triggering * * @return {void} * diff --git a/Message/Notification/Browser/BrowserNotification.js b/Message/Notification/Browser/BrowserNotification.js index 742b6a0..d2a738d 100644 --- a/Message/Notification/Browser/BrowserNotification.js +++ b/Message/Notification/Browser/BrowserNotification.js @@ -27,6 +27,7 @@ { const self = this; + /** global: Notification */ if(Notification.permission !== 'granted' && Notification.permission !== 'denied') { Notification.requestPermission(function(permission) { if(permission === 'granted') { @@ -40,6 +41,7 @@ jsOMS.Message.Notification.Browser.BrowserNotification.prototype.send = function(msg) { + /** global: Notification */ let n = new Notification(/* ... */); }; }(window.jsOMS = window.jsOMS || {})); \ No newline at end of file diff --git a/Message/Request/OSType.enum.js b/Message/Request/OSType.enum.js index c9bee05..aa4a39d 100644 --- a/Message/Request/OSType.enum.js +++ b/Message/Request/OSType.enum.js @@ -37,6 +37,7 @@ IPAD: 'ipad', /* IPad */ ANDROID: 'android', /* Android */ BLACKBERRY: 'blackberry', /* Blackberry */ - MOBILE: 'webos' /* Mobile */ + MOBILE: 'webos', /* Mobile */ + UNKNOWN: 'UNKNOWN' /* Unknown */ }); }(window.jsOMS = window.jsOMS || {})); diff --git a/Message/Request/Request.js b/Message/Request/Request.js index 083307d..c5a2162 100644 --- a/Message/Request/Request.js +++ b/Message/Request/Request.js @@ -48,6 +48,8 @@ */ jsOMS.Message.Request.Request.getBrowser = function () { + /** global: InstallTrigger */ + /** global: navigator */ if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) { return jsOMS.Message.Request.BrowserType.OPERA; } else if (typeof InstallTrigger !== 'undefined') { @@ -78,11 +80,14 @@ { for (let os in jsOMS.Message.Request.OSType) { if (jsOMS.Message.Request.OSType.hasOwnProperty(os)) { + /** global: navigator */ if (navigator.appVersion.toLowerCase().indexOf(jsOMS.Message.Request.OSType[os]) !== -1) { return jsOMS.Message.Request.OSType[os]; } } } + + return jsOMS.Message.Request.OSType.UNKNOWN; }; /** diff --git a/UI/Component/Input.js b/UI/Component/Input.js index 98d7b29..d943cc7 100644 --- a/UI/Component/Input.js +++ b/UI/Component/Input.js @@ -23,6 +23,7 @@ jsOMS.UI.Input.unbind = function (input) { this.app.inputManager.getKeyboardManager().unbind(input); + /** global: changeBind */ input.removeEventListener('change', changeBind, false); }; @@ -69,6 +70,7 @@ break; case 'table': break; + default: } } }); @@ -133,7 +135,6 @@ } } catch (exception) { jsOMS.Log.Logger.instance.error('Invalid JSON object: ' + xhr, 'FormManager'); - return false; } }); diff --git a/UI/GeneralUI.js b/UI/GeneralUI.js index e78855a..12c433d 100644 --- a/UI/GeneralUI.js +++ b/UI/GeneralUI.js @@ -80,6 +80,7 @@ e = e !== null ? e.querySelectorAll('[data-lazyload]') : document.querySelectorAll('[data-lazyload]'); const length = e.length; + /** global: IntersectionObserver */ if(!this.visObs && window.IntersectionObserver) { this.visObs = new IntersectionObserver(function(eles, obs) { eles.forEach(ele => { diff --git a/UI/Input/Touch/TouchManager.js b/UI/Input/Touch/TouchManager.js index e7f7f39..5665915 100644 --- a/UI/Input/Touch/TouchManager.js +++ b/UI/Input/Touch/TouchManager.js @@ -94,7 +94,7 @@ touch.pageX, // screenX - the page X coordinate touch.pageY, // screenY - the page Y coordinate touch.pageX, // clientX - the window X coordinate - toch.pageY, // clientY - the window Y coordinate + touch.pageY, // clientY - the window Y coordinate false, // ctrlKey false, // altKey false, // shiftKey @@ -105,6 +105,7 @@ document.dispatchEvent(rightClick); } else if (elapsedTime < 500) { + /** global: Event */ const e = new Event('keyup'); if (distY > 100) { diff --git a/UI/Input/Voice/ReadManager.js b/UI/Input/Voice/ReadManager.js index 74de2c7..eef9d5c 100644 --- a/UI/Input/Voice/ReadManager.js +++ b/UI/Input/Voice/ReadManager.js @@ -14,8 +14,16 @@ jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Voice'); // todo: remove once obsolete + /** global: webkitSpeechRecognition */ + /** global: SpeechRecognition */ var SpeechRecognition = typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : typeof webkitSpeechRecognition !== 'undefined' ? webkitSpeechRecognition : null; + + /** global: webkitSpeechGrammarList */ + /** global: SpeechGrammarList */ var SpeechGrammarList = typeof SpeechGrammarList !== 'undefined' ? SpeechGrammarList : typeof webkitSpeechGrammarList !== 'undefined' ? webkitSpeechGrammarList : null; + + /** global: webkitSpeechRecognitionEvent */ + /** global: SpeechRecognitionEvent */ var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null; /** @@ -48,6 +56,7 @@ */ jsOMS.UI.Input.Voice.ReadManager.prototype.read = function(text) { + /** global: SpeechSynthesisUtterance */ let utter = new SpeechSynthesisUtterance(text); utter.lang = this.lang; utter.voice = this.voice; diff --git a/UI/UIManager.js b/UI/UIManager.js index 79354e1..76da7e1 100644 --- a/UI/UIManager.js +++ b/UI/UIManager.js @@ -31,6 +31,7 @@ this.generalUI = new jsOMS.UI.GeneralUI(); const self = this; + /** global: MutationObserver */ this.domObserver = new MutationObserver(function(mutations) { const length = mutations.length; diff --git a/UnhandledException.js b/UnhandledException.js index 7efdfee..e7500d8 100644 --- a/UnhandledException.js +++ b/UnhandledException.js @@ -13,6 +13,7 @@ "use strict"; window.addEventListener('error', function (e) { + /** global: jsOMS */ jsOMS.Log.Logger.instance.error(e.error); return false; diff --git a/Views/FormView.js b/Views/FormView.js index 2acbc82..228b181 100644 --- a/Views/FormView.js +++ b/Views/FormView.js @@ -292,6 +292,7 @@ case 'button': this.bindButton(elements[i]); break; + default: } } }; @@ -320,6 +321,7 @@ case 'button': this.bindButton(elements[i]); break; + default: } } };