diff --git a/src/libraries/screensavermanager.js b/src/libraries/screensavermanager.js index 557b31e0f4..ca35d38a98 100644 --- a/src/libraries/screensavermanager.js +++ b/src/libraries/screensavermanager.js @@ -1,5 +1,5 @@ -define(["events", "playbackManager", "pluginManager", "inputManager", "connectionManager", "userSettings"], function (events, playbackManager, pluginManager, inputManager, connectionManager, userSettings) { - "use strict"; +define(['events', 'playbackManager', 'pluginManager', 'inputManager', 'connectionManager', 'userSettings'], function (events, playbackManager, pluginManager, inputManager, connectionManager, userSettings) { + 'use strict'; playbackManager = playbackManager.default || playbackManager; @@ -15,23 +15,22 @@ define(["events", "playbackManager", "pluginManager", "inputManager", "connectio return new Date().getTime() - lastFunctionalEvent; } - events.on(playbackManager, "playbackstop", function (e, stopInfo) { + events.on(playbackManager, 'playbackstop', function (e, stopInfo) { var state = stopInfo.state; - if (state.NowPlayingItem && state.NowPlayingItem.MediaType == "Video") { + if (state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') { lastFunctionalEvent = new Date().getTime(); } }); function getScreensaverPlugin(isLoggedIn) { - var option; try { - option = userSettings.get("screensaver", false); + option = userSettings.get('screensaver', false); } catch (err) { - option = isLoggedIn ? "backdropscreensaver" : "logoscreensaver"; + option = isLoggedIn ? 'backdropscreensaver' : 'logoscreensaver'; } - var plugins = pluginManager.ofType("screensaver"); + var plugins = pluginManager.ofType('screensaver'); for (var i = 0, length = plugins.length; i < length; i++) { var plugin = plugins[i]; @@ -45,42 +44,40 @@ define(["events", "playbackManager", "pluginManager", "inputManager", "connectio } function ScreenSaverManager() { - var self = this; var activeScreenSaver; function showScreenSaver(screensaver) { - if (activeScreenSaver) { - throw new Error("An existing screensaver is already active."); + throw new Error('An existing screensaver is already active.'); } - console.debug("Showing screensaver " + screensaver.name); + console.debug('Showing screensaver ' + screensaver.name); screensaver.show(); activeScreenSaver = screensaver; if (screensaver.hideOnClick !== false) { - window.addEventListener("click", hide, true); + window.addEventListener('click', hide, true); } if (screensaver.hideOnMouse !== false) { - window.addEventListener("mousemove", hide, true); + window.addEventListener('mousemove', hide, true); } if (screensaver.hideOnKey !== false) { - window.addEventListener("keydown", hide, true); + window.addEventListener('keydown', hide, true); } } function hide() { if (activeScreenSaver) { - console.debug("Hiding screensaver"); + console.debug('Hiding screensaver'); activeScreenSaver.hide(); activeScreenSaver = null; } - window.removeEventListener("click", hide, true); - window.removeEventListener("mousemove", hide, true); - window.removeEventListener("keydown", hide, true); + window.removeEventListener('click', hide, true); + window.removeEventListener('mousemove', hide, true); + window.removeEventListener('keydown', hide, true); } self.isShowing = function () { @@ -107,7 +104,6 @@ define(["events", "playbackManager", "pluginManager", "inputManager", "connectio }; function onInterval() { - if (self.isShowing()) { return; }