projects
/
hnim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clearer order of operations
[hnim.git]
/
hnim.js
diff --git
a/hnim.js
b/hnim.js
index
890852d
..
7ac3f5d
100644
(file)
--- a/
hnim.js
+++ b/
hnim.js
@@
-15,7
+15,7
@@
const visible = (element) => {
let bounds = element.getBoundingClientRect();
const visible = (element) => {
let bounds = element.getBoundingClientRect();
- return
bounds.top >= 0 && bounds.bottom <= window.innerHeight
;
+ return
Math.abs(bounds.bottom - bounds.top) > window.innerHeight || (bounds.top >= 0 && bounds.bottom <= window.innerHeight)
;
}
const changeWithVisibleCallback = (comment, callback) => {
}
const changeWithVisibleCallback = (comment, callback) => {
@@
-37,7
+37,7
@@
// Curry callback for moving downpage
const changeDownpage = () => {
// Curry callback for moving downpage
const changeDownpage = () => {
- elementsIndex = Math.min(elementsIndex + 1, elements.length);
+ elementsIndex = Math.min(elementsIndex + 1, elements.length
- 1
);
changeWithVisibleCallback(elements[elementsIndex], () => {window.scrollTo(0, window.scrollY + selectedElement.offsetHeight)});
}
changeWithVisibleCallback(elements[elementsIndex], () => {window.scrollTo(0, window.scrollY + selectedElement.offsetHeight)});
}
@@
-51,7
+51,7
@@
change(e.target.closest("tr.athing"));
})
document.addEventListener("keydown", (e) => {
change(e.target.closest("tr.athing"));
})
document.addEventListener("keydown", (e) => {
- if (e.isComposing) {
+ if (e.
target.type === 'textarea' || e.
isComposing) {
return;
}
switch (e.key) {
return;
}
switch (e.key) {