From bda70f05338305e9fefabc439078ad21bf19c99e Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 8 Apr 2011 01:53:55 -0700 Subject: [PATCH 01/10] pull refresh out of qr.cb --- 4chan_x.js | 30 +++++++++++++++--------------- script.coffee | 28 ++++++++++++++-------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index cdab6de51..a29e3a5ba 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1049,21 +1049,21 @@ ta = $('textarea', dialog); ta.focus(); return ta.value += text; - }, - refresh: function(dialog) { - var auto, f, submit, _ref; - $('textarea', dialog).value = ''; - $('input[name=recaptcha_response_field]', dialog).value = ''; - f = $('input[type=file]', dialog).parentNode; - f.innerHTML = f.innerHTML; - submit = $('input[type=submit]', qr); - submit.value = g.sage ? 60 : 30; - submit.disabled = true; - window.setTimeout(qr.cooldown, 1000); - auto = submit.previousSibling.lastChild; - if (auto.checked) { - return (_ref = $('input[title=autohide]:checked', qr)) != null ? _ref.click() : void 0; - } + } + }, + refresh: function(dialog) { + var auto, f, submit, _ref; + $('textarea', dialog).value = ''; + $('input[name=recaptcha_response_field]', dialog).value = ''; + f = $('input[type=file]', dialog).parentNode; + f.innerHTML = f.innerHTML; + submit = $('input[type=submit]', qr); + submit.value = g.sage ? 60 : 30; + submit.disabled = true; + window.setTimeout(qr.cooldown, 1000); + auto = submit.previousSibling.lastChild; + if (auto.checked) { + return (_ref = $('input[title=autohide]:checked', qr)) != null ? _ref.click() : void 0; } }, cooldown: function() { diff --git a/script.coffee b/script.coffee index f3f6547bc..ef7ec33a0 100644 --- a/script.coffee +++ b/script.coffee @@ -779,20 +779,20 @@ qr = ta.focus() ta.value += text - refresh: (dialog) -> - $('textarea', dialog).value = '' - $('input[name=recaptcha_response_field]', dialog).value = '' - # XXX file.value = '' doesn't work in opera - f = $('input[type=file]', dialog).parentNode - f.innerHTML = f.innerHTML - submit = $ 'input[type=submit]', qr - submit.value = if g.sage then 60 else 30 - submit.disabled = true - window.setTimeout qr.cooldown, 1000 - auto = submit.previousSibling.lastChild - if auto.checked - #unhide the qr so you know it's ready for the next item - $('input[title=autohide]:checked', qr)?.click() + refresh: (dialog) -> + $('textarea', dialog).value = '' + $('input[name=recaptcha_response_field]', dialog).value = '' + # XXX file.value = '' doesn't work in opera + f = $('input[type=file]', dialog).parentNode + f.innerHTML = f.innerHTML + submit = $ 'input[type=submit]', qr + submit.value = if g.sage then 60 else 30 + submit.disabled = true + window.setTimeout qr.cooldown, 1000 + auto = submit.previousSibling.lastChild + if auto.checked + #unhide the qr so you know it's ready for the next item + $('input[title=autohide]:checked', qr)?.click() cooldown: -> submit = $ '#qr input[type=submit]' From 91deb3fcf4e16c1bc0f8284c0e7b7f327e23dd2e Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 8 Apr 2011 01:55:19 -0700 Subject: [PATCH 02/10] 1.27.7 --- 4chan_x.js | 2 +- changelog | 4 ++++ header | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index a29e3a5ba..cc516a393 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.6 +// @version 1.27.7 // @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 93a043f1e..8786dd3b3 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +1.27.7 +- fix qr persist +- fix updater defaults + 1.27.6 - fix 'update now' button diff --git a/header b/header index f9f7453f6..2179013ae 100644 --- a/header +++ b/header @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.6 +// @version 1.27.7 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* From 649afadb257de1539ebca1564b559b537ac3a0eb Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 8 Apr 2011 02:02:16 -0700 Subject: [PATCH 03/10] readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..0b548fc4c --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Building + +[install nodejs and npm](https://github.com/joyent/node/wiki/Installation), +clone [coffee-script](https://github.com/jashkenas/coffee-script/), +cd into it and run `npm link`, clone 4chan x, cd into it and run `cake dev &`. +kill the process with `killall node`. From 0a12099c92d1a353406f39b5985b79993e66ceaa Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 02:01:06 -0700 Subject: [PATCH 04/10] fix movement --- 4chan_x.js | 10 +++++----- script.coffee | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index cc516a393..365971c2e 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -116,7 +116,7 @@ } ui = { dialog: function(id, position, html) { - var el, left, top, _ref; + var el, left, top, _ref, _ref2, _ref3; el = document.createElement('div'); el.className = 'reply dialog'; el.innerHTML = html; @@ -146,8 +146,8 @@ top = '25%'; } } - left = localStorage["" + id + "Left"] || left; - top = localStorage["" + id + "Top"] || top; + left = (_ref = localStorage["" + id + "Left"]) != null ? _ref : left; + top = (_ref2 = localStorage["" + id + "Top"]) != null ? _ref2 : top; if (left) { el.style.left = left; } else { @@ -159,8 +159,8 @@ el.style.bottom = '0px'; } el.querySelector('div.move').addEventListener('mousedown', ui.move, true); - if ((_ref = el.querySelector('div.move a[name=close]')) != null) { - _ref.addEventListener('click', (function() { + if ((_ref3 = el.querySelector('div.move a[name=close]')) != null) { + _ref3.addEventListener('click', (function() { return el.parentNode.removeChild(el); }), true); } diff --git a/script.coffee b/script.coffee index ef7ec33a0..6fe34978f 100644 --- a/script.coffee +++ b/script.coffee @@ -72,8 +72,8 @@ ui = when 'center' left = '50%' top = '25%' - left = localStorage["#{id}Left"] or left - top = localStorage["#{id}Top"] or top + left = localStorage["#{id}Left"] ? left + top = localStorage["#{id}Top"] ? top if left then el.style.left = left else el.style.right = '0px' if top then el.style.top = top else el.style.bottom = '0px' el.querySelector('div.move').addEventListener 'mousedown', ui.move, true From f846b5f5099d63eb08e1a9a748e7a3c42d5ef6fe Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 02:06:07 -0700 Subject: [PATCH 05/10] fix thread hiding; ms/day --- 4chan_x.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 365971c2e..e2bdf6c8a 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1556,7 +1556,7 @@ } lastChecked = Number(GM_getValue('lastChecked', '0')); now = Date.now(); - DAY = 24 * 60 * 60; + DAY = 1000 * 60 * 60 * 24; if (lastChecked < now - 1 * DAY) { cutoff = now - 7 * DAY; while (g.hiddenThreads.length) { diff --git a/script.coffee b/script.coffee index 6fe34978f..f03ff3502 100644 --- a/script.coffee +++ b/script.coffee @@ -1193,7 +1193,7 @@ if $.isDST() then g.chanOffset -= 1 lastChecked = Number GM_getValue('lastChecked', '0') now = Date.now() -DAY = 24 * 60 * 60 +DAY = 1000 * 60 * 60 * 24 if lastChecked < now - 1*DAY cutoff = now - 7*DAY while g.hiddenThreads.length From cc99beb51ee7d6bef525a432d867fc7e095a4918 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 03:07:28 -0700 Subject: [PATCH 06/10] fix qr image posting --- 4chan_x.js | 20 ++++++++++---------- script.coffee | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index e2bdf6c8a..0dbfb27c2 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -972,8 +972,8 @@ } }, messageIframe: function(e) { - var message; - message = $('table b').firstChild.textContent; + var message, _ref; + message = (_ref = $('table font b')) != null ? _ref.firstChild.textContent : void 0; e.source.postMessage(message, '*'); return window.location = 'about:blank'; }, @@ -981,7 +981,14 @@ var data, dialog, error; data = e.data; dialog = $('#qr'); - if (data === 'Post successful!') { + if (data) { + error = $.el('span', { + className: 'error', + textContent: data + }); + $.append(dialog, error); + qr.autohide.unset(); + } else { if (dialog) { if ($.config('Persistent QR')) { qr.refresh(dialog); @@ -989,13 +996,6 @@ $.remove(dialog); } } - } else { - error = $.el('span', { - className: 'error', - textContent: data - }); - $.append(dialog, error); - qr.autohide.unset(); } return recaptchaReload(); }, diff --git a/script.coffee b/script.coffee index f03ff3502..f464315bd 100644 --- a/script.coffee +++ b/script.coffee @@ -716,25 +716,25 @@ qr = $.remove dialog messageIframe: (e) -> - message = $('table b').firstChild.textContent + message = $('table font b')?.firstChild.textContent e.source.postMessage message, '*' window.location = 'about:blank' messageTop: (e) -> {data} = e dialog = $ '#qr' - if data is 'Post successful!' - if dialog - if $.config 'Persistent QR' - qr.refresh dialog - else - $.remove dialog - else + if data # error message error = $.el 'span', className: 'error' textContent: data $.append dialog, error qr.autohide.unset() + else + if dialog + if $.config 'Persistent QR' + qr.refresh dialog + else + $.remove dialog recaptchaReload() From 7c77ba3337aa952a004abcba02a8e908eeb77ec4 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 03:08:05 -0700 Subject: [PATCH 07/10] 1.27.8 --- 4chan_x.js | 2 +- changelog | 5 +++++ header | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 0dbfb27c2..322e859a7 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.7 +// @version 1.27.8 // @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 8786dd3b3..6e50ada6f 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +1.27.8 +- fix qr image posting +- fix thread hiding +- fix movement + 1.27.7 - fix qr persist - fix updater defaults diff --git a/header b/header index 2179013ae..ff6961158 100644 --- a/header +++ b/header @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.7 +// @version 1.27.8 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* From 997211a1e17d2efd13e303c78d36572274f01fe9 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 03:14:36 -0700 Subject: [PATCH 08/10] fix qr image posting... --- 4chan_x.js | 4 ++-- header | 2 +- script.coffee | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 322e859a7..691b443e9 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.8 +// @version 1.27.8-1 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* @@ -973,7 +973,7 @@ }, messageIframe: function(e) { var message, _ref; - message = (_ref = $('table font b')) != null ? _ref.firstChild.textContent : void 0; + message = ((_ref = $('table font b')) != null ? _ref.firstChild.textContent : void 0) || ''; e.source.postMessage(message, '*'); return window.location = 'about:blank'; }, diff --git a/header b/header index ff6961158..c12af71d4 100644 --- a/header +++ b/header @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.8 +// @version 1.27.8-1 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* diff --git a/script.coffee b/script.coffee index f464315bd..c7c285cca 100644 --- a/script.coffee +++ b/script.coffee @@ -716,7 +716,7 @@ qr = $.remove dialog messageIframe: (e) -> - message = $('table font b')?.firstChild.textContent + message = $('table font b')?.firstChild.textContent or '' e.source.postMessage message, '*' window.location = 'about:blank' From 35d627922e523daaaaa0e637e63cbad779724ad1 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 03:41:39 -0700 Subject: [PATCH 09/10] FUCKING CHROME --- 4chan_x.js | 2 +- header | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 691b443e9..ce9022c7b 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.8-1 +// @version 1.27.8.2 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* diff --git a/header b/header index c12af71d4..a04a5e906 100644 --- a/header +++ b/header @@ -2,7 +2,7 @@ // @name 4chan x // @namespace aeosynth // @description Adds various features. -// @version 1.27.8-1 +// @version 1.27.8.2 // @copyright 2009-2011 James Campos // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* From ab2c20431f0b6f7fc04df7b7b76189f6e629aa46 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 22:28:57 -0700 Subject: [PATCH 10/10] update easymodo boards; closes #16 --- 4chan_x.js | 1 - script.coffee | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index ce9022c7b..999676db7 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1167,7 +1167,6 @@ case 'tv': url = "http://green-oval.net/cgi-board.pl/" + g.BOARD + "/thread/" + g.THREAD_ID; break; - case 'cgl': case 'jp': case 'm': case 'tg': diff --git a/script.coffee b/script.coffee index c7c285cca..31fe0d5ef 100644 --- a/script.coffee +++ b/script.coffee @@ -876,7 +876,7 @@ redirect = -> switch g.BOARD when 'a', 'g', 'lit', 'sci', 'tv' url = "http://green-oval.net/cgi-board.pl/#{g.BOARD}/thread/#{g.THREAD_ID}" - when 'cgl', 'jp', 'm', 'tg' + when 'jp', 'm', 'tg' url = "http://archive.easymodo.net/cgi-board.pl/#{g.BOARD}/thread/#{g.THREAD_ID}" when '3', 'adv', 'an', 'c', 'ck', 'co', 'fa', 'fit', 'int', 'k', 'mu', 'n', 'o', 'p', 'po', 'soc', 'sp', 'toy', 'trv', 'v', 'vp', 'x' url = "http://archive.no-ip.org/#{g.BOARD}/thread/#{g.THREAD_ID}"