mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
bunch of js === and !== fixes
This commit is contained in:
parent
4800f9e486
commit
1899902860
@ -102,9 +102,9 @@ export function Keypad(__keys_parent, __sendKey, __apply_fixes) {
|
||||
let code = event.code;
|
||||
if (__apply_fixes) {
|
||||
// https://github.com/pikvm/pikvm/issues/819
|
||||
if (code == "IntlBackslash" && ["`", "~"].includes(event.key)) {
|
||||
if (code === "IntlBackslash" && ["`", "~"].includes(event.key)) {
|
||||
code = "Backquote";
|
||||
} else if (code == "Backquote" && ["§", "±"].includes(event.key)) {
|
||||
} else if (code === "Backquote" && ["§", "±"].includes(event.key)) {
|
||||
code = "IntlBackslash";
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ export function Keypad(__keys_parent, __sendKey, __apply_fixes) {
|
||||
};
|
||||
|
||||
var __fixMacCmd = function(code, state) {
|
||||
if ((code == "MetaLeft" || code == "MetaRight") && !state) {
|
||||
if ((code === "MetaLeft" || code === "MetaRight") && !state) {
|
||||
for (code in __keys) {
|
||||
if (__isActive(__keys[code][0])) {
|
||||
self.emitByCode(code, false, false);
|
||||
|
||||
@ -319,7 +319,7 @@ export function Session() {
|
||||
var __ascii_encoder = new TextEncoder("ascii");
|
||||
|
||||
var __sendHidEvent = function(ws, event_type, event) {
|
||||
if (event_type == "key") {
|
||||
if (event_type === "key") {
|
||||
let data = __ascii_encoder.encode("\x01\x00" + event.key);
|
||||
data[1] = (event.state ? 1 : 0);
|
||||
if (event.finish === true) { // Optional
|
||||
@ -327,12 +327,12 @@ export function Session() {
|
||||
}
|
||||
ws.send(data);
|
||||
|
||||
} else if (event_type == "mouse_button") {
|
||||
} else if (event_type === "mouse_button") {
|
||||
let data = __ascii_encoder.encode("\x02\x00" + event.button);
|
||||
data[1] = (event.state ? 1 : 0);
|
||||
ws.send(data);
|
||||
|
||||
} else if (event_type == "mouse_move") {
|
||||
} else if (event_type === "mouse_move") {
|
||||
let data = new Uint8Array([
|
||||
3,
|
||||
(event.to.x >> 8) & 0xFF, event.to.x & 0xFF,
|
||||
@ -340,7 +340,7 @@ export function Session() {
|
||||
]);
|
||||
ws.send(data);
|
||||
|
||||
} else if (event_type == "mouse_relative" || event_type == "mouse_wheel") {
|
||||
} else if (event_type === "mouse_relative" || event_type === "mouse_wheel") {
|
||||
let data;
|
||||
if (Array.isArray(event.delta)) {
|
||||
data = new Int8Array(2 + event.delta.length * 2);
|
||||
@ -353,7 +353,7 @@ export function Session() {
|
||||
} else {
|
||||
data = new Int8Array([0, 0, event.delta.x, event.delta.y]);
|
||||
}
|
||||
data[0] = (event_type == "mouse_relative" ? 4 : 5);
|
||||
data[0] = (event_type === "mouse_relative" ? 4 : 5);
|
||||
data[1] = (event.squash ? 1 : 0);
|
||||
ws.send(data);
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ export function Streamer() {
|
||||
if (__streamer.getMode() === "janus") { // Right now it's working only for H.264
|
||||
let orient = parseInt(tools.radio.getValue("stream-orient-radio"));
|
||||
tools.storage.setInt("stream.orient", orient);
|
||||
if (__streamer.getOrientation() != orient) {
|
||||
if (__streamer.getOrientation() !== orient) {
|
||||
__resetStream();
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _
|
||||
// Chrome sends `muted` notifiation for tracks in `disconnected` ICE state
|
||||
// and Janus.js just removes muted track from list of available tracks.
|
||||
// But track still exists actually so it's safe to just ignore
|
||||
// reason == "mute" and "unmute".
|
||||
// reason === "mute" and "unmute".
|
||||
let reason = (meta || {}).reason;
|
||||
__logInfo("Got onremotetrack:", id, added, reason, track, meta);
|
||||
if (added && reason === "created") {
|
||||
|
||||
@ -334,7 +334,7 @@ export function Switch() {
|
||||
let content = "";
|
||||
let unit = -1;
|
||||
for (let port = 0; port < model.ports.length; ++port) {
|
||||
let pa = model.ports[port]; // pa == port attrs
|
||||
let pa = model.ports[port]; // pa === port attrs
|
||||
if (unit !== pa.unit) {
|
||||
unit = pa.unit;
|
||||
content += `${unit > 0 ? "<tr><td colspan=100><hr></td></tr>" : ""}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user