From 6ef1b500528a7d4f4c33bebb191deb041c6010fb Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 24 Jul 2011 11:40:52 -0700 Subject: [PATCH 1/3] consistency --- 4chan_x.user.js | 5 +---- script.coffee | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9bffa369c..84109f3c2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -730,12 +730,9 @@ if (((_ref = e.target.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) { return; } - if (!(key = keybinds.cb.keyCode(e))) { + if ((key = keybinds.cb.keyCode(e)) == null) { return; } - if (key === 'BS') { - key = ''; - } thread = nav.getThread(); switch (key) { case conf.close: diff --git a/script.coffee b/script.coffee index 5e6353289..1c2f91f81 100644 --- a/script.coffee +++ b/script.coffee @@ -520,8 +520,7 @@ keybinds = cb: keydown: (e) -> 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.cb.keyCode e - if key is 'BS' then key = '' + return unless (key = keybinds.cb.keyCode e)? thread = nav.getThread() switch key From 92d082891b9e14d66adfea23d4ad27310cd54896 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 24 Jul 2011 11:48:14 -0700 Subject: [PATCH 2/3] no need for null --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 84109f3c2..484fbecdb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -730,7 +730,7 @@ if (((_ref = e.target.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) { return; } - if ((key = keybinds.cb.keyCode(e)) == null) { + if (!(key = keybinds.cb.keyCode(e))) { return; } thread = nav.getThread(); diff --git a/script.coffee b/script.coffee index 1c2f91f81..ee31fc2d2 100644 --- a/script.coffee +++ b/script.coffee @@ -520,7 +520,7 @@ keybinds = cb: keydown: (e) -> 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.cb.keyCode e)? + return unless key = keybinds.cb.keyCode e thread = nav.getThread() switch key From 9f1462c12bd963c118483d42e539cdbeccf1b1e4 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 24 Jul 2011 16:50:50 -0700 Subject: [PATCH 3/3] qr: error: link to dup file --- 4chan_x.user.js | 22 ++++++++++++++++++---- script.coffee | 16 +++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 484fbecdb..163fd9553 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1255,7 +1255,7 @@ data = e.data; if (data) { $('input[name=recaptcha_response_field]', qr.el).value = ''; - $('#error', qr.el).textContent = data; + $.extend($('#error', qr.el), JSON.parse(data)); qr.autohide.unset(); return; } @@ -1351,7 +1351,7 @@ THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id; spoiler = $('.postarea label') ? '' : ''; challenge = $('input[name=recaptcha_challenge_field]').value; - html = "
Quick Reply X
" + spoiler + "
"; + html = "
Quick Reply X
" + spoiler + "
"; qr.el = ui.dialog('qr', { top: '0px', left: '0px' @@ -1389,8 +1389,16 @@ in the global context. */ $.globalEval(function() { - var data, _ref; - data = ((_ref = document.querySelector('table font b')) != null ? _ref.firstChild.textContent : void 0) || ''; + var data, href, node, textContent, _ref; + if (node = (_ref = document.querySelector('table font b')) != null ? _ref.firstChild : void 0) { + textContent = node.textContent, href = node.href; + data = JSON.stringify({ + textContent: textContent, + href: href + }); + } else { + data = ''; + } return parent.postMessage(data, '*'); }); c = $('b').lastChild; @@ -2822,6 +2830,12 @@ .error {\ color: red;\ }\ + #error {\ + cursor: default;\ + }\ + #error[href] {\ + cursor: pointer;\ + }\ td.replyhider {\ vertical-align: top;\ }\ diff --git a/script.coffee b/script.coffee index ee31fc2d2..97985c24a 100644 --- a/script.coffee +++ b/script.coffee @@ -982,7 +982,7 @@ qr = {data} = e if data # error message $('input[name=recaptcha_response_field]', qr.el).value = '' - $('#error', qr.el).textContent = data + $.extend $('#error', qr.el), JSON.parse data qr.autohide.unset() return @@ -1082,7 +1082,7 @@ qr =
-
+ " qr.el = ui.dialog 'qr', top: '0px', left: '0px', html @@ -1118,7 +1118,11 @@ qr = in the global context. ### $.globalEval -> - data = document.querySelector('table font b')?.firstChild.textContent or '' + if node = document.querySelector('table font b')?.firstChild + {textContent, href} = node + data = JSON.stringify {textContent, href} + else + data = '' parent.postMessage data, '*' c = $('b').lastChild @@ -2209,6 +2213,12 @@ main = .error { color: red; } + #error { + cursor: default; + } + #error[href] { + cursor: pointer; + } td.replyhider { vertical-align: top; }