only mouse1 clicks should cause posts to open
This commit is contained in:
parent
fe540d791b
commit
4e9acb6502
|
@ -32,9 +32,15 @@
|
||||||
|
|
||||||
let mouse_pos = { top: 0, left: 0 };
|
let mouse_pos = { top: 0, left: 0 };
|
||||||
|
|
||||||
function gotoPost() {
|
function gotoPost(event) {
|
||||||
if (focused) return;
|
if (focused) return;
|
||||||
if (event && event.key && event.key !== "Enter") return;
|
if (event) {
|
||||||
|
if (event.type == "mouseup" && (
|
||||||
|
event.button !== 0 ||
|
||||||
|
event.shiftKey ||
|
||||||
|
event.ctrlKey)) return;
|
||||||
|
if (event.key && event.key !== "Enter") return;
|
||||||
|
}
|
||||||
goto(`/post/${post.id}`);
|
goto(`/post/${post.id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +68,7 @@
|
||||||
aria-label={aria_label}
|
aria-label={aria_label}
|
||||||
bind:this={el}
|
bind:this={el}
|
||||||
on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}}
|
on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}}
|
||||||
on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost()}}
|
on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost(e)}}
|
||||||
on:keydown={gotoPost}>
|
on:keydown={gotoPost}>
|
||||||
<PostHeader post={post} />
|
<PostHeader post={post} />
|
||||||
<Body post={post} />
|
<Body post={post} />
|
||||||
|
|
|
@ -16,8 +16,15 @@
|
||||||
|
|
||||||
let mouse_pos = { top: 0, left: 0 };
|
let mouse_pos = { top: 0, left: 0 };
|
||||||
|
|
||||||
function gotoPost() {
|
function gotoPost(event) {
|
||||||
if (event && event.key && event.key !== "Enter") return;
|
if (event) {
|
||||||
|
|
||||||
|
if (event.type == "mouseup" && (
|
||||||
|
event.button !== 0 ||
|
||||||
|
event.shiftKey ||
|
||||||
|
event.ctrlKey)) return;
|
||||||
|
if (event.key && event.key !== "Enter") return;
|
||||||
|
}
|
||||||
goto(`/post/${post.id}`);
|
goto(`/post/${post.id}`);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -32,7 +39,7 @@
|
||||||
class="post-reply"
|
class="post-reply"
|
||||||
aria-label={aria_label}
|
aria-label={aria_label}
|
||||||
on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}}
|
on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}}
|
||||||
on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost()}}
|
on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost(e)}}
|
||||||
on:keydown={gotoPost}>
|
on:keydown={gotoPost}>
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue