Less IO; msoueout -> mouseout.

This commit is contained in:
Nicolas Stepien 2011-07-22 04:15:00 +02:00
parent e8a06be0f5
commit 944f70a64a
2 changed files with 28 additions and 17 deletions

View File

@ -1563,6 +1563,8 @@
init: function() { init: function() {
var autoUpT, checked, conf, dialog, html, input, interva, name, title, updNow, verbose, _i, _len, _ref; var autoUpT, checked, conf, dialog, html, input, interva, name, title, updNow, verbose, _i, _len, _ref;
updater.interval = $.config('Interval'); updater.interval = $.config('Interval');
updater.ircUpd = $.config('IRC Updating');
updater.verbose = $.config('Verbose');
html = "<div class=move><span id=count></span> <span id=timer>-" + updater.interval + "</span></div>"; html = "<div class=move><span id=count></span> <span id=timer>-" + updater.interval + "</span></div>";
conf = config.updater.checkbox; conf = config.updater.checkbox;
for (name in conf) { for (name in conf) {
@ -1648,7 +1650,7 @@
arr.push(reply.parentNode.parentNode.parentNode); arr.push(reply.parentNode.parentNode.parentNode);
} }
updater.timer.textContent = '-' + updater.interval; updater.timer.textContent = '-' + updater.interval;
if ($.config('Verbose')) { if (updater.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 = '';
@ -1659,7 +1661,7 @@
while (reply = arr.pop()) { while (reply = arr.pop()) {
$.before(br, reply); $.before(br, reply);
} }
if ($.config('IRC Updating')) { if (updater.ircUpd) {
return scrollTo(0, d.body.scrollHeight); return scrollTo(0, d.body.scrollHeight);
} }
} }
@ -1976,14 +1978,16 @@
}; };
quoteBacklink = { quoteBacklink = {
init: function() { init: function() {
quoteBacklink.opbl = !$.config('OP Backlinks');
quoteBacklink.qp = $.config('Quote Preview');
quoteBacklink.qi = $.config('Quote Inline');
return g.callbacks.push(function(root) { return g.callbacks.push(function(root) {
var container, el, id, link, opbl, qid, quote, quotes, _i, _len, _ref, _results; var container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results;
if (/inline/.test(root.className)) { if (/inline/.test(root.className)) {
return; return;
} }
id = root.id || $('td[id]', root).id; id = root.id || $('td[id]', root).id;
quotes = {}; quotes = {};
opbl = !$.config('OP Backlinks');
_ref = $$('a.quotelink', root); _ref = $$('a.quotelink', root);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
@ -1997,7 +2001,7 @@
if (!(el = d.getElementById(qid))) { if (!(el = d.getElementById(qid))) {
continue; continue;
} }
if (opbl && el.className === 'op') { if (quoteBacklink.opbl && el.className === 'op') {
continue; continue;
} }
link = $.el('a', { link = $.el('a', {
@ -2005,12 +2009,12 @@
className: 'backlink', className: 'backlink',
textContent: ">>" + id textContent: ">>" + id
}); });
if ($.config('Quote Preview')) { if (quoteBacklink.qp) {
$.bind(link, 'mouseover', quotePreview.mouseover); $.bind(link, 'mouseover', quotePreview.mouseover);
$.bind(link, 'mousemove', ui.hover); $.bind(link, 'mousemove', ui.hover);
$.bind(link, 'mouseout', quotePreview.mouseout); $.bind(link, 'mouseout', quotePreview.mouseout);
} }
if ($.config('Quote Inline')) { if (quoteBacklink.qi) {
$.bind(link, 'click', quoteInline.toggle); $.bind(link, 'click', quoteInline.toggle);
} }
if (!(container = $('.container', el))) { if (!(container = $('.container', el))) {
@ -2129,6 +2133,7 @@
}; };
quotePreview = { quotePreview = {
init: function() { init: function() {
quotePreview.hl = $.config('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);
@ -2141,7 +2146,7 @@
$.bind(quote, 'mouseover', quotePreview.mouseover); $.bind(quote, 'mouseover', quotePreview.mouseover);
$.bind(quote, 'mousemove', ui.hover); $.bind(quote, 'mousemove', ui.hover);
$.bind(quote, 'mouseout', quotePreview.mouseout); $.bind(quote, 'mouseout', quotePreview.mouseout);
_results.push($.bind(quote, 'msoueout', ui.hoverend)); _results.push($.bind(quote, 'mouseout', ui.hoverend));
} }
return _results; return _results;
}); });
@ -2156,7 +2161,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 ($.config('Quote Highlighting')) { if (quotePreview.hl) {
$.addClass(el, 'qphl'); $.addClass(el, 'qphl');
} }
if (/backlink/.test(this.className)) { if (/backlink/.test(this.className)) {

View File

@ -1267,6 +1267,9 @@ threadHiding =
updater = updater =
init: -> init: ->
updater.interval = $.config 'Interval' updater.interval = $.config 'Interval'
updater.ircUpd = $.config 'IRC Updating'
updater.verbose = $.config 'Verbose'
html = "<div class=move><span id=count></span> <span id=timer>-#{updater.interval}</span></div>" html = "<div class=move><span id=count></span> <span id=timer>-#{updater.interval}</span></div>"
conf = config.updater.checkbox conf = config.updater.checkbox
for name of conf for name of conf
@ -1345,7 +1348,7 @@ updater =
arr.push reply.parentNode.parentNode.parentNode #table arr.push reply.parentNode.parentNode.parentNode #table
updater.timer.textContent = '-' + updater.interval updater.timer.textContent = '-' + updater.interval
if $.config 'Verbose' if updater.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 = ''
@ -1355,7 +1358,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 $.config 'IRC Updating' if updater.ircUpd
scrollTo 0, d.body.scrollHeight scrollTo 0, d.body.scrollHeight
timeout: -> timeout: ->
@ -1560,12 +1563,14 @@ titlePost =
quoteBacklink = quoteBacklink =
init: -> init: ->
quoteBacklink.opbl = ! $.config 'OP Backlinks'
quoteBacklink.qp = $.config 'Quote Preview'
quoteBacklink.qi = $.config 'Quote Inline'
g.callbacks.push (root) -> g.callbacks.push (root) ->
return if /inline/.test root.className return if /inline/.test root.className
# op or reply # op or reply
id = root.id or $('td[id]', root).id id = root.id or $('td[id]', root).id
quotes = {} quotes = {}
opbl = ! $.config 'OP Backlinks'
for quote in $$ 'a.quotelink', root for quote in $$ 'a.quotelink', root
#don't process >>>/b/ #don't process >>>/b/
continue unless qid = quote.hash[1..] continue unless qid = quote.hash[1..]
@ -1574,16 +1579,16 @@ quoteBacklink =
for qid of quotes for qid of quotes
continue unless el = d.getElementById qid continue unless el = d.getElementById qid
#don't backlink the op #don't backlink the op
continue if opbl and el.className is 'op' continue if quoteBacklink.opbl and el.className is 'op'
link = $.el 'a', link = $.el 'a',
href: "##{id}" href: "##{id}"
className: 'backlink' className: 'backlink'
textContent: ">>#{id}" textContent: ">>#{id}"
if $.config 'Quote Preview' if quoteBacklink.qp
$.bind link, 'mouseover', quotePreview.mouseover $.bind link, 'mouseover', quotePreview.mouseover
$.bind link, 'mousemove', ui.hover $.bind link, 'mousemove', ui.hover
$.bind link, 'mouseout', quotePreview.mouseout $.bind link, 'mouseout', quotePreview.mouseout
if $.config 'Quote Inline' if quoteBacklink.qi
$.bind link, 'click', quoteInline.toggle $.bind link, 'click', quoteInline.toggle
unless container = $ '.container', el unless container = $ '.container', el
container = $.el 'span', className: 'container' container = $.el 'span', className: 'container'
@ -1657,13 +1662,14 @@ quoteInline =
quotePreview = quotePreview =
init: -> init: ->
quotePreview.hl = $.config '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
$.bind quote, 'mouseover', quotePreview.mouseover $.bind quote, 'mouseover', quotePreview.mouseover
$.bind quote, 'mousemove', ui.hover $.bind quote, 'mousemove', ui.hover
$.bind quote, 'mouseout', quotePreview.mouseout $.bind quote, 'mouseout', quotePreview.mouseout
$.bind quote, 'msoueout', ui.hoverend $.bind quote, 'mouseout', ui.hoverend
mouseover: (e) -> mouseover: (e) ->
qp = ui.el = $.el 'div', qp = ui.el = $.el 'div',
id: 'qp' id: 'qp'
@ -1673,7 +1679,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 $.config 'Quote Highlighting' $.addClass el, 'qphl' if quotePreview.hl
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