Skip to content

Commit 72dbf36

Browse files
authored
Merge pull request soyaine#10 from sunha1yang/master
upd: 修改编码格式 + fix const重复声明
2 parents a56542d + 66e6674 commit 72dbf36

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

01 - JavaScript Drum Kit/index-draft.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
}
7070

7171
function removeTransition(e) {
72-
if(e.propertyName != 'border-left-color') return;
72+
if(e.propertyName !== 'border-left-color') return;
7373
this.classList.remove('playing');
7474
}
7575

@@ -85,31 +85,30 @@
8585
const keyCode = event.key;
8686

8787
if ( keyCode === '76') {
88-
alert("76");
88+
alert('76');
8989
} else {
90-
alert("false");
90+
alert('false');
9191
}
9292
}
9393

94-
window.addEventListener("keydown", function(e){
94+
window.addEventListener('keydown', function(e){
9595
const audio = document.querySelector(`audio[data-key="${ e.keyCode }"]`);
9696
const key = document.querySelector(`div[data-key="${ e.keyCode }"]`);
97-
// console.log(video);
98-
// console.log(key);
97+
console.log(video);
98+
console.log(key);
9999
if(!audio) return;
100100
audio.currentTime = 0;
101101
audio.play();
102-
key.classList.add("playing");
103-
// key.classList.remove("playing");
102+
key.classList.add('playing');
103+
// key.classList.remove("playing");
104104
}, false);
105105

106106
function removeTransition(e){
107-
// if(e.propertyName !== "border-left-color") return;
107+
// if(e.propertyName !== "border-left-color") return;
108108
console.log(e.propertyName);
109-
// e.target.classList.remove("playing");
109+
// e.target.classList.remove("playing");
110110
}
111111

112-
const keys = document.querySelectorAll('.key');
113112
keys.forEach( keyin => keyin.addEventListener('transitionend', removeTransition));
114113

115114

12 - Key Sequence Detection/index-FINISHED.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\<!DOCTYPE html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">

0 commit comments

Comments
 (0)