mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add keyboard compatibility for older browsers (webOS 2/3)
This commit is contained in:
parent
1889dad8cc
commit
ec6ce5aa14
3 changed files with 24 additions and 8 deletions
|
@ -27,6 +27,20 @@ define(["inputManager", "layoutManager"], function (inputManager, layoutManager)
|
|||
10252: "MediaPlayPause" // MediaPlayPause (Tizen)
|
||||
};
|
||||
|
||||
var hasFieldKey = false;
|
||||
try {
|
||||
hasFieldKey = "key" in new KeyboardEvent("keydown");
|
||||
} catch (e) {
|
||||
console.log("error checking 'key' field");
|
||||
}
|
||||
|
||||
if (!hasFieldKey) {
|
||||
// Add [a..z]
|
||||
for (var i = 65; i <= 90; i++) {
|
||||
KeyNames[i] = String.fromCharCode(i).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns key name from event.
|
||||
*
|
||||
|
@ -104,6 +118,7 @@ define(["inputManager", "layoutManager"], function (inputManager, layoutManager)
|
|||
}
|
||||
|
||||
return {
|
||||
enable: enable
|
||||
enable: enable,
|
||||
getKeyName: getKeyName
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue