diff --git a/4chan_x.user.js b/4chan_x.user.js index 9b318a25c..9cf45dfa5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -89,7 +89,6 @@ }, Monitoring: { 'Thread Updater': [true, 'Update threads'], - 'IRC Updating': [false, 'Scroll updated posts into view'], 'Unread Count': [true, 'Show unread post count in tab title'], 'Post in Title': [true, 'Show the op\'s post in the tab title'], 'Thread Stats': [true, 'Display reply and image count'], @@ -139,6 +138,7 @@ updater: { checkbox: { 'Verbose': [true, 'Show countdown timer, new post count'], + 'IRC Updating': [false, 'Scroll updated posts into view'], 'Auto Update': [true, 'Automatically fetch new posts'] }, 'Interval': 30 @@ -1561,19 +1561,16 @@ }; updater = { init: function() { - var autoUpT, checked, dialog, html, input, interva, name, title, updNow, verbose, _i, _len, _ref; - updater.interval = conf['Interval']; - updater.ircUpd = conf['IRC Updating']; - updater.verbose = conf['Verbose']; - html = "
-" + updater.interval + "
"; - conf = config.updater.checkbox; - for (name in conf) { - title = conf[name][1]; - checked = conf[name] ? 'checked' : ''; + var autoUpT, checkbox, checked, dialog, html, input, interva, name, title, updNow, verbose, _i, _len, _ref; + html = "
-" + conf['Interval'] + "
"; + checkbox = config.updater.checkbox; + for (name in checkbox) { + title = checkbox[name][1]; + checked = checkbox[name] ? 'checked' : ''; html += "
"; } checked = conf['Auto Update'] ? 'checked' : ''; - html += "
"; + html += "
"; dialog = ui.dialog('updater', { bottom: '0', right: '0' @@ -1600,7 +1597,7 @@ }, cb: { verbose: function() { - if (updater.verbose = this.checked) { + if (conf['Verbose'] = this.checked) { updater.count.textContent = '+0'; return $.show(updater.timer); } else { @@ -1619,10 +1616,10 @@ } }, interval: function() { - return updater.interval = this.value = this.value.match(/\d+/)[0]; + return conf['Interval'] = this.value = this.value.match(/\d+/)[0]; }, update: function() { - var arr, body, br, id, input, replies, reply, _i, _len, _ref, _ref2; + var arr, body, br, id, input, length, replies, reply, _i, _len, _ref, _ref2; if (this.status === 404) { updater.timer.textContent = ''; updater.count.textContent = 404; @@ -1649,8 +1646,9 @@ while ((reply = replies.pop()) && (reply.id > id)) { arr.push(reply.parentNode.parentNode.parentNode); } - updater.timer.textContent = '-' + updater.interval; - if (updater.verbose) { + length = arr.length; + updater.timer.textContent = '-' + conf['Interval']; + if (conf['Verbose']) { updater.count.textContent = '+' + arr.length; if (arr.length === 0) { updater.count.className = ''; @@ -1661,7 +1659,7 @@ while (reply = arr.pop()) { $.before(br, reply); } - if (updater.ircUpd) { + if (conf['IRC Updating'] && length) { return scrollTo(0, d.body.scrollHeight); } } @@ -2133,7 +2131,6 @@ }; quotePreview = { init: function() { - quotePreview.hl = conf['Quote Highlighting']; return g.callbacks.push(function(root) { var quote, _i, _len, _ref, _results; _ref = $$('a.quotelink, a.backlink', root); @@ -2160,7 +2157,7 @@ id = this.hash.slice(1); if (el = d.getElementById(id)) { qp.innerHTML = el.innerHTML; - if (quotePreview.hl) { + if (conf['Quote Highlighting']) { $.addClass(el, 'qphl'); } if (/backlink/.test(this.className)) { diff --git a/script.coffee b/script.coffee index c916a675c..391b89cb0 100644 --- a/script.coffee +++ b/script.coffee @@ -23,7 +23,6 @@ config = 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] Monitoring: 'Thread Updater': [true, 'Update threads'] - 'IRC Updating': [false, 'Scroll updated posts into view'] 'Unread Count': [true, 'Show unread post count in tab title'] 'Post in Title': [true, 'Show the op\'s post in the tab title'] 'Thread Stats': [true, 'Display reply and image count'] @@ -73,8 +72,9 @@ config = update: 'u' updater: checkbox: - 'Verbose': [true, 'Show countdown timer, new post count'] - 'Auto Update': [true, 'Automatically fetch new posts'] + 'Verbose': [true, 'Show countdown timer, new post count'] + 'IRC Updating': [false, 'Scroll updated posts into view'] + 'Auto Update': [true, 'Automatically fetch new posts'] 'Interval': 30 # flatten the config @@ -1344,6 +1344,7 @@ updater = replies = $$ 'td[id]', body while (reply = replies.pop()) and (reply.id > id) arr.push reply.parentNode.parentNode.parentNode #table + length = arr.length updater.timer.textContent = '-' + conf['Interval'] if conf['Verbose'] @@ -1356,7 +1357,7 @@ updater = #XXX add replies in correct order so backlinks resolve while reply = arr.pop() $.before br, reply - if conf['IRC Updating'] + if conf['IRC Updating'] && length scrollTo 0, d.body.scrollHeight timeout: ->