From bb3ef77294eb468bbb4a02e325f9bb51c627472d Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 15 Jan 2011 13:36:52 -0800 Subject: [PATCH] add us.o changes apparently I had two branches - one on us.o, one on git. This commit pulls the us.o branch. --- 4chan_x.coffee | 58 ++++++++++++++++++++---------------- 4chan_x.js | 80 +++++++++++++++++++++++++++----------------------- 2 files changed, 76 insertions(+), 62 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index 49e88a7a6..16468618a 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -573,35 +573,36 @@ onloadThread = (responseText, span) -> for reply in replies addTo div, x 'ancestor::table', reply +changeCheckbox = -> + GM_setValue @name, @checked + +changeText = -> + GM_setValue @name, @value + options = -> if div = $ '#options' remove div - else - div = AEOS.makeDialog 'options', 'center' - hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length - html = '
Options X
' - for option, value of config - description = value[1] - checked = if getConfig option then "checked" else "" - html += "
" - html += "
Flavors
" - html += "
" - html += "
" - div.innerHTML = html - $('div.move', div).addEventListener 'mousedown', AEOS.move, true - $('a.pointer', div).addEventListener 'click', optionsClose, true - $('a.sauce', div).addEventListener 'click', editSauce, true - $('textarea', div).value = GM_getValue 'flavors', g.flavors - $('input[type="button"]', div).addEventListener 'click', clearHidden, true - addTo d.body, div + return -optionsClose = -> - div = @parentNode.parentNode - inputs = $$ 'input', div - for input in inputs - GM_setValue(input.name, input.checked) - GM_setValue 'flavors', $('textarea', div).value - remove div + div = AEOS.makeDialog 'options', 'center' + hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length + html = '
Options X
' + for option, value of config + description = value[1] + checked = if getConfig option then "checked" else "" + html += "
" + html += "
Flavors
" + html += "
" + html += "
" + div.innerHTML = html + $('div.move', div).addEventListener 'mousedown', AEOS.move, true + $('a[name=close]', div).addEventListener 'click', (-> remove($ '#options')), true + for input in $$ 'input', div + input.addEventListener 'change', changeCheckbox, true + $('a.sauce', div).addEventListener 'click', editSauce, true + $('textarea', div).addEventListener 'change', changeText, true + $('input[type="button"]', div).addEventListener 'click', clearHidden, true + addTo d.body, div parseResponse = (responseText) -> body = n 'body', @@ -877,7 +878,8 @@ updateInterval = -> span.textContent = -1 * num updateNow = -> - g.req = request location.href, updateCallback + url = location.href + '?' + new Date().getTime() # fool the cache + g.req = request url, updateCallback updaterMake = -> div = AEOS.makeDialog 'updater', 'topright' @@ -1011,6 +1013,10 @@ if lastChecked < now - 1*DAY GM_setValue('lastChecked', now) GM_addStyle ' + #options textarea { + height: 100px; + width: 500px; + } #updater { position: fixed; text-align: right; diff --git a/4chan_x.js b/4chan_x.js index cd1ed4851..b896283d2 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1,5 +1,5 @@ (function() { - var $, $$, AEOS, DAY, a, addTo, arr, as, autoWatch, autohide, b, board, callback, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageExpandClick, imageFull, imageThumb, imageToggle, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, request, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, tzOffset, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _ref, _ref2, _ref3, _ref4, _ref5; + var $, $$, AEOS, DAY, a, addTo, arr, as, autoWatch, autohide, b, board, callback, changeCheckbox, changeText, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageExpandClick, imageFull, imageThumb, imageToggle, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, request, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, tzOffset, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _ref, _ref2, _ref3, _ref4, _ref5; var __slice = Array.prototype.slice; config = { '404 Redirect': [true, 'Redirect dead threads'], @@ -737,42 +737,44 @@ return _results2; } }; - options = function() { - var checked, description, div, hiddenNum, html, option, value; - if (div = $('#options')) { - return remove(div); - } else { - div = AEOS.makeDialog('options', 'center'); - hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length; - html = '
Options X
'; - for (option in config) { - value = config[option]; - description = value[1]; - checked = getConfig(option) ? "checked" : ""; - html += "
"; - } - html += "
Flavors
"; - html += "
"; - html += "
"; - div.innerHTML = html; - $('div.move', div).addEventListener('mousedown', AEOS.move, true); - $('a.pointer', div).addEventListener('click', optionsClose, true); - $('a.sauce', div).addEventListener('click', editSauce, true); - $('textarea', div).value = GM_getValue('flavors', g.flavors); - $('input[type="button"]', div).addEventListener('click', clearHidden, true); - return addTo(d.body, div); - } + changeCheckbox = function() { + return GM_setValue(this.name, this.checked); }; - optionsClose = function() { - var div, input, inputs, _i, _len; - div = this.parentNode.parentNode; - inputs = $$('input', div); - for (_i = 0, _len = inputs.length; _i < _len; _i++) { - input = inputs[_i]; - GM_setValue(input.name, input.checked); + changeText = function() { + return GM_setValue(this.name, this.value); + }; + options = function() { + var checked, description, div, hiddenNum, html, input, option, value, _i, _len, _ref; + if (div = $('#options')) { + remove(div); + return; } - GM_setValue('flavors', $('textarea', div).value); - return remove(div); + div = AEOS.makeDialog('options', 'center'); + hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length; + html = '
Options X
'; + for (option in config) { + value = config[option]; + description = value[1]; + checked = getConfig(option) ? "checked" : ""; + html += "
"; + } + html += ""; + html += "
"; + html += "
"; + div.innerHTML = html; + $('div.move', div).addEventListener('mousedown', AEOS.move, true); + $('a[name=close]', div).addEventListener('click', (function() { + return remove($('#options')); + }), true); + _ref = $$('input', div); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + input = _ref[_i]; + input.addEventListener('change', changeCheckbox, true); + } + $('a.sauce', div).addEventListener('click', editSauce, true); + $('textarea', div).addEventListener('change', changeText, true); + $('input[type="button"]', div).addEventListener('click', clearHidden, true); + return addTo(d.body, div); }; parseResponse = function(responseText) { var body, opbq, replies; @@ -1111,7 +1113,9 @@ } }; updateNow = function() { - return g.req = request(location.href, updateCallback); + var url; + url = location.href + '?' + new Date().getTime(); + return g.req = request(url, updateCallback); }; updaterMake = function() { var auto, div, html, interval; @@ -1257,6 +1261,10 @@ GM_setValue('lastChecked', now); } GM_addStyle('\ + #options textarea {\ + height: 100px;\ + width: 500px;\ + }\ #updater {\ position: fixed;\ text-align: right;\