Optional auto noko.

This commit is contained in:
Nicolas Stepien 2011-06-25 14:45:03 +02:00
parent b1db8b6282
commit b37af46ed8
2 changed files with 14 additions and 2 deletions

View File

@ -69,6 +69,7 @@
config = { config = {
main: { main: {
Posting: { Posting: {
'Auto Noko': [true, 'Always redirect to your post'],
'Cooldown': [true, 'Prevent \'flood detected\' errors'], 'Cooldown': [true, 'Prevent \'flood detected\' errors'],
'Quick Reply': [true, 'Reply without leaving the page'], '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.']
@ -1387,7 +1388,7 @@
_ref = c.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], thread = _ref[1], id = _ref[2]; _ref = c.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], thread = _ref[1], id = _ref[2];
if (thread === '0') { if (thread === '0') {
return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + id + "#watch"; 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; return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + thread + "#" + id;
} }
} }
@ -2682,6 +2683,11 @@
Recaptcha.init(); Recaptcha.init();
$.bind(form, 'submit', qr.cb.submit); $.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')) { if ($.config('Cooldown')) {
cooldown.init(); cooldown.init();
} }

View File

@ -6,6 +6,7 @@ if console?
config = config =
main: main:
Posting: Posting:
'Auto Noko': [true, 'Always redirect to your post']
'Cooldown': [true, 'Prevent \'flood detected\' errors'] 'Cooldown': [true, 'Prevent \'flood detected\' errors']
'Quick Reply': [true, 'Reply without leaving the page'] '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.']
@ -1128,7 +1129,7 @@ qr =
[_, thread, id] = c.textContent.match(/thread:(\d+),no:(\d+)/) [_, thread, id] = c.textContent.match(/thread:(\d+),no:(\d+)/)
if thread is '0' if thread is '0'
window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{id}#watch" 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}" window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{thread}##{id}"
threading = threading =
@ -2095,6 +2096,11 @@ main =
$.bind form, 'submit', qr.cb.submit $.bind form, 'submit', qr.cb.submit
#major features #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' if $.config 'Cooldown'
cooldown.init() cooldown.init()