From a88553e4a21f1f6bc48d7c165b631576c33a492a Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 2 May 2011 23:00:59 -0700 Subject: [PATCH 1/8] preventdefault --- 4chan_x.js | 7 ++++++- script.coffee | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/4chan_x.js b/4chan_x.js index 0b6473fe6..7c31493d5 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1200,7 +1200,9 @@ init: function() { var node; node = $('form[name=delform] > *:not([id])'); - return threading.thread(node); + $.bind(d.body, threading.preventDefault); + threading.thread(node); + return $.unbind(d.body, threading.preventDefault); }, thread: function(node) { var div, op; @@ -1227,6 +1229,9 @@ if (!(node.align || node.nodeName === 'CENTER')) { return threading.thread(node); } + }, + preventDefault: function(e) { + return e.preventDefault(); } }; threadHiding = { diff --git a/script.coffee b/script.coffee index e4c765cc9..7184e4709 100644 --- a/script.coffee +++ b/script.coffee @@ -930,7 +930,10 @@ threading = init: -> # don't thread image controls node = $ 'form[name=delform] > *:not([id])' + # don't confuse other scripts *cough*/b/ackwash*cough* + $.bind d.body, threading.preventDefault threading.thread node + $.unbind d.body, threading.preventDefault thread: (node) -> op = $.el 'div', @@ -957,6 +960,9 @@ threading = unless node.align or node.nodeName is 'CENTER' threading.thread node + preventDefault: (e) -> + e.preventDefault() + threadHiding = init: -> hiddenThreads = $.getValue "hiddenThreads/#{g.BOARD}/", {} From 5ce349fee1d84b1db3b7de27f2993b7f7bc6b2e2 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 2 May 2011 23:05:53 -0700 Subject: [PATCH 2/8] make cooldown optional, disabled by default --- 4chan_x.js | 31 +++++++++++++++++++------------ script.coffee | 30 +++++++++++++++++------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 7c31493d5..7044f887a 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -72,6 +72,7 @@ 'Anonymize': [false, 'Make everybody anonymous'], 'Auto Watch': [true, 'Automatically watch threads that you start'], 'Comment Expansion': [true, 'Expand too long comments'], + 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], 'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Expansion': [true, 'Expand images'], 'Image Hover': [false, 'Show full image on mouseover'], @@ -1000,7 +1001,9 @@ $.remove(dialog); } } - qr.cooldown(true); + if ($.config('Cooldown')) { + qr.cooldown(true); + } } Recaptcha.reload(); return $('iframe[name=iframe]').src = 'about:blank'; @@ -1024,17 +1027,19 @@ $.remove(span); } } - if (qr.cooldown()) { - e.preventDefault(); - alert('Stop posting so often!'); - if (isQR) { - span = $.el('span', { - className: 'error', - textContent: 'Stop posting so often!' - }); - $.append(this.parentNode, span); + if ($.config('Cooldown')) { + if (qr.cooldown()) { + e.preventDefault(); + alert('Stop posting so often!'); + if (isQR) { + span = $.el('span', { + className: 'error', + textContent: 'Stop posting so often!' + }); + $.append(this.parentNode, span); + } + return; } - return; } recaptcha = $('input[name=recaptcha_response_field]', this); if (recaptcha.value) { @@ -2125,7 +2130,9 @@ $.addStyle(main.css); Recaptcha.init(); $.bind($('form[name=post]'), 'submit', qr.cb.submit); - qr.cooldown(); + if ($.config('Cooldown')) { + qr.cooldown(); + } if ($.config('Image Expansion')) { imgExpand.init(); } diff --git a/script.coffee b/script.coffee index 7184e4709..02e591a7b 100644 --- a/script.coffee +++ b/script.coffee @@ -16,6 +16,7 @@ config = 'Anonymize': [false, 'Make everybody anonymous'] 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Comment Expansion': [true, 'Expand too long comments'] + 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] 'Image Auto-Gif': [false, 'Animate gif thumbnails'] 'Image Expansion': [true, 'Expand images'] 'Image Hover': [false, 'Show full image on mouseover'] @@ -754,7 +755,8 @@ qr = qr.refresh dialog else $.remove dialog - qr.cooldown true + if $.config 'Cooldown' + qr.cooldown true Recaptcha.reload() $('iframe[name=iframe]').src = 'about:blank' @@ -772,18 +774,19 @@ qr = if span = @nextSibling $.remove span - # check if we've posted on this board in another tab - if qr.cooldown() - e.preventDefault() - alert 'Stop posting so often!' + if $.config 'Cooldown' + # check if we've posted on this board in another tab + if qr.cooldown() + e.preventDefault() + alert 'Stop posting so often!' - if isQR - span = $.el 'span', - className: 'error' - textContent: 'Stop posting so often!' - $.append @parentNode, span + if isQR + span = $.el 'span', + className: 'error' + textContent: 'Stop posting so often!' + $.append @parentNode, span - return + return recaptcha = $('input[name=recaptcha_response_field]', this) if recaptcha.value @@ -1639,9 +1642,10 @@ main = $.bind $('form[name=post]'), 'submit', qr.cb.submit - qr.cooldown() - #major features + if $.config 'Cooldown' + qr.cooldown() + if $.config 'Image Expansion' imgExpand.init() From 61243ab9ecb8fa432d2eda956cee042fc6a64827 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 2 May 2011 23:26:53 -0700 Subject: [PATCH 3/8] herp, stopPropagation --- 4chan_x.js | 8 ++++---- script.coffee | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 7044f887a..2f833f960 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1205,9 +1205,9 @@ init: function() { var node; node = $('form[name=delform] > *:not([id])'); - $.bind(d.body, threading.preventDefault); + $.bind(d, 'DOMNodeInserted', threading.stopPropagation); threading.thread(node); - return $.unbind(d.body, threading.preventDefault); + return $.unbind(d, 'DOMNodeInserted', threading.stopPropagation); }, thread: function(node) { var div, op; @@ -1235,8 +1235,8 @@ return threading.thread(node); } }, - preventDefault: function(e) { - return e.preventDefault(); + stopPropagation: function(e) { + return e.stopPropagation(); } }; threadHiding = { diff --git a/script.coffee b/script.coffee index 02e591a7b..c535fdc85 100644 --- a/script.coffee +++ b/script.coffee @@ -934,9 +934,9 @@ threading = # don't thread image controls node = $ 'form[name=delform] > *:not([id])' # don't confuse other scripts *cough*/b/ackwash*cough* - $.bind d.body, threading.preventDefault + $.bind d, 'DOMNodeInserted', threading.stopPropagation threading.thread node - $.unbind d.body, threading.preventDefault + $.unbind d, 'DOMNodeInserted', threading.stopPropagation thread: (node) -> op = $.el 'div', @@ -963,8 +963,8 @@ threading = unless node.align or node.nodeName is 'CENTER' threading.thread node - preventDefault: (e) -> - e.preventDefault() + stopPropagation: (e) -> + e.stopPropagation() threadHiding = init: -> From 8523da30501d92161289bb2632c26d73e8df987b Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 2 May 2011 23:49:36 -0700 Subject: [PATCH 4/8] 2.2.1 --- 4chan_x.js | 2 +- changelog | 8 ++++++++ header | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 2f833f960..274edf915 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 2.2.0 +// @version 2.2.1 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* diff --git a/changelog b/changelog index 0ca210816..758cd36d8 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,11 @@ +2.2.1 +- mayhem: + fix op image expansion bug + fix op comment expansion + +- fix /b/ackwash multiple links bug +- make cooldown timer optional, disabled by default + 2.2.0 - mayhem: - don't select text when moving dialogs diff --git a/header b/header index 7600ae860..903e12d9c 100644 --- a/header +++ b/header @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 2.2.0 +// @version 2.2.1 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* From 757c964f7b215bbf41f7b3891b2aca0ed1100838 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 2 May 2011 23:52:03 -0700 Subject: [PATCH 5/8] comment --- script.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/script.coffee b/script.coffee index c535fdc85..73b6cdf6b 100644 --- a/script.coffee +++ b/script.coffee @@ -934,6 +934,7 @@ threading = # don't thread image controls node = $ 'form[name=delform] > *:not([id])' # don't confuse other scripts *cough*/b/ackwash*cough* + # gotta have a named function to unbind. $.bind d, 'DOMNodeInserted', threading.stopPropagation threading.thread node $.unbind d, 'DOMNodeInserted', threading.stopPropagation From 1a213fdfa735e8b3d3660c439c430e978582a43b Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 3 May 2011 18:41:57 -0700 Subject: [PATCH 6/8] double namespacing, bleh --- 4chan_x.js | 3 +++ script.coffee | 3 +++ 2 files changed, 6 insertions(+) diff --git a/4chan_x.js b/4chan_x.js index 274edf915..52173018d 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -387,10 +387,12 @@ if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) { $.extend($, { deleteValue: function(name) { + name = NAMESPACE + name; return GM_deleteValue(name); }, getValue: function(name, defaultValue) { var value; + name = NAMESPACE + name; if (value = GM_getValue(name)) { return JSON.parse(value); } else { @@ -401,6 +403,7 @@ return GM_openInTab(url); }, setValue: function(name, value) { + name = NAMESPACE + name; return GM_setValue(name, JSON.stringify(value)); } }); diff --git a/script.coffee b/script.coffee index 73b6cdf6b..37c9a4b36 100644 --- a/script.coffee +++ b/script.coffee @@ -264,8 +264,10 @@ $.extend $, if GM_deleteValue? $.extend $, deleteValue: (name) -> + name = NAMESPACE + name GM_deleteValue name getValue: (name, defaultValue) -> + name = NAMESPACE + name if value = GM_getValue name JSON.parse value else @@ -273,6 +275,7 @@ if GM_deleteValue? openInTab: (url) -> GM_openInTab url setValue: (name, value) -> + name = NAMESPACE + name GM_setValue name, JSON.stringify value else $.extend $, From 8b64a77fac14064c072e7aa0ff85559d01c64bec Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 3 May 2011 19:11:06 -0700 Subject: [PATCH 7/8] comment --- script.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script.coffee b/script.coffee index 37c9a4b36..d9669e50f 100644 --- a/script.coffee +++ b/script.coffee @@ -1230,6 +1230,8 @@ watcher = watch: (thread) -> favicon = $ 'img.favicon', thread + + #this happens if we try to auto-watch an already watched thread. return if favicon.src is Favicon.default favicon.src = Favicon.default From f40988ecb6925e30048d464b794ce454076b149b Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 3 May 2011 19:11:53 -0700 Subject: [PATCH 8/8] 2.2.2 --- 4chan_x.js | 2 +- changelog | 3 +++ header | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 52173018d..b0032a8b9 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 2.2.1 +// @version 2.2.2 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* diff --git a/changelog b/changelog index 758cd36d8..805539893 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +2.2.2 +- hopefully fix upgrading issues + 2.2.1 - mayhem: fix op image expansion bug diff --git a/header b/header index 903e12d9c..0b3df9579 100644 --- a/header +++ b/header @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 2.2.1 +// @version 2.2.2 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/*