mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 10:58:20 -07:00
Fix issues in dfnshelper and inputManager
This commit is contained in:
parent
33855a655f
commit
89979a00a3
@ -51,8 +51,6 @@ const dateLocales = (locale) => ({
|
|||||||
})[locale];
|
})[locale];
|
||||||
|
|
||||||
export function getLocale() {
|
export function getLocale() {
|
||||||
console.warn(globalize.getCurrentLocale());
|
|
||||||
console.warn(dateLocales(globalize.getCurrentLocale()));
|
|
||||||
return dateLocales(globalize.getCurrentLocale()) || enUS;
|
return dateLocales(globalize.getCurrentLocale()) || enUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import appHost from 'apphost';
|
|||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
var lastInputTime = new Date().getTime();
|
let lastInputTime = new Date().getTime();
|
||||||
|
|
||||||
export function notify() {
|
export function notify() {
|
||||||
lastInputTime = new Date().getTime();
|
lastInputTime = new Date().getTime();
|
||||||
@ -25,7 +25,7 @@ import appHost from 'apphost';
|
|||||||
sourceElement.click();
|
sourceElement.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventListenerCount = 0;
|
let eventListenerCount = 0;
|
||||||
export function on(scope, fn) {
|
export function on(scope, fn) {
|
||||||
eventListenerCount++;
|
eventListenerCount++;
|
||||||
dom.addEventListener(scope, 'command', fn, {});
|
dom.addEventListener(scope, 'command', fn, {});
|
||||||
@ -38,12 +38,12 @@ import appHost from 'apphost';
|
|||||||
dom.removeEventListener(scope, 'command', fn, {});
|
dom.removeEventListener(scope, 'command', fn, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
var commandTimes = {};
|
let commandTimes = {};
|
||||||
|
|
||||||
function checkCommandTime(command) {
|
function checkCommandTime(command) {
|
||||||
|
|
||||||
var last = commandTimes[command] || 0;
|
let last = commandTimes[command] || 0;
|
||||||
var now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
|
|
||||||
if ((now - last) < 1000) {
|
if ((now - last) < 1000) {
|
||||||
return false;
|
return false;
|
||||||
@ -57,7 +57,7 @@ import appHost from 'apphost';
|
|||||||
|
|
||||||
lastInputTime = new Date().getTime();
|
lastInputTime = new Date().getTime();
|
||||||
|
|
||||||
var sourceElement = (options ? options.sourceElement : null);
|
let sourceElement = (options ? options.sourceElement : null);
|
||||||
|
|
||||||
if (sourceElement) {
|
if (sourceElement) {
|
||||||
sourceElement = focusManager.focusableParent(sourceElement);
|
sourceElement = focusManager.focusableParent(sourceElement);
|
||||||
@ -66,7 +66,7 @@ import appHost from 'apphost';
|
|||||||
if (!sourceElement) {
|
if (!sourceElement) {
|
||||||
sourceElement = document.activeElement || window;
|
sourceElement = document.activeElement || window;
|
||||||
|
|
||||||
var dlg = document.querySelector('.dialogContainer .dialog.opened');
|
const dlg = document.querySelector('.dialogContainer .dialog.opened');
|
||||||
|
|
||||||
if (dlg && (!sourceElement || !dlg.contains(sourceElement))) {
|
if (dlg && (!sourceElement || !dlg.contains(sourceElement))) {
|
||||||
sourceElement = dlg;
|
sourceElement = dlg;
|
||||||
@ -74,7 +74,7 @@ import appHost from 'apphost';
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (eventListenerCount) {
|
if (eventListenerCount) {
|
||||||
var customEvent = new CustomEvent("command", {
|
const customEvent = new CustomEvent("command", {
|
||||||
detail: {
|
detail: {
|
||||||
command: commandName
|
command: commandName
|
||||||
},
|
},
|
||||||
@ -82,7 +82,7 @@ import appHost from 'apphost';
|
|||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
var eventResult = sourceElement.dispatchEvent(customEvent);
|
const eventResult = sourceElement.dispatchEvent(customEvent);
|
||||||
if (!eventResult) {
|
if (!eventResult) {
|
||||||
// event cancelled
|
// event cancelled
|
||||||
return;
|
return;
|
||||||
@ -227,10 +227,10 @@ import appHost from 'apphost';
|
|||||||
}
|
}
|
||||||
})[command];
|
})[command];
|
||||||
|
|
||||||
try {
|
if (keyActions(commandName) === undefined) {
|
||||||
keyActions(commandName).call();
|
|
||||||
} catch (error) {
|
|
||||||
console.debug(`inputManager: tried to process command with no action assigned: ${commandName}`);
|
console.debug(`inputManager: tried to process command with no action assigned: ${commandName}`);
|
||||||
|
} else {
|
||||||
|
keyActions(commandName).call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user