From 9cee5c513382294602659fa18f9df2df7e84d05d Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 31 Jul 2011 17:41:46 -0700 Subject: [PATCH 1/2] option: auto hide qr. fix #200 --- 4chan_x.user.js | 15 +++++++++++---- script.coffee | 7 ++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 527c68c6f..714a6cd76 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -100,7 +100,8 @@ 'Auto Noko': [true, 'Always redirect to your post'], 'Cooldown': [true, 'Prevent \'flood detected\' errors'], 'Quick Reply': [true, 'Reply without leaving the page'], - 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] + 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'], + 'Auto Hide QR': [true, 'Automatically auto-hide the quick reply when posting'] }, Quoting: { 'Quote Backlinks': [true, 'Add quote backlinks'], @@ -1312,7 +1313,9 @@ this.submit(); } $('#error', qr.el).textContent = ''; - qr.autohide.set(); + if (conf['Auto Hide QR']) { + qr.autohide.set(); + } return qr.sage = /sage/i.test($('input[name=email]', this).value); } }, @@ -1371,7 +1374,9 @@ }, persist: function() { qr.dialog(); - return qr.autohide.set(); + if (conf['Auto Hide QR']) { + return qr.autohide.set(); + } }, close: function() { $.rm(qr.el); @@ -2443,7 +2448,9 @@ } if (e.keyCode === 13 && cooldown.duration) { $('#auto', qr.el).checked = true; - return qr.autohide.set(); + if (conf['Auto Hide QR']) { + return qr.autohide.set(); + } } }, reload: function() { diff --git a/script.coffee b/script.coffee index 97e68700d..ce19cfbe6 100644 --- a/script.coffee +++ b/script.coffee @@ -34,6 +34,7 @@ config = 'Cooldown': [true, 'Prevent \'flood detected\' errors'] 'Quick Reply': [true, 'Reply without leaving the page'] 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] + 'Auto Hide QR': [true, 'Automatically auto-hide the quick reply when posting'] Quoting: 'Quote Backlinks': [true, 'Add quote backlinks'] 'OP Backlinks': [false, 'Add backlinks to the OP'] @@ -1027,7 +1028,7 @@ qr = else if isQR if !e then @submit() $('#error', qr.el).textContent = '' - qr.autohide.set() + qr.autohide.set() if conf['Auto Hide QR'] qr.sage = /sage/i.test $('input[name=email]', @).value quote: (link) -> @@ -1100,7 +1101,7 @@ qr = persist: -> qr.dialog() - qr.autohide.set() + qr.autohide.set() if conf['Auto Hide QR'] close: -> $.rm qr.el @@ -1846,7 +1847,7 @@ Recaptcha = Recaptcha.reload() if e.keyCode is 13 and cooldown.duration # press enter to enable auto-post if cooldown is still running $('#auto', qr.el).checked = true - qr.autohide.set() + qr.autohide.set() if conf['Auto Hide QR'] reload: -> window.location = 'javascript:Recaptcha.reload()' reloaded: (e) -> From 0a547dc8041c6dffc655cd1ac925f279a5539805 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 31 Jul 2011 18:01:27 -0700 Subject: [PATCH 2/2] derp --- 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 714a6cd76..8f63a65b9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1419,7 +1419,7 @@ url = "http://boards.4chan.org/" + g.BOARD; if (noko) { url += '/res/'; - url += thread === 0 ? id : thread; + url += thread === '0' ? id : thread; if (watch) { url += '?watch'; } diff --git a/script.coffee b/script.coffee index ce19cfbe6..1c34795d9 100644 --- a/script.coffee +++ b/script.coffee @@ -1141,7 +1141,7 @@ qr = if noko url += '/res/' - url += if thread is 0 then id else thread + url += if thread is '0' then id else thread if watch url += '?watch' if cooldown