From b37af46ed8ee847c82e27e4ee19a5c10cb81975d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 25 Jun 2011 14:45:03 +0200 Subject: [PATCH] Optional auto noko. --- 4chan_x.user.js | 8 +++++++- script.coffee | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8198b4f46..2e93e747e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -69,6 +69,7 @@ config = { main: { Posting: { + '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.'] @@ -1387,7 +1388,7 @@ _ref = c.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], thread = _ref[1], id = _ref[2]; if (thread === '0') { return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + id + "#watch"; - } else { + } else if (/AEOS.4chan_x.auto_noko=true/.test(d.cookie)) { return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + thread + "#" + id; } } @@ -2682,6 +2683,11 @@ Recaptcha.init(); $.bind(form, 'submit', qr.cb.submit); } + if ($.config('Auto Noko')) { + document.cookie = "" + NAMESPACE + "auto_noko=true;path=/;domain=.4chan.org"; + } else { + document.cookie = "" + NAMESPACE + "auto_noko=false;path=/;domain=.4chan.org"; + } if ($.config('Cooldown')) { cooldown.init(); } diff --git a/script.coffee b/script.coffee index 869737756..e49a86ede 100644 --- a/script.coffee +++ b/script.coffee @@ -6,6 +6,7 @@ if console? config = main: Posting: + '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.'] @@ -1128,7 +1129,7 @@ qr = [_, thread, id] = c.textContent.match(/thread:(\d+),no:(\d+)/) if thread is '0' window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{id}#watch" - else + else if /AEOS.4chan_x.auto_noko=true/.test d.cookie window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{thread}##{id}" threading = @@ -2095,6 +2096,11 @@ main = $.bind form, 'submit', qr.cb.submit #major features + if $.config 'Auto Noko' + document.cookie = "#{NAMESPACE}auto_noko=true;path=/;domain=.4chan.org" + else + document.cookie = "#{NAMESPACE}auto_noko=false;path=/;domain=.4chan.org" + if $.config 'Cooldown' cooldown.init()