Use conf, shave two lines, ircScroll -> scroll
This commit is contained in:
parent
b71bd0298f
commit
b6ed1fbf0f
@ -1593,7 +1593,9 @@
|
|||||||
updater.cb.autoUpdate.call(input);
|
updater.cb.autoUpdate.call(input);
|
||||||
}
|
}
|
||||||
} else if (input.name === 'Interval') {
|
} else if (input.name === 'Interval') {
|
||||||
$.bind(input, 'change', updater.cb.interval);
|
$.bind(input, 'change', function() {
|
||||||
|
return conf['Interval'] = this.value = parseInt(this.value) || conf['Interval'];
|
||||||
|
});
|
||||||
$.bind(input, 'change', $.cb.value);
|
$.bind(input, 'change', $.cb.value);
|
||||||
} else if (input.type === 'button') {
|
} else if (input.type === 'button') {
|
||||||
$.bind(input, 'click', updater.updateNow);
|
$.bind(input, 'click', updater.updateNow);
|
||||||
@ -1615,17 +1617,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
autoUpdate: function() {
|
autoUpdate: function() {
|
||||||
if (this.checked) {
|
if (conf['Auto Update This']) {
|
||||||
return updater.intervalID = window.setInterval(updater.timeout, 1000);
|
return updater.intervalID = window.setInterval(updater.timeout, 1000);
|
||||||
} else {
|
} else {
|
||||||
return window.clearInterval(updater.intervalID);
|
return window.clearInterval(updater.intervalID);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
interval: function() {
|
|
||||||
return conf['Interval'] = this.value = parseInt(this.value) || conf['Interval'];
|
|
||||||
},
|
|
||||||
update: function() {
|
update: function() {
|
||||||
var arr, body, br, id, input, ircScroll, replies, reply, _i, _len, _ref, _ref2;
|
var arr, body, br, id, input, replies, reply, scroll, _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;
|
||||||
@ -1652,7 +1651,7 @@
|
|||||||
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);
|
||||||
}
|
}
|
||||||
ircScroll = conf['Scrolling'] && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20);
|
scroll = conf['Scrolling'] && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20);
|
||||||
updater.timer.textContent = '-' + conf['Interval'];
|
updater.timer.textContent = '-' + conf['Interval'];
|
||||||
if (conf['Verbose']) {
|
if (conf['Verbose']) {
|
||||||
updater.count.textContent = '+' + arr.length;
|
updater.count.textContent = '+' + arr.length;
|
||||||
@ -1665,7 +1664,7 @@
|
|||||||
while (reply = arr.pop()) {
|
while (reply = arr.pop()) {
|
||||||
$.before(br, reply);
|
$.before(br, reply);
|
||||||
}
|
}
|
||||||
if (ircScroll) {
|
if (scroll) {
|
||||||
return scrollTo(0, d.body.scrollHeight);
|
return scrollTo(0, d.body.scrollHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1297,7 +1297,7 @@ updater =
|
|||||||
$.bind input, 'click', updater.cb.autoUpdate
|
$.bind input, 'click', updater.cb.autoUpdate
|
||||||
updater.cb.autoUpdate.call input
|
updater.cb.autoUpdate.call input
|
||||||
else if input.name is 'Interval'
|
else if input.name is 'Interval'
|
||||||
$.bind input, 'change', updater.cb.interval
|
$.bind input, 'change', -> conf['Interval'] = @value = parseInt(@value) or conf['Interval']
|
||||||
$.bind input, 'change', $.cb.value
|
$.bind input, 'change', $.cb.value
|
||||||
else if input.type is 'button'
|
else if input.type is 'button'
|
||||||
$.bind input, 'click', updater.updateNow
|
$.bind input, 'click', updater.updateNow
|
||||||
@ -1315,12 +1315,10 @@ updater =
|
|||||||
textContent: 'Thread Updater'
|
textContent: 'Thread Updater'
|
||||||
$.hide updater.timer
|
$.hide updater.timer
|
||||||
autoUpdate: ->
|
autoUpdate: ->
|
||||||
if @checked
|
if conf['Auto Update This']
|
||||||
updater.intervalID = window.setInterval updater.timeout, 1000
|
updater.intervalID = window.setInterval updater.timeout, 1000
|
||||||
else
|
else
|
||||||
window.clearInterval updater.intervalID
|
window.clearInterval updater.intervalID
|
||||||
interval: ->
|
|
||||||
conf['Interval'] = @value = parseInt(@value) or conf['Interval']
|
|
||||||
update: ->
|
update: ->
|
||||||
if @status is 404
|
if @status is 404
|
||||||
updater.timer.textContent = ''
|
updater.timer.textContent = ''
|
||||||
@ -1345,7 +1343,7 @@ updater =
|
|||||||
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
|
||||||
|
|
||||||
ircScroll = conf['Scrolling'] && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20)
|
scroll = conf['Scrolling'] && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20)
|
||||||
|
|
||||||
updater.timer.textContent = '-' + conf['Interval']
|
updater.timer.textContent = '-' + conf['Interval']
|
||||||
if conf['Verbose']
|
if conf['Verbose']
|
||||||
@ -1358,7 +1356,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 ircScroll
|
if scroll
|
||||||
scrollTo 0, d.body.scrollHeight
|
scrollTo 0, d.body.scrollHeight
|
||||||
|
|
||||||
timeout: ->
|
timeout: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user