1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Force the use of single quotes

This commit is contained in:
MrTimscampi 2020-05-04 12:44:12 +02:00
parent 8b6dc05d64
commit 9e3ca706c4
217 changed files with 8541 additions and 8540 deletions

View file

@ -3,49 +3,49 @@
* @module components/input/keyboardnavigation
*/
import inputManager from "inputManager";
import layoutManager from "layoutManager";
import inputManager from 'inputManager';
import layoutManager from 'layoutManager';
/**
* Key name mapping.
*/
const KeyNames = {
13: "Enter",
19: "Pause",
27: "Escape",
32: "Space",
37: "ArrowLeft",
38: "ArrowUp",
39: "ArrowRight",
40: "ArrowDown",
13: 'Enter',
19: 'Pause',
27: 'Escape',
32: 'Space',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
// MediaRewind (Tizen/WebOS)
412: "MediaRewind",
412: 'MediaRewind',
// MediaStop (Tizen/WebOS)
413: "MediaStop",
413: 'MediaStop',
// MediaPlay (Tizen/WebOS)
415: "MediaPlay",
415: 'MediaPlay',
// MediaFastForward (Tizen/WebOS)
417: "MediaFastForward",
417: 'MediaFastForward',
// Back (WebOS)
461: "Back",
461: 'Back',
// Back (Tizen)
10009: "Back",
10009: 'Back',
// MediaTrackPrevious (Tizen)
10232: "MediaTrackPrevious",
10232: 'MediaTrackPrevious',
// MediaTrackNext (Tizen)
10233: "MediaTrackNext",
10233: 'MediaTrackNext',
// MediaPlayPause (Tizen)
10252: "MediaPlayPause"
10252: 'MediaPlayPause'
};
/**
* Keys used for keyboard navigation.
*/
const NavigationKeys = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"];
const NavigationKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
let hasFieldKey = false;
try {
hasFieldKey = "key" in new KeyboardEvent("keydown");
hasFieldKey = 'key' in new KeyboardEvent('keydown');
} catch (e) {
console.error("error checking 'key' field");
}
@ -78,7 +78,7 @@ export function isNavigationKey(key) {
}
export function enable() {
document.addEventListener("keydown", function (e) {
document.addEventListener('keydown', function (e) {
const key = getKeyName(e);
// Ignore navigation keys for non-TV
@ -89,54 +89,54 @@ export function enable() {
let capture = true;
switch (key) {
case "ArrowLeft":
inputManager.handle("left");
case 'ArrowLeft':
inputManager.handle('left');
break;
case "ArrowUp":
inputManager.handle("up");
case 'ArrowUp':
inputManager.handle('up');
break;
case "ArrowRight":
inputManager.handle("right");
case 'ArrowRight':
inputManager.handle('right');
break;
case "ArrowDown":
inputManager.handle("down");
case 'ArrowDown':
inputManager.handle('down');
break;
case "Back":
inputManager.handle("back");
case 'Back':
inputManager.handle('back');
break;
case "Escape":
case 'Escape':
if (layoutManager.tv) {
inputManager.handle("back");
inputManager.handle('back');
} else {
capture = false;
}
break;
case "MediaPlay":
inputManager.handle("play");
case 'MediaPlay':
inputManager.handle('play');
break;
case "Pause":
inputManager.handle("pause");
case 'Pause':
inputManager.handle('pause');
break;
case "MediaPlayPause":
inputManager.handle("playpause");
case 'MediaPlayPause':
inputManager.handle('playpause');
break;
case "MediaRewind":
inputManager.handle("rewind");
case 'MediaRewind':
inputManager.handle('rewind');
break;
case "MediaFastForward":
inputManager.handle("fastforward");
case 'MediaFastForward':
inputManager.handle('fastforward');
break;
case "MediaStop":
inputManager.handle("stop");
case 'MediaStop':
inputManager.handle('stop');
break;
case "MediaTrackPrevious":
inputManager.handle("previoustrack");
case 'MediaTrackPrevious':
inputManager.handle('previoustrack');
break;
case "MediaTrackNext":
inputManager.handle("nexttrack");
case 'MediaTrackNext':
inputManager.handle('nexttrack');
break;
default:
@ -144,7 +144,7 @@ export function enable() {
}
if (capture) {
console.debug("disabling default event handling");
console.debug('disabling default event handling');
e.preventDefault();
}
});
@ -153,14 +153,14 @@ export function enable() {
// Gamepad initialisation. No script is required if no gamepads are present at init time, saving a bit of resources.
// Whenever the gamepad is connected, we hand all the control of the gamepad to gamepadtokey.js by removing the event handler
function attachGamepadScript(e) {
console.log("Gamepad connected! Attaching gamepadtokey.js script");
window.removeEventListener("gamepadconnected", attachGamepadScript);
require(["scripts/gamepadtokey"]);
console.log('Gamepad connected! Attaching gamepadtokey.js script');
window.removeEventListener('gamepadconnected', attachGamepadScript);
require(['scripts/gamepadtokey']);
}
// No need to check for gamepads manually at load time, the eventhandler will be fired for that
if (navigator.getGamepads) { /* eslint-disable-line compat/compat */
window.addEventListener("gamepadconnected", attachGamepadScript);
window.addEventListener('gamepadconnected', attachGamepadScript);
}
export default {