use conf instead of duplicating

This commit is contained in:
James Campos 2011-07-23 19:19:29 -07:00
parent dcfcebe862
commit 9835316720

View File

@ -1268,21 +1268,17 @@ threadHiding =
updater = updater =
init: -> init: ->
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
updater.verbose = conf['Verbose'] for name of checkbox
title = checkbox[name][1]
html = "<div class=move><span id=count></span> <span id=timer>-#{updater.interval}</span></div>" checked = if checkbox[name] then 'checked' else ''
conf = config.updater.checkbox
for name of conf
title = conf[name][1]
checked = if conf[name] then 'checked' else ''
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 = if conf['Auto Update'] then 'checked' else '' checked = if conf['Auto Update'] then 'checked' else ''
html += " 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 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><label>Interval (s)<input name=Interval value=#{conf['Interval']} type=text></label></div>
<div><input value='Update Now' type=button></div>" <div><input value='Update Now' type=button></div>"
dialog = ui.dialog 'updater', bottom: '0', right: '0', html dialog = ui.dialog 'updater', bottom: '0', right: '0', html
@ -1310,7 +1306,7 @@ updater =
cb: cb:
verbose: -> verbose: ->
if updater.verbose = @checked if conf['Verbose'] = @checked
updater.count.textContent = '+0' updater.count.textContent = '+0'
$.show updater.timer $.show updater.timer
else else
@ -1324,7 +1320,7 @@ updater =
else else
window.clearInterval updater.intervalID window.clearInterval updater.intervalID
interval: -> interval: ->
updater.interval = @value = @value.match(/\d+/)[0] conf['Interval'] = @value = @value.match(/\d+/)[0]
update: -> update: ->
if @status is 404 if @status is 404
updater.timer.textContent = '' updater.timer.textContent = ''
@ -1349,8 +1345,8 @@ 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
updater.timer.textContent = '-' + updater.interval updater.timer.textContent = '-' + conf['Interval']
if updater.verbose if conf['Verbose']
updater.count.textContent = '+' + arr.length updater.count.textContent = '+' + arr.length
if arr.length is 0 if arr.length is 0
updater.count.className = '' updater.count.className = ''
@ -1360,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 updater.ircUpd if conf['IRC Updating']
scrollTo 0, d.body.scrollHeight scrollTo 0, d.body.scrollHeight
timeout: -> timeout: ->
@ -1664,7 +1660,6 @@ quoteInline =
quotePreview = quotePreview =
init: -> init: ->
quotePreview.hl = conf['Quote Highlighting']
g.callbacks.push (root) -> g.callbacks.push (root) ->
for quote in $$ 'a.quotelink, a.backlink', root for quote in $$ 'a.quotelink, a.backlink', root
continue unless quote.hash continue unless quote.hash
@ -1680,7 +1675,7 @@ quotePreview =
id = @hash[1..] id = @hash[1..]
if el = d.getElementById id if el = d.getElementById id
qp.innerHTML = el.innerHTML qp.innerHTML = el.innerHTML
$.addClass el, 'qphl' if quotePreview.hl $.addClass el, 'qphl' if conf['Quote Highlighting']
if /backlink/.test @className if /backlink/.test @className
replyID = $.x('ancestor::*[@id][1]', @).id.match(/\d+/)[0] replyID = $.x('ancestor::*[@id][1]', @).id.match(/\d+/)[0]
for quote in $$ 'a.quotelink', qp for quote in $$ 'a.quotelink', qp