Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Disable input sounds when in password mode (#1046)
Browse files Browse the repository at this point in the history
* 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: Gaby <gabriel@saillard.dev>

Co-authored-by: Gabriel Saillard <gabriel@saillard.dev>
  • Loading branch information
Animus-Surge and GitSquared authored Feb 17, 2021
1 parent 6d55f13 commit 1a0b640
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/classes/keyboard.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class Keyboard {

// Keep focus on the terminal
if (window.keyboard.linkedToTerm) window.term[window.currentTerm].term.focus();

window.audioManager.granted.play();
if (this.container.dataset.passwordMode == "false")
window.audioManager.granted.play();
e.preventDefault();
};
key.onmouseup = () => {
Expand Down Expand Up @@ -180,8 +180,8 @@ class Keyboard {

// Keep focus on the terminal
if (window.keyboard.linkedToTerm) window.term[window.currentTerm].term.focus();

window.audioManager.stdin.play();
if(this.container.dataset.passwordMode == "false")
window.audioManager.stdin.play();
e.preventDefault();
};
key.onmouseup = e => {
Expand Down Expand Up @@ -310,7 +310,8 @@ class Keyboard {

// 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'))) {
window.audioManager.stdin.play();
if(this.container.dataset.passwordMode == "false")
window.audioManager.stdin.play();
}
};

Expand Down Expand Up @@ -343,9 +344,8 @@ class Keyboard {
}, 100);
}

if (e.key === "Enter") {
if(this.container.dataset.passwordMode == "false" && e.key === "Enter")
window.audioManager.granted.play();
}
};

window.addEventListener("blur", () => {
Expand Down Expand Up @@ -558,6 +558,7 @@ class Keyboard {
let d = this.container.dataset.passwordMode;
(d === "true") ? d = "false" : d = "true";
this.container.dataset.passwordMode = d;
window.passwordMode = d;
return d;
}
addCircum(char) {
Expand Down
3 changes: 2 additions & 1 deletion src/classes/terminal.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ class Terminal {
let d = Date.now();

if (d - this.lastSoundFX > 30) {
window.audioManager.stdout.play();
if(window.passwordMode == "false")
window.audioManager.stdout.play();
this.lastSoundFX = d;
}
if (d - this.lastRefit > 10000) {
Expand Down

0 comments on commit 1a0b640

Please sign in to comment.