From 6584da2a68bd98e332098c0326e93072350a5497 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 01:39:58 +0200 Subject: [PATCH 01/13] Update coffee-script to 1.1.0 --- 4chan_x.js | 76 +++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 274edf915..58ca92b97 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -60,7 +60,7 @@ (function() { var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, redirect, replyHiding, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref; var __slice = Array.prototype.slice; - if (typeof console !== "undefined" && console !== null) { + if (typeof console != "undefined" && console !== null) { log = function(arg) { return console.log(arg); }; @@ -384,7 +384,7 @@ } } }); - if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) { + if (typeof GM_deleteValue != "undefined" && GM_deleteValue !== null) { $.extend($, { deleteValue: function(name) { return GM_deleteValue(name); @@ -1195,8 +1195,8 @@ in the global context. */ return $.globalEval(function() { - var data, _ref3; - data = ((_ref3 = document.querySelector('table font b')) != null ? _ref3.firstChild.textContent : void 0) || ''; + var data, _ref; + data = ((_ref = document.querySelector('table font b')) != null ? _ref.firstChild.textContent : void 0) || ''; return parent.postMessage(data, '*'); }); } @@ -1606,17 +1606,17 @@ span = _ref[_i]; suffix = $('a', span).href; _results.push((function() { - var _len2, _results2; - _results2 = []; - for (i = 0, _len2 = prefixes.length; i < _len2; i++) { + var _len, _results; + _results = []; + for (i = 0, _len = prefixes.length; i < _len; i++) { prefix = prefixes[i]; link = $.el('a', { textContent: names[i], href: prefix + suffix }); - _results2.push($.append(span, $.tn(' '), link)); + _results.push($.append(span, $.tn(' '), link)); } - return _results2; + return _results; })()); } return _results; @@ -1804,10 +1804,10 @@ }; Recaptcha = { init: function() { - var el, recaptcha, _i, _len, _ref2; - _ref2 = $$('#recaptcha_table a'); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - el = _ref2[_i]; + var el, recaptcha, _i, _len, _ref; + _ref = $$('#recaptcha_table a'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + el = _ref[_i]; el.tabIndex = 1; } recaptcha = $('#recaptcha_response_field'); @@ -1823,13 +1823,13 @@ } }; nodeInserted = function(e) { - var callback, dialog, target, _i, _len, _ref2, _results; + var callback, dialog, target, _i, _len, _ref, _results; target = e.target; if (target.nodeName === 'TABLE') { - _ref2 = g.callbacks; + _ref = g.callbacks; _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - callback = _ref2[_i]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + callback = _ref[_i]; _results.push(callback(target)); } return _results; @@ -1934,11 +1934,11 @@ }, cb: { node: function(root) { - var thumb, _i, _len, _ref2, _results; - _ref2 = $$('img[md5]', root); + var thumb, _i, _len, _ref, _results; + _ref = $$('img[md5]', root); _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - thumb = _ref2[_i]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + thumb = _ref[_i]; $.bind(thumb.parentNode, 'click', imgExpand.cb.toggle); _results.push(imgExpand.on ? imgExpand.toggle(thumb) : void 0); } @@ -1973,12 +1973,12 @@ } }, typeChange: function(e) { - var img, _i, _len, _ref2, _results; + var img, _i, _len, _ref, _results; imgExpand.foo(); - _ref2 = $$('img[md5] + img'); + _ref = $$('img[md5] + img'); _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - img = _ref2[_i]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + img = _ref[_i]; _results.push(imgExpand.resize(img)); } return _results; @@ -2022,9 +2022,9 @@ return imgExpand.type = $('#imageType').value; }, resize: function(img) { - var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref2; + var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref; maxWidthOP = imgExpand.maxWidthOP, maxWidthReply = imgExpand.maxWidthReply, maxHeight = imgExpand.maxHeight, type = imgExpand.type; - _ref2 = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref2[0], imgWidth = _ref2[1], imgHeight = _ref2[2]; + _ref = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref[0], imgWidth = _ref[1], imgHeight = _ref[2]; imgWidth = Number(imgWidth); imgHeight = Number(imgHeight); if (img.parentNode.parentNode.nodeName === 'TD') { @@ -2048,15 +2048,15 @@ } }, dialog: function() { - var controls, delform, imageType, option, _i, _len, _ref2; + var controls, delform, imageType, option, _i, _len, _ref; controls = $.el('div', { id: 'imgControls', innerHTML: " " }); imageType = $.getValue('imageType', 'full'); - _ref2 = $$('option', controls); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - option = _ref2[_i]; + _ref = $$('option', controls); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; if (option.textContent === imageType) { option.selected = true; break; @@ -2077,7 +2077,7 @@ }; main = { init: function() { - var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref2, _ref3; + var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref, _ref2; pathname = location.pathname.substring(1).split('/'); g.BOARD = pathname[0], temp = pathname[1]; if (temp === 'res') { @@ -2116,9 +2116,9 @@ delete hiddenThreads[id]; } } - _ref2 = g.hiddenReplies; - for (id in _ref2) { - timestamp = _ref2[id]; + _ref = g.hiddenReplies; + for (id in _ref) { + timestamp = _ref[id]; if (timestamp < cutoff) { delete g.hiddenReplies[id]; } @@ -2200,9 +2200,9 @@ expandComment.init(); } } - _ref3 = g.callbacks; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - callback = _ref3[_i]; + _ref2 = g.callbacks; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + callback = _ref2[_i]; callback(); } $.bind(d.body, 'DOMNodeInserted', nodeInserted); From fa2ebec87a98e9c1b51d7d1ecb088de3e51e53bc Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 01:52:04 +0200 Subject: [PATCH 02/13] Better thread watcher list update on un/watch. --- 4chan_x.js | 32 ++++++++++++++++++++++++++------ script.coffee | 17 ++++++++++++----- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 58ca92b97..d99e3d88a 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1496,6 +1496,28 @@ } return _results; }, + list: function(watched) { + var board, div, id, props, _results; + div = $('#watcher > div:not(.move)'); + while (div) { + $.remove(div); + div = $('#watcher > div:not(.move)'); + } + _results = []; + for (board in watched) { + _results.push((function() { + var _ref, _results; + _ref = watched[board]; + _results = []; + for (id in _ref) { + props = _ref[id]; + _results.push(watcher.addLink(props, $('#watcher'))); + } + return _results; + })()); + } + return _results; + }, addLink: function(props, dialog) { var div, link, x; dialog || (dialog = $('#watcher')); @@ -1529,17 +1551,15 @@ } }, unwatch: function(board, id) { - var div, favicon, href, input, watched; - href = "/" + board + "/res/" + id; - div = $("#watcher a[href=\"" + href + "\"]").parentNode; - $.remove(div); + var favicon, input, watched; if (input = $("input[name=\"" + id + "\"]")) { favicon = input.previousSibling; favicon.src = Favicon.empty; } watched = $.getValue('watched', {}); delete watched[board][id]; - return $.setValue('watched', watched); + $.setValue('watched', watched); + return watcher.list(watched); }, watch: function(thread) { var favicon, id, props, tc, watched, _name; @@ -1558,7 +1578,7 @@ watched[_name = g.BOARD] || (watched[_name] = {}); watched[g.BOARD][id] = props; $.setValue('watched', watched); - return watcher.addLink(props); + return watcher.list(watched); } }; anonymize = { diff --git a/script.coffee b/script.coffee index c535fdc85..8238de541 100644 --- a/script.coffee +++ b/script.coffee @@ -1184,6 +1184,15 @@ watcher = $.bind favicon, 'click', watcher.cb.toggle $.before input, favicon + list: (watched) -> + div = $ '#watcher > div:not(.move)' + while div + $.remove div + div = $ '#watcher > div:not(.move)' + for board of watched + for id, props of watched[board] + watcher.addLink props, $ '#watcher' + addLink: (props, dialog) -> dialog or= $ '#watcher' div = $.el 'div' @@ -1212,10 +1221,6 @@ watcher = watcher.unwatch g.BOARD, id unwatch: (board, id) -> - href = "/#{board}/res/#{id}" - div = $("#watcher a[href=\"#{href}\"]").parentNode - $.remove div - if input = $ "input[name=\"#{id}\"]" favicon = input.previousSibling favicon.src = Favicon.empty @@ -1224,6 +1229,8 @@ watcher = delete watched[board][id] $.setValue 'watched', watched + watcher.list watched + watch: (thread) -> favicon = $ 'img.favicon', thread return if favicon.src is Favicon.default @@ -1240,7 +1247,7 @@ watcher = watched[g.BOARD][id] = props $.setValue 'watched', watched - watcher.addLink props + watcher.list watched anonymize = init: -> From ca2051313d73af579b824c206263eebc4e073c16 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 01:58:39 +0200 Subject: [PATCH 03/13] A bit deeper. --- 4chan_x.js | 11 ++--------- script.coffee | 5 +---- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index d99e3d88a..929d5a3fa 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1461,7 +1461,7 @@ }; watcher = { init: function() { - var board, dialog, favicon, html, id, input, inputs, props, src, watched, watchedBoard, _i, _len, _ref, _results; + var dialog, favicon, html, id, input, inputs, src, watched, watchedBoard, _i, _len, _results; html = '
Thread Watcher
'; dialog = ui.dialog('watcher', { top: '50px', @@ -1469,13 +1469,7 @@ }, html); $.append(d.body, dialog); watched = $.getValue('watched', {}); - for (board in watched) { - _ref = watched[board]; - for (id in _ref) { - props = _ref[id]; - watcher.addLink(props, dialog); - } - } + watcher.list(watched); watchedBoard = watched[g.BOARD] || {}; inputs = $$('form > input[value=delete], div.thread > input[value=delete]'); _results = []; @@ -1520,7 +1514,6 @@ }, addLink: function(props, dialog) { var div, link, x; - dialog || (dialog = $('#watcher')); div = $.el('div'); x = $.el('a', { textContent: 'X' diff --git a/script.coffee b/script.coffee index 8238de541..d5b3ee50f 100644 --- a/script.coffee +++ b/script.coffee @@ -1165,9 +1165,7 @@ watcher = #populate watcher watched = $.getValue 'watched', {} - for board of watched - for id, props of watched[board] - watcher.addLink props, dialog + watcher.list watched #add watch buttons watchedBoard = watched[g.BOARD] or {} @@ -1194,7 +1192,6 @@ watcher = watcher.addLink props, $ '#watcher' addLink: (props, dialog) -> - dialog or= $ '#watcher' div = $.el 'div' x = $.el 'a', textContent: 'X' From 62763b2e0c896947d69b321bebaa2fc9cc58755e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 09:09:34 +0200 Subject: [PATCH 04/13] Rename function. A bit deeper. --- 4chan_x.js | 12 +++++------- script.coffee | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 929d5a3fa..6fe6c91af 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1469,7 +1469,7 @@ }, html); $.append(d.body, dialog); watched = $.getValue('watched', {}); - watcher.list(watched); + watcher.refresh(watched); watchedBoard = watched[g.BOARD] || {}; inputs = $$('form > input[value=delete], div.thread > input[value=delete]'); _results = []; @@ -1490,12 +1490,10 @@ } return _results; }, - list: function(watched) { + refresh: function(watched) { var board, div, id, props, _results; - div = $('#watcher > div:not(.move)'); - while (div) { + while (div = $('#watcher > div:not(.move)')) { $.remove(div); - div = $('#watcher > div:not(.move)'); } _results = []; for (board in watched) { @@ -1552,7 +1550,7 @@ watched = $.getValue('watched', {}); delete watched[board][id]; $.setValue('watched', watched); - return watcher.list(watched); + return watcher.refresh(watched); }, watch: function(thread) { var favicon, id, props, tc, watched, _name; @@ -1571,7 +1569,7 @@ watched[_name = g.BOARD] || (watched[_name] = {}); watched[g.BOARD][id] = props; $.setValue('watched', watched); - return watcher.list(watched); + return watcher.refresh(watched); } }; anonymize = { diff --git a/script.coffee b/script.coffee index d5b3ee50f..b6087329b 100644 --- a/script.coffee +++ b/script.coffee @@ -1165,7 +1165,7 @@ watcher = #populate watcher watched = $.getValue 'watched', {} - watcher.list watched + watcher.refresh watched #add watch buttons watchedBoard = watched[g.BOARD] or {} @@ -1182,11 +1182,9 @@ watcher = $.bind favicon, 'click', watcher.cb.toggle $.before input, favicon - list: (watched) -> - div = $ '#watcher > div:not(.move)' - while div + refresh: (watched) -> + while div = $ '#watcher > div:not(.move)' $.remove div - div = $ '#watcher > div:not(.move)' for board of watched for id, props of watched[board] watcher.addLink props, $ '#watcher' @@ -1226,7 +1224,7 @@ watcher = delete watched[board][id] $.setValue 'watched', watched - watcher.list watched + watcher.refresh watched watch: (thread) -> favicon = $ 'img.favicon', thread @@ -1244,7 +1242,7 @@ watcher = watched[g.BOARD][id] = props $.setValue 'watched', watched - watcher.list watched + watcher.refresh watched anonymize = init: -> From 741e52a04751c1598eace413468c6baba7b18a10 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 11:20:30 +0200 Subject: [PATCH 05/13] OP here. Nevermind I found out. --- 4chan_x.js | 84 +++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 6fe6c91af..3e73a3e75 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -60,7 +60,7 @@ (function() { var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, redirect, replyHiding, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref; var __slice = Array.prototype.slice; - if (typeof console != "undefined" && console !== null) { + if (typeof console !== "undefined" && console !== null) { log = function(arg) { return console.log(arg); }; @@ -384,7 +384,7 @@ } } }); - if (typeof GM_deleteValue != "undefined" && GM_deleteValue !== null) { + if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) { $.extend($, { deleteValue: function(name) { return GM_deleteValue(name); @@ -1195,8 +1195,8 @@ in the global context. */ return $.globalEval(function() { - var data, _ref; - data = ((_ref = document.querySelector('table font b')) != null ? _ref.firstChild.textContent : void 0) || ''; + var data, _ref3; + data = ((_ref3 = document.querySelector('table font b')) != null ? _ref3.firstChild.textContent : void 0) || ''; return parent.postMessage(data, '*'); }); } @@ -1498,14 +1498,14 @@ _results = []; for (board in watched) { _results.push((function() { - var _ref, _results; + var _ref, _results2; _ref = watched[board]; - _results = []; + _results2 = []; for (id in _ref) { props = _ref[id]; - _results.push(watcher.addLink(props, $('#watcher'))); + _results2.push(watcher.addLink(props, $('#watcher'))); } - return _results; + return _results2; })()); } return _results; @@ -1617,17 +1617,17 @@ span = _ref[_i]; suffix = $('a', span).href; _results.push((function() { - var _len, _results; - _results = []; - for (i = 0, _len = prefixes.length; i < _len; i++) { + var _len2, _results2; + _results2 = []; + for (i = 0, _len2 = prefixes.length; i < _len2; i++) { prefix = prefixes[i]; link = $.el('a', { textContent: names[i], href: prefix + suffix }); - _results.push($.append(span, $.tn(' '), link)); + _results2.push($.append(span, $.tn(' '), link)); } - return _results; + return _results2; })()); } return _results; @@ -1815,10 +1815,10 @@ }; Recaptcha = { init: function() { - var el, recaptcha, _i, _len, _ref; - _ref = $$('#recaptcha_table a'); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - el = _ref[_i]; + var el, recaptcha, _i, _len, _ref2; + _ref2 = $$('#recaptcha_table a'); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + el = _ref2[_i]; el.tabIndex = 1; } recaptcha = $('#recaptcha_response_field'); @@ -1834,13 +1834,13 @@ } }; nodeInserted = function(e) { - var callback, dialog, target, _i, _len, _ref, _results; + var callback, dialog, target, _i, _len, _ref2, _results; target = e.target; if (target.nodeName === 'TABLE') { - _ref = g.callbacks; + _ref2 = g.callbacks; _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - callback = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + callback = _ref2[_i]; _results.push(callback(target)); } return _results; @@ -1945,11 +1945,11 @@ }, cb: { node: function(root) { - var thumb, _i, _len, _ref, _results; - _ref = $$('img[md5]', root); + var thumb, _i, _len, _ref2, _results; + _ref2 = $$('img[md5]', root); _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - thumb = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + thumb = _ref2[_i]; $.bind(thumb.parentNode, 'click', imgExpand.cb.toggle); _results.push(imgExpand.on ? imgExpand.toggle(thumb) : void 0); } @@ -1984,12 +1984,12 @@ } }, typeChange: function(e) { - var img, _i, _len, _ref, _results; + var img, _i, _len, _ref2, _results; imgExpand.foo(); - _ref = $$('img[md5] + img'); + _ref2 = $$('img[md5] + img'); _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - img = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + img = _ref2[_i]; _results.push(imgExpand.resize(img)); } return _results; @@ -2033,9 +2033,9 @@ return imgExpand.type = $('#imageType').value; }, resize: function(img) { - var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref; + var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref2; maxWidthOP = imgExpand.maxWidthOP, maxWidthReply = imgExpand.maxWidthReply, maxHeight = imgExpand.maxHeight, type = imgExpand.type; - _ref = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref[0], imgWidth = _ref[1], imgHeight = _ref[2]; + _ref2 = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref2[0], imgWidth = _ref2[1], imgHeight = _ref2[2]; imgWidth = Number(imgWidth); imgHeight = Number(imgHeight); if (img.parentNode.parentNode.nodeName === 'TD') { @@ -2059,15 +2059,15 @@ } }, dialog: function() { - var controls, delform, imageType, option, _i, _len, _ref; + var controls, delform, imageType, option, _i, _len, _ref2; controls = $.el('div', { id: 'imgControls', innerHTML: " " }); imageType = $.getValue('imageType', 'full'); - _ref = $$('option', controls); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - option = _ref[_i]; + _ref2 = $$('option', controls); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + option = _ref2[_i]; if (option.textContent === imageType) { option.selected = true; break; @@ -2088,7 +2088,7 @@ }; main = { init: function() { - var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref, _ref2; + var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref2, _ref3; pathname = location.pathname.substring(1).split('/'); g.BOARD = pathname[0], temp = pathname[1]; if (temp === 'res') { @@ -2127,9 +2127,9 @@ delete hiddenThreads[id]; } } - _ref = g.hiddenReplies; - for (id in _ref) { - timestamp = _ref[id]; + _ref2 = g.hiddenReplies; + for (id in _ref2) { + timestamp = _ref2[id]; if (timestamp < cutoff) { delete g.hiddenReplies[id]; } @@ -2211,9 +2211,9 @@ expandComment.init(); } } - _ref2 = g.callbacks; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - callback = _ref2[_i]; + _ref3 = g.callbacks; + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + callback = _ref3[_i]; callback(); } $.bind(d.body, 'DOMNodeInserted', nodeInserted); From 8d30da48852ddf5163f83171488fe84ea67ea262 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 18:42:25 +0200 Subject: [PATCH 06/13] This is wrong and you know it. --- 4chan_x.js | 14 ++++++++------ script.coffee | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 3e73a3e75..ce589e7d6 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1491,18 +1491,20 @@ return _results; }, refresh: function(watched) { - var board, div, id, props, _results; - while (div = $('#watcher > div:not(.move)')) { + var board, div, id, props, _i, _len, _ref, _results; + _ref = $$('#watcher > div:not(.move)'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + div = _ref[_i]; $.remove(div); } _results = []; for (board in watched) { _results.push((function() { - var _ref, _results2; - _ref = watched[board]; + var _ref2, _results2; + _ref2 = watched[board]; _results2 = []; - for (id in _ref) { - props = _ref[id]; + for (id in _ref2) { + props = _ref2[id]; _results2.push(watcher.addLink(props, $('#watcher'))); } return _results2; diff --git a/script.coffee b/script.coffee index b6087329b..c8cce8408 100644 --- a/script.coffee +++ b/script.coffee @@ -1183,7 +1183,7 @@ watcher = $.before input, favicon refresh: (watched) -> - while div = $ '#watcher > div:not(.move)' + for div in $$ '#watcher > div:not(.move)' $.remove div for board of watched for id, props of watched[board] From b6e3d1f0ecaea64bf94fc6527955e1cb019a3a2b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 21:02:47 +0200 Subject: [PATCH 07/13] Start qr remix. --- 4chan_x.js | 6 +++--- script.coffee | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 865eca94d..16f8dd746 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1142,16 +1142,16 @@ }, dialog: function(link) { var clone, dialog, el, html, resto, script, xpath, _i, _len, _ref; - html = "
Quick Reply X
"; + html = "
Quick Reply X
"; dialog = ui.dialog('qr', { top: '0px', left: '0px' }, html); - el = $('input[title=autohide]', dialog); + el = $('#autohide', dialog); $.bind(el, 'click', qr.cb.autohide); clone = $('#recaptcha_widget_div').cloneNode(true); $.append($('#qr_captcha', dialog), clone); - $('input[name=recaptcha_response_field]', clone).placeholder = 'verification'; + $('input[name=recaptcha_response_field]', clone).placeholder = 'Verification'; $.append(d.body, dialog); return; clone = $('form[name=post]').cloneNode(true); diff --git a/script.coffee b/script.coffee index 78e559597..3ffdfbaa6 100644 --- a/script.coffee +++ b/script.coffee @@ -876,24 +876,25 @@ qr = dialog: (link) -> html = " -
Quick Reply X
+
Quick Reply X
-
-
-
-
+ +
+
+
+
-
-
+
+
" dialog = ui.dialog 'qr', top: '0px', left: '0px', html - el = $ 'input[title=autohide]', dialog + el = $ '#autohide', dialog $.bind el, 'click', qr.cb.autohide clone = $('#recaptcha_widget_div').cloneNode(true) $.append $('#qr_captcha', dialog), clone - $('input[name=recaptcha_response_field]', clone).placeholder = 'verification' + $('input[name=recaptcha_response_field]', clone).placeholder = 'Verification' $.append d.body, dialog return From fa5e083cbc11ef1559c3c293efc3e0fed896a5bb Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 21:26:48 +0200 Subject: [PATCH 08/13] How dare you forget that part? --- 4chan_x.js | 2 +- script.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 16f8dd746..9cc6f1b72 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1142,7 +1142,7 @@ }, dialog: function(link) { var clone, dialog, el, html, resto, script, xpath, _i, _len, _ref; - html = "
Quick Reply X
"; + html = "
Quick Reply X
"; dialog = ui.dialog('qr', { top: '0px', left: '0px' diff --git a/script.coffee b/script.coffee index 3ffdfbaa6..dce7f4763 100644 --- a/script.coffee +++ b/script.coffee @@ -877,10 +877,10 @@ qr = dialog: (link) -> html = "
Quick Reply X
-
+
-
+
From f0ca6782b2c031745381e902641f232f325f637b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 23:04:09 +0200 Subject: [PATCH 09/13] qr remix: Captcha-tan styling --- 4chan_x.js | 34 +++++++++++++++++++++++++++++----- script.coffee | 34 +++++++++++++++++++++++++++++----- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 9cc6f1b72..f24f3d493 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2299,14 +2299,14 @@ #qr #recaptcha_table td:nth-of-type(3) {/* captcha logos */\ display: none;\ }\ - #qr textarea {\ - width: 300px;\ - height: 100px;\ - }\ #qr form {\ margin: 0px;\ }\ - #qr * {\ + #qr textarea {\ + width: 300px;\ + height: 80px;\ + }\ + #qr *:not(input):not(textarea) {\ padding: 0px !important;\ }\ #qr.auto:not(:hover) form {\ @@ -2317,6 +2317,30 @@ bottom: 0;\ left: 0;\ }\ + /* qr reCAPTCHA */\ + #qr_captcha input {\ + margin-top: 3px;\ + padding: 2px 4px 3px;\ + }\ + #qr tr {\ + height: auto;\ + }\ + #qr #recaptcha_reload, #qr #recaptcha_switch_audio, #qr #recaptcha_whatsthis {\ + height: 0;\ + width: 0;\ + padding: 9px 6px !important;\ + margin-left: -16px;\ + position: relative;\ + }\ + #qr_captcha #recaptcha_reload {\ + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAcUlEQVQY02P4z4AKGYKhNJQKYzgIZjxn+I8kwdCGrAkuwRAOZrUwhKBL7GP4ziCPYg8jROI/wzQ0B1yBSXiiCKeBjAMbhab+P0gExFCHu3o3QxzIwSC/MCC5+hPDezDdjOzB/ww/wYw9DCGoPt+CHjQAYxCCmpNUoxoAAAAASUVORK5CYII=) no-repeat center;\ +}\ + #qr_captcha #recaptcha_switch_audio {\ + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAVUlEQVQYV42NMQ6AMAwDPbTQjQEE//8OPCqkhgZXMJBTJMc3BCjBJrlA6uNL1Np6MTordq+N+cLAotHKlxhk/4lMjMu43M9z4CKRmSoJEarqxDOTHidPWTEdrdlTpwAAAABJRU5ErkJggg==) no-repeat center;\ + }\ + #qr_captcha #recaptcha_whatsthis {\ + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAk0lEQVQYV3WMsQ3CMBBFf0ECmYDJqIkFk0TpkcgEUCeegWzADoi0yQbm3cUFBeifrX/vWZZ2f+K4UlDURCKtcua4VfpK64oJDg/a66zFe1hFpN7AHWvnIprY8nPSk9zpVxcTLYukmXZynEWp3peXLpxV9CrF1L6OtDGL2kTB1QBmPTj2pIEUJkwdNehNBpphxOZ3PgIeQ0jaC7S6AAAAAElFTkSuQmCC) no-repeat center;\ + }\ \ #updater {\ position: fixed;\ diff --git a/script.coffee b/script.coffee index dce7f4763..735af9e00 100644 --- a/script.coffee +++ b/script.coffee @@ -1813,14 +1813,14 @@ main = #qr #recaptcha_table td:nth-of-type(3) {/* captcha logos */ display: none; } - #qr textarea { - width: 300px; - height: 100px; - } #qr form { margin: 0px; } - #qr * { + #qr textarea { + width: 300px; + height: 80px; + } + #qr *:not(input):not(textarea) { padding: 0px !important; } #qr.auto:not(:hover) form { @@ -1831,6 +1831,30 @@ main = bottom: 0; left: 0; } + /* qr reCAPTCHA */ + #qr_captcha input { + margin-top: 3px; + padding: 2px 4px 3px; + } + #qr tr { + height: auto; + } + #qr #recaptcha_reload, #qr #recaptcha_switch_audio, #qr #recaptcha_whatsthis { + height: 0; + width: 0; + padding: 9px 6px !important; + margin-left: -16px; + position: relative; + } + #qr_captcha #recaptcha_reload { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAcUlEQVQY02P4z4AKGYKhNJQKYzgIZjxn+I8kwdCGrAkuwRAOZrUwhKBL7GP4ziCPYg8jROI/wzQ0B1yBSXiiCKeBjAMbhab+P0gExFCHu3o3QxzIwSC/MCC5+hPDezDdjOzB/ww/wYw9DCGoPt+CHjQAYxCCmpNUoxoAAAAASUVORK5CYII=) no-repeat center; +} + #qr_captcha #recaptcha_switch_audio { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAVUlEQVQYV42NMQ6AMAwDPbTQjQEE//8OPCqkhgZXMJBTJMc3BCjBJrlA6uNL1Np6MTordq+N+cLAotHKlxhk/4lMjMu43M9z4CKRmSoJEarqxDOTHidPWTEdrdlTpwAAAABJRU5ErkJggg==) no-repeat center; + } + #qr_captcha #recaptcha_whatsthis { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAk0lEQVQYV3WMsQ3CMBBFf0ECmYDJqIkFk0TpkcgEUCeegWzADoi0yQbm3cUFBeifrX/vWZZ2f+K4UlDURCKtcua4VfpK64oJDg/a66zFe1hFpN7AHWvnIprY8nPSk9zpVxcTLYukmXZynEWp3peXLpxV9CrF1L6OtDGL2kTB1QBmPTj2pIEUJkwdNehNBpphxOZ3PgIeQ0jaC7S6AAAAAElFTkSuQmCC) no-repeat center; + } #updater { position: fixed; From f0951b66ad51d2a6a5f3a7f246a2bd2a1e2a34b3 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 23:09:03 +0200 Subject: [PATCH 10/13] Less is more. --- 4chan_x.js | 6 +++--- script.coffee | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index f24f3d493..7399cbc7a 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2332,13 +2332,13 @@ margin-left: -16px;\ position: relative;\ }\ - #qr_captcha #recaptcha_reload {\ + #recaptcha_reload {\ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAcUlEQVQY02P4z4AKGYKhNJQKYzgIZjxn+I8kwdCGrAkuwRAOZrUwhKBL7GP4ziCPYg8jROI/wzQ0B1yBSXiiCKeBjAMbhab+P0gExFCHu3o3QxzIwSC/MCC5+hPDezDdjOzB/ww/wYw9DCGoPt+CHjQAYxCCmpNUoxoAAAAASUVORK5CYII=) no-repeat center;\ }\ - #qr_captcha #recaptcha_switch_audio {\ + #recaptcha_switch_audio {\ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAVUlEQVQYV42NMQ6AMAwDPbTQjQEE//8OPCqkhgZXMJBTJMc3BCjBJrlA6uNL1Np6MTordq+N+cLAotHKlxhk/4lMjMu43M9z4CKRmSoJEarqxDOTHidPWTEdrdlTpwAAAABJRU5ErkJggg==) no-repeat center;\ }\ - #qr_captcha #recaptcha_whatsthis {\ + #recaptcha_whatsthis {\ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAk0lEQVQYV3WMsQ3CMBBFf0ECmYDJqIkFk0TpkcgEUCeegWzADoi0yQbm3cUFBeifrX/vWZZ2f+K4UlDURCKtcua4VfpK64oJDg/a66zFe1hFpN7AHWvnIprY8nPSk9zpVxcTLYukmXZynEWp3peXLpxV9CrF1L6OtDGL2kTB1QBmPTj2pIEUJkwdNehNBpphxOZ3PgIeQ0jaC7S6AAAAAElFTkSuQmCC) no-repeat center;\ }\ \ diff --git a/script.coffee b/script.coffee index 735af9e00..e52384c01 100644 --- a/script.coffee +++ b/script.coffee @@ -1846,13 +1846,13 @@ main = margin-left: -16px; position: relative; } - #qr_captcha #recaptcha_reload { + #recaptcha_reload { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAcUlEQVQY02P4z4AKGYKhNJQKYzgIZjxn+I8kwdCGrAkuwRAOZrUwhKBL7GP4ziCPYg8jROI/wzQ0B1yBSXiiCKeBjAMbhab+P0gExFCHu3o3QxzIwSC/MCC5+hPDezDdjOzB/ww/wYw9DCGoPt+CHjQAYxCCmpNUoxoAAAAASUVORK5CYII=) no-repeat center; } - #qr_captcha #recaptcha_switch_audio { + #recaptcha_switch_audio { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAVUlEQVQYV42NMQ6AMAwDPbTQjQEE//8OPCqkhgZXMJBTJMc3BCjBJrlA6uNL1Np6MTordq+N+cLAotHKlxhk/4lMjMu43M9z4CKRmSoJEarqxDOTHidPWTEdrdlTpwAAAABJRU5ErkJggg==) no-repeat center; } - #qr_captcha #recaptcha_whatsthis { + #recaptcha_whatsthis { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAQAAAD8fJRsAAAAk0lEQVQYV3WMsQ3CMBBFf0ECmYDJqIkFk0TpkcgEUCeegWzADoi0yQbm3cUFBeifrX/vWZZ2f+K4UlDURCKtcua4VfpK64oJDg/a66zFe1hFpN7AHWvnIprY8nPSk9zpVxcTLYukmXZynEWp3peXLpxV9CrF1L6OtDGL2kTB1QBmPTj2pIEUJkwdNehNBpphxOZ3PgIeQ0jaC7S6AAAAAElFTkSuQmCC) no-repeat center; } From 20ecad055d60e47d5818ce4ac5542d5a9ba1d7a6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 23:17:54 +0200 Subject: [PATCH 11/13] qr remix: Fix form action link. --- 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 7399cbc7a..c485bbfe0 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1142,7 +1142,7 @@ }, dialog: function(link) { var clone, dialog, el, html, resto, script, xpath, _i, _len, _ref; - html = "
Quick Reply X
"; + html = "
Quick Reply X
"; dialog = ui.dialog('qr', { top: '0px', left: '0px' diff --git a/script.coffee b/script.coffee index e52384c01..1c2d74c5d 100644 --- a/script.coffee +++ b/script.coffee @@ -877,7 +877,7 @@ qr = dialog: (link) -> html = "
Quick Reply X
-
+
From 5fcc459ca26f1dcdacbc19ae624ffc385ebf5540 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 5 May 2011 00:30:35 +0200 Subject: [PATCH 12/13] qr remix: Fix spoiler only on spoiler powered boards. Fix max file input size. More styling. --- 4chan_x.js | 28 ++++++++++++++++++++-------- script.coffee | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index c485bbfe0..5ae82e68a 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1141,17 +1141,25 @@ } }, dialog: function(link) { - var clone, dialog, el, html, resto, script, xpath, _i, _len, _ref; - html = "
Quick Reply X
"; + var clone, dialog, el, html, resto, script, spoiler, xpath, _i, _len, _ref; + html = "
Quick Reply X
"; dialog = ui.dialog('qr', { top: '0px', left: '0px' }, html); el = $('#autohide', dialog); $.bind(el, 'click', qr.cb.autohide); + $('input[name="MAX_FILE_SIZE"]', dialog).value = $('.postarea input[name="MAX_FILE_SIZE"]').value; + if ($('.postarea label')) { + spoiler = $.el('label', { + innerHTML: " [Spoiler Image?]" + }); + $.append($('div:nth-of-type(2)', dialog), spoiler); + } clone = $('#recaptcha_widget_div').cloneNode(true); $.append($('#qr_captcha', dialog), clone); $('input[name=recaptcha_response_field]', clone).placeholder = 'Verification'; + $('input[name=recaptcha_response_field]', clone).className = 'inputtext'; $.append(d.body, dialog); return; clone = $('form[name=post]').cloneNode(true); @@ -2299,32 +2307,36 @@ #qr #recaptcha_table td:nth-of-type(3) {/* captcha logos */\ display: none;\ }\ - #qr form {\ - margin: 0px;\ + #qr form, #qr #com_submit, #qr input[type="file"] {\ + margin: 0;\ }\ #qr textarea {\ - width: 300px;\ + width: 302px;\ height: 80px;\ }\ #qr *:not(input):not(textarea) {\ - padding: 0px !important;\ + padding: 0 !important;\ }\ #qr.auto:not(:hover) form {\ display: none;\ }\ #qr span.error {\ position: absolute;\ - bottom: 0;\ + top: 0;\ left: 0;\ }\ /* qr reCAPTCHA */\ #qr_captcha input {\ - margin-top: 3px;\ + border: 1px solid #AAA !important;\ + margin-top: 2px;\ padding: 2px 4px 3px;\ }\ #qr tr {\ height: auto;\ }\ + #qr .recaptchatable #recaptcha_image {\ + border: 1px solid #AAA !important;\ + }\ #qr #recaptcha_reload, #qr #recaptcha_switch_audio, #qr #recaptcha_whatsthis {\ height: 0;\ width: 0;\ diff --git a/script.coffee b/script.coffee index 1c2d74c5d..a2857e6be 100644 --- a/script.coffee +++ b/script.coffee @@ -878,23 +878,31 @@ qr = html = "
Quick Reply X
- -
-
-
-
-
-
-
+ +
+
+
+
+
+
+
" dialog = ui.dialog 'qr', top: '0px', left: '0px', html el = $ '#autohide', dialog $.bind el, 'click', qr.cb.autohide + $('input[name="MAX_FILE_SIZE"]', dialog).value = $('.postarea input[name="MAX_FILE_SIZE"]').value + + if $ '.postarea label' + spoiler = $.el 'label', + innerHTML: " [Spoiler Image?]" + $.append $('div:nth-of-type(2)', dialog), spoiler + clone = $('#recaptcha_widget_div').cloneNode(true) $.append $('#qr_captcha', dialog), clone $('input[name=recaptcha_response_field]', clone).placeholder = 'Verification' + $('input[name=recaptcha_response_field]', clone).className = 'inputtext' $.append d.body, dialog return @@ -1813,32 +1821,36 @@ main = #qr #recaptcha_table td:nth-of-type(3) {/* captcha logos */ display: none; } - #qr form { - margin: 0px; + #qr form, #qr #com_submit, #qr input[type="file"] { + margin: 0; } #qr textarea { - width: 300px; + width: 302px; height: 80px; } #qr *:not(input):not(textarea) { - padding: 0px !important; + padding: 0 !important; } #qr.auto:not(:hover) form { display: none; } #qr span.error { position: absolute; - bottom: 0; + top: 0; left: 0; } /* qr reCAPTCHA */ #qr_captcha input { - margin-top: 3px; + border: 1px solid #AAA !important; + margin-top: 2px; padding: 2px 4px 3px; } #qr tr { height: auto; } + #qr .recaptchatable #recaptcha_image { + border: 1px solid #AAA !important; + } #qr #recaptcha_reload, #qr #recaptcha_switch_audio, #qr #recaptcha_whatsthis { height: 0; width: 0; From 7b5d5b04cc718ff7e5db97dfe1a41b5eb78de524 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 5 May 2011 00:56:17 +0200 Subject: [PATCH 13/13] Flushy flushy --- 4chan_x.js | 5 ++++- script.coffee | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 5ae82e68a..761528791 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2307,6 +2307,9 @@ #qr #recaptcha_table td:nth-of-type(3) {/* captcha logos */\ display: none;\ }\ + #qr form {\ + width: 302px;\ + }\ #qr form, #qr #com_submit, #qr input[type="file"] {\ margin: 0;\ }\ @@ -2340,7 +2343,7 @@ #qr #recaptcha_reload, #qr #recaptcha_switch_audio, #qr #recaptcha_whatsthis {\ height: 0;\ width: 0;\ - padding: 9px 6px !important;\ + padding: 10px 6px !important;\ margin-left: -16px;\ position: relative;\ }\ diff --git a/script.coffee b/script.coffee index a2857e6be..ead516f75 100644 --- a/script.coffee +++ b/script.coffee @@ -1821,6 +1821,9 @@ main = #qr #recaptcha_table td:nth-of-type(3) {/* captcha logos */ display: none; } + #qr form { + width: 302px; + } #qr form, #qr #com_submit, #qr input[type="file"] { margin: 0; } @@ -1854,7 +1857,7 @@ main = #qr #recaptcha_reload, #qr #recaptcha_switch_audio, #qr #recaptcha_whatsthis { height: 0; width: 0; - padding: 9px 6px !important; + padding: 10px 6px !important; margin-left: -16px; position: relative; }