未验证 提交 1a0b640d 编写于 作者: S Surge 提交者: GitHub

Disable input sounds when in password mode (#1046)

* Extend file editing capabilities

* Add git files to the supported file types list

* Replace single filetype handling with MIME handling

* update submodules

* use mime.charset to tell which files are text-readable

* Stop sounds from playing on key press when in password mode

* Fix little mistake on line 347
Co-authored-by: NGaby <gabriel@saillard.dev>
Co-authored-by: NGabriel Saillard <gabriel@saillard.dev>
上级 6d55f137
...@@ -139,8 +139,8 @@ class Keyboard { ...@@ -139,8 +139,8 @@ class Keyboard {
// Keep focus on the terminal // Keep focus on the terminal
if (window.keyboard.linkedToTerm) window.term[window.currentTerm].term.focus(); if (window.keyboard.linkedToTerm) window.term[window.currentTerm].term.focus();
if (this.container.dataset.passwordMode == "false")
window.audioManager.granted.play(); window.audioManager.granted.play();
e.preventDefault(); e.preventDefault();
}; };
key.onmouseup = () => { key.onmouseup = () => {
...@@ -180,8 +180,8 @@ class Keyboard { ...@@ -180,8 +180,8 @@ class Keyboard {
// Keep focus on the terminal // Keep focus on the terminal
if (window.keyboard.linkedToTerm) window.term[window.currentTerm].term.focus(); if (window.keyboard.linkedToTerm) window.term[window.currentTerm].term.focus();
if(this.container.dataset.passwordMode == "false")
window.audioManager.stdin.play(); window.audioManager.stdin.play();
e.preventDefault(); e.preventDefault();
}; };
key.onmouseup = e => { key.onmouseup = e => {
...@@ -310,7 +310,8 @@ class Keyboard { ...@@ -310,7 +310,8 @@ class Keyboard {
// See #516 // See #516
if (e.repeat === false || (e.repeat === true && !e.code.startsWith('Shift') && !e.code.startsWith('Alt') && !e.code.startsWith('Control') && !e.code.startsWith('Caps'))) { if (e.repeat === false || (e.repeat === true && !e.code.startsWith('Shift') && !e.code.startsWith('Alt') && !e.code.startsWith('Control') && !e.code.startsWith('Caps'))) {
window.audioManager.stdin.play(); if(this.container.dataset.passwordMode == "false")
window.audioManager.stdin.play();
} }
}; };
...@@ -343,9 +344,8 @@ class Keyboard { ...@@ -343,9 +344,8 @@ class Keyboard {
}, 100); }, 100);
} }
if (e.key === "Enter") { if(this.container.dataset.passwordMode == "false" && e.key === "Enter")
window.audioManager.granted.play(); window.audioManager.granted.play();
}
}; };
window.addEventListener("blur", () => { window.addEventListener("blur", () => {
...@@ -558,6 +558,7 @@ class Keyboard { ...@@ -558,6 +558,7 @@ class Keyboard {
let d = this.container.dataset.passwordMode; let d = this.container.dataset.passwordMode;
(d === "true") ? d = "false" : d = "true"; (d === "true") ? d = "false" : d = "true";
this.container.dataset.passwordMode = d; this.container.dataset.passwordMode = d;
window.passwordMode = d;
return d; return d;
} }
addCircum(char) { addCircum(char) {
......
...@@ -190,7 +190,8 @@ class Terminal { ...@@ -190,7 +190,8 @@ class Terminal {
let d = Date.now(); let d = Date.now();
if (d - this.lastSoundFX > 30) { if (d - this.lastSoundFX > 30) {
window.audioManager.stdout.play(); if(window.passwordMode == "false")
window.audioManager.stdout.play();
this.lastSoundFX = d; this.lastSoundFX = d;
} }
if (d - this.lastRefit > 10000) { if (d - this.lastRefit > 10000) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册