Fix Linting

This commit is contained in:
Cameron 2020-08-07 08:13:51 +01:00
parent 6eface9239
commit 0b786a5205

View File

@ -1,5 +1,5 @@
define(["events", "playbackManager", "pluginManager", "inputManager", "connectionManager", "userSettings"], function (events, playbackManager, pluginManager, inputManager, connectionManager, userSettings) { define(['events', 'playbackManager', 'pluginManager', 'inputManager', 'connectionManager', 'userSettings'], function (events, playbackManager, pluginManager, inputManager, connectionManager, userSettings) {
"use strict"; 'use strict';
playbackManager = playbackManager.default || playbackManager; playbackManager = playbackManager.default || playbackManager;
@ -15,23 +15,22 @@ define(["events", "playbackManager", "pluginManager", "inputManager", "connectio
return new Date().getTime() - lastFunctionalEvent; return new Date().getTime() - lastFunctionalEvent;
} }
events.on(playbackManager, "playbackstop", function (e, stopInfo) { events.on(playbackManager, 'playbackstop', function (e, stopInfo) {
var state = stopInfo.state; var state = stopInfo.state;
if (state.NowPlayingItem && state.NowPlayingItem.MediaType == "Video") { if (state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
lastFunctionalEvent = new Date().getTime(); lastFunctionalEvent = new Date().getTime();
} }
}); });
function getScreensaverPlugin(isLoggedIn) { function getScreensaverPlugin(isLoggedIn) {
var option; var option;
try { try {
option = userSettings.get("screensaver", false); option = userSettings.get('screensaver', false);
} catch (err) { } 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++) { for (var i = 0, length = plugins.length; i < length; i++) {
var plugin = plugins[i]; var plugin = plugins[i];
@ -45,42 +44,40 @@ define(["events", "playbackManager", "pluginManager", "inputManager", "connectio
} }
function ScreenSaverManager() { function ScreenSaverManager() {
var self = this; var self = this;
var activeScreenSaver; var activeScreenSaver;
function showScreenSaver(screensaver) { function showScreenSaver(screensaver) {
if (activeScreenSaver) { 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(); screensaver.show();
activeScreenSaver = screensaver; activeScreenSaver = screensaver;
if (screensaver.hideOnClick !== false) { if (screensaver.hideOnClick !== false) {
window.addEventListener("click", hide, true); window.addEventListener('click', hide, true);
} }
if (screensaver.hideOnMouse !== false) { if (screensaver.hideOnMouse !== false) {
window.addEventListener("mousemove", hide, true); window.addEventListener('mousemove', hide, true);
} }
if (screensaver.hideOnKey !== false) { if (screensaver.hideOnKey !== false) {
window.addEventListener("keydown", hide, true); window.addEventListener('keydown', hide, true);
} }
} }
function hide() { function hide() {
if (activeScreenSaver) { if (activeScreenSaver) {
console.debug("Hiding screensaver"); console.debug('Hiding screensaver');
activeScreenSaver.hide(); activeScreenSaver.hide();
activeScreenSaver = null; activeScreenSaver = null;
} }
window.removeEventListener("click", hide, true); window.removeEventListener('click', hide, true);
window.removeEventListener("mousemove", hide, true); window.removeEventListener('mousemove', hide, true);
window.removeEventListener("keydown", hide, true); window.removeEventListener('keydown', hide, true);
} }
self.isShowing = function () { self.isShowing = function () {
@ -107,7 +104,6 @@ define(["events", "playbackManager", "pluginManager", "inputManager", "connectio
}; };
function onInterval() { function onInterval() {
if (self.isShowing()) { if (self.isShowing()) {
return; return;
} }