This commit is contained in:
James Campos 2011-07-23 19:20:43 -07:00
commit ec5ccc153e
2 changed files with 21 additions and 23 deletions

View File

@ -89,7 +89,6 @@
}, },
Monitoring: { Monitoring: {
'Thread Updater': [true, 'Update threads'], 'Thread Updater': [true, 'Update threads'],
'IRC Updating': [false, 'Scroll updated posts into view'],
'Unread Count': [true, 'Show unread post count in tab title'], 'Unread Count': [true, 'Show unread post count in tab title'],
'Post in Title': [true, 'Show the op\'s post in the tab title'], 'Post in Title': [true, 'Show the op\'s post in the tab title'],
'Thread Stats': [true, 'Display reply and image count'], 'Thread Stats': [true, 'Display reply and image count'],
@ -139,6 +138,7 @@
updater: { updater: {
checkbox: { checkbox: {
'Verbose': [true, 'Show countdown timer, new post count'], 'Verbose': [true, 'Show countdown timer, new post count'],
'IRC Updating': [false, 'Scroll updated posts into view'],
'Auto Update': [true, 'Automatically fetch new posts'] 'Auto Update': [true, 'Automatically fetch new posts']
}, },
'Interval': 30 'Interval': 30
@ -1561,19 +1561,16 @@
}; };
updater = { updater = {
init: function() { init: function() {
var autoUpT, checked, dialog, html, input, interva, name, title, updNow, verbose, _i, _len, _ref; var autoUpT, checkbox, checked, dialog, html, input, interva, name, title, updNow, verbose, _i, _len, _ref;
updater.interval = conf['Interval']; html = "<div class=move><span id=count></span> <span id=timer>-" + conf['Interval'] + "</span></div>";
updater.ircUpd = conf['IRC Updating']; checkbox = config.updater.checkbox;
updater.verbose = conf['Verbose']; for (name in checkbox) {
html = "<div class=move><span id=count></span> <span id=timer>-" + updater.interval + "</span></div>"; title = checkbox[name][1];
conf = config.updater.checkbox; checked = checkbox[name] ? 'checked' : '';
for (name in conf) {
title = conf[name][1];
checked = conf[name] ? 'checked' : '';
html += "<div><label title='" + title + "'>" + name + "<input name='" + name + "' type=checkbox " + checked + "></label></div>"; html += "<div><label title='" + title + "'>" + name + "<input name='" + name + "' type=checkbox " + checked + "></label></div>";
} }
checked = conf['Auto Update'] ? 'checked' : ''; checked = conf['Auto Update'] ? 'checked' : '';
html += " <div><label title='Controls whether *this* thread auotmatically updates or not'>Auto Update This<input name='Auto Update This' type=checkbox " + checked + "></label></div> <div><label>Interval (s)<input name=Interval value=" + updater.interval + " type=text></label></div> <div><input value='Update Now' type=button></div>"; html += " <div><label title='Controls whether *this* thread auotmatically updates or not'>Auto Update This<input name='Auto Update This' type=checkbox " + checked + "></label></div> <div><label>Interval (s)<input name=Interval value=" + conf['Interval'] + " type=text></label></div> <div><input value='Update Now' type=button></div>";
dialog = ui.dialog('updater', { dialog = ui.dialog('updater', {
bottom: '0', bottom: '0',
right: '0' right: '0'
@ -1600,7 +1597,7 @@
}, },
cb: { cb: {
verbose: function() { verbose: function() {
if (updater.verbose = this.checked) { if (conf['Verbose'] = this.checked) {
updater.count.textContent = '+0'; updater.count.textContent = '+0';
return $.show(updater.timer); return $.show(updater.timer);
} else { } else {
@ -1619,10 +1616,10 @@
} }
}, },
interval: function() { interval: function() {
return updater.interval = this.value = this.value.match(/\d+/)[0]; return conf['Interval'] = this.value = this.value.match(/\d+/)[0];
}, },
update: function() { 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) { if (this.status === 404) {
updater.timer.textContent = ''; updater.timer.textContent = '';
updater.count.textContent = 404; updater.count.textContent = 404;
@ -1649,8 +1646,9 @@
while ((reply = replies.pop()) && (reply.id > id)) { while ((reply = replies.pop()) && (reply.id > id)) {
arr.push(reply.parentNode.parentNode.parentNode); arr.push(reply.parentNode.parentNode.parentNode);
} }
updater.timer.textContent = '-' + updater.interval; length = arr.length;
if (updater.verbose) { updater.timer.textContent = '-' + conf['Interval'];
if (conf['Verbose']) {
updater.count.textContent = '+' + arr.length; updater.count.textContent = '+' + arr.length;
if (arr.length === 0) { if (arr.length === 0) {
updater.count.className = ''; updater.count.className = '';
@ -1661,7 +1659,7 @@
while (reply = arr.pop()) { while (reply = arr.pop()) {
$.before(br, reply); $.before(br, reply);
} }
if (updater.ircUpd) { if (conf['IRC Updating'] && length) {
return scrollTo(0, d.body.scrollHeight); return scrollTo(0, d.body.scrollHeight);
} }
} }
@ -2133,7 +2131,6 @@
}; };
quotePreview = { quotePreview = {
init: function() { init: function() {
quotePreview.hl = conf['Quote Highlighting'];
return g.callbacks.push(function(root) { return g.callbacks.push(function(root) {
var quote, _i, _len, _ref, _results; var quote, _i, _len, _ref, _results;
_ref = $$('a.quotelink, a.backlink', root); _ref = $$('a.quotelink, a.backlink', root);
@ -2160,7 +2157,7 @@
id = this.hash.slice(1); id = this.hash.slice(1);
if (el = d.getElementById(id)) { if (el = d.getElementById(id)) {
qp.innerHTML = el.innerHTML; qp.innerHTML = el.innerHTML;
if (quotePreview.hl) { if (conf['Quote Highlighting']) {
$.addClass(el, 'qphl'); $.addClass(el, 'qphl');
} }
if (/backlink/.test(this.className)) { if (/backlink/.test(this.className)) {

View File

@ -23,7 +23,6 @@ config =
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
Monitoring: Monitoring:
'Thread Updater': [true, 'Update threads'] 'Thread Updater': [true, 'Update threads']
'IRC Updating': [false, 'Scroll updated posts into view']
'Unread Count': [true, 'Show unread post count in tab title'] 'Unread Count': [true, 'Show unread post count in tab title']
'Post in Title': [true, 'Show the op\'s post in the tab title'] 'Post in Title': [true, 'Show the op\'s post in the tab title']
'Thread Stats': [true, 'Display reply and image count'] 'Thread Stats': [true, 'Display reply and image count']
@ -73,8 +72,9 @@ config =
update: 'u' update: 'u'
updater: updater:
checkbox: checkbox:
'Verbose': [true, 'Show countdown timer, new post count'] 'Verbose': [true, 'Show countdown timer, new post count']
'Auto Update': [true, 'Automatically fetch new posts'] 'IRC Updating': [false, 'Scroll updated posts into view']
'Auto Update': [true, 'Automatically fetch new posts']
'Interval': 30 'Interval': 30
# flatten the config # flatten the config
@ -1344,6 +1344,7 @@ updater =
replies = $$ 'td[id]', body replies = $$ 'td[id]', body
while (reply = replies.pop()) and (reply.id > id) while (reply = replies.pop()) and (reply.id > id)
arr.push reply.parentNode.parentNode.parentNode #table arr.push reply.parentNode.parentNode.parentNode #table
length = arr.length
updater.timer.textContent = '-' + conf['Interval'] updater.timer.textContent = '-' + conf['Interval']
if conf['Verbose'] if conf['Verbose']
@ -1356,7 +1357,7 @@ updater =
#XXX add replies in correct order so backlinks resolve #XXX add replies in correct order so backlinks resolve
while reply = arr.pop() while reply = arr.pop()
$.before br, reply $.before br, reply
if conf['IRC Updating'] if conf['IRC Updating'] && length
scrollTo 0, d.body.scrollHeight scrollTo 0, d.body.scrollHeight
timeout: -> timeout: ->