From e042d0fef7b6c3d5ba3e76d27cf13e84f8b1d6f2 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 30 Apr 2016 16:28:26 -0400 Subject: [PATCH] use shift+drag for moving reply box --- contrib/js/backlink.js | 18 ++++++++++++++++-- contrib/static/nntpchan.js | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/contrib/js/backlink.js b/contrib/js/backlink.js index 48b8044..af59f2a 100644 --- a/contrib/js/backlink.js +++ b/contrib/js/backlink.js @@ -328,11 +328,25 @@ function init(prefix) { var originalX = window.screenX - 150; var originalY = 10; rpl.moveTo(originalX, originalY); + + var keyDown = false; + + e.addEventListener("keydown", function(ev) { + if (ev.shiftKey) { + keyDown = true; + } + }); + + e.addEventListener("keyup", function(ev) { + if (ev.shiftKey) { + keyDown = false; + } + }); e.addEventListener("dragstart", function(ev) { mouseDownX = ev.clientX; mouseDownY = ev.clientY; - if (!ev.altKey) { + if (!keyDown) { ev.preventDefault(); } }, false); @@ -345,7 +359,7 @@ function init(prefix) { rpl.moveTo(x, y); originalX = x; originalY = y; - if (!ev.altKey) { + if (!keyDown) { ev.preventDefault(); } }, false); diff --git a/contrib/static/nntpchan.js b/contrib/static/nntpchan.js index 6c40781..65de2e4 100644 --- a/contrib/static/nntpchan.js +++ b/contrib/static/nntpchan.js @@ -43,7 +43,7 @@ parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=do parent.backlink=true;}};parent.backlink=true;} function inject_hover_for_element(elem){var elems=elem.getElementsByClassName("backlink");var ls=[];var l=elems.length;for(var idx=0;idx