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: {
'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 = "<div class=move><span id=count></span> <span id=timer>-" + updater.interval + "</span></div>";
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 = "<div class=move><span id=count></span> <span id=timer>-" + conf['Interval'] + "</span></div>";
checkbox = config.updater.checkbox;
for (name in checkbox) {
title = checkbox[name][1];
checked = checkbox[name] ? 'checked' : '';
html += "<div><label title='" + title + "'>" + name + "<input name='" + name + "' type=checkbox " + checked + "></label></div>";
}
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', {
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)) {

View File

@ -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: ->