diff --git a/4chan_x.user.js b/4chan_x.user.js index ddd792d59..90a75a68f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -726,6 +726,7 @@ }, keydown: function(e) { var o, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2, _ref3; + updater.focus = true; if (((_ref = e.target.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) { return; } @@ -1650,7 +1651,7 @@ while ((reply = replies.pop()) && (reply.id > id)) { arr.push(reply.parentNode.parentNode.parentNode); } - scroll = updater.focus && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20); + scroll = conf['Scrolling'] && updater.focus && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20); updater.timer.textContent = '-' + conf['Interval']; if (conf['Verbose']) { updater.count.textContent = '+' + arr.length; @@ -2324,6 +2325,7 @@ }, scroll: function(e) { var bottom, height, i, reply, _len, _ref; + updater.focus = true; height = d.body.clientHeight; _ref = unread.replies; for (i = 0, _len = _ref.length; i < _len; i++) { diff --git a/script.coffee b/script.coffee index adda1ebc2..1d50ba75b 100644 --- a/script.coffee +++ b/script.coffee @@ -518,6 +518,7 @@ keybinds = $.bind d, 'keydown', keybinds.keydown keydown: (e) -> + updater.focus = true return if e.target.nodeName in ['TEXTAREA', 'INPUT'] and not e.altKey and not e.ctrlKey and not (e.keyCode is 27) return unless key = keybinds.keyCode e @@ -1332,7 +1333,7 @@ updater = while (reply = replies.pop()) and (reply.id > id) arr.push reply.parentNode.parentNode.parentNode #table - scroll = updater.focus && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20) + scroll = conf['Scrolling'] && updater.focus && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20) updater.timer.textContent = '-' + conf['Interval'] if conf['Verbose'] @@ -1770,6 +1771,7 @@ unread = Favicon.update() scroll: (e) -> + updater.focus = true height = d.body.clientHeight for reply, i in unread.replies {bottom} = reply.getBoundingClientRect()