Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de69b43

Browse filesBrowse files
committed
finished chapter 10
1 parent 19fb3af commit de69b43
Copy full SHA for de69b43

File tree

Expand file treeCollapse file tree

2 files changed

+34
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+34
-0
lines changed
Open diff view settings
Collapse file

‎10 - Hold Shift and Check Checkboxes/index-START.html‎

Copy file name to clipboardExpand all lines: 10 - Hold Shift and Check Checkboxes/index-START.html
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,30 @@
104104
</div>
105105

106106
<script>
107+
const checkboxes = document.querySelectorAll('.inbox input[type="checkbox"]')
108+
109+
let lastChecked;
110+
111+
function handleCheck(e) {
112+
let inBetween = false;
113+
if(e.shiftKey && this.checked) {
114+
checkboxes.forEach(checkbox => {
115+
if(checkbox === this || checkbox === lastChecked) {
116+
inBetween = !inBetween;
117+
console.log('starting');
118+
}
119+
console.log(inBetween);
120+
if(inBetween) {
121+
console.log('found one');
122+
checkbox.checked = true;
123+
}
124+
})
125+
}
126+
127+
lastChecked = this;
128+
}
129+
130+
checkboxes.forEach(checkbox => checkbox.addEventListener('click', handleCheck));
107131
</script>
108132
</body>
109133
</html>
Collapse file

‎12 - Key Sequence Detection/index-START.html‎

Copy file name to clipboardExpand all lines: 12 - Key Sequence Detection/index-START.html
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
</head>
88
<body>
99
<script>
10+
const pressed = [];
11+
const secretCode = 'winner';
12+
window.addEventListener('keyup', (e) => {
13+
pressed.push(e.key)
14+
pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
15+
if(pressed.join('').includes(secretCode)) {
16+
cornify_add();
17+
}
18+
console.log(pressed)
19+
})
1020
</script>
1121
</body>
1222
</html>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.