check for quote.hash before binding
ui.hover doesn't care if we `return`ed in the mouseover function
This commit is contained in:
parent
696bb15b36
commit
e6101a5efa
14
4chan_x.js
14
4chan_x.js
@ -1738,6 +1738,9 @@
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quote = _ref[_i];
|
quote = _ref[_i];
|
||||||
|
if (!quote.hash) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
quote.removeAttribute('onclick');
|
quote.removeAttribute('onclick');
|
||||||
_results.push($.bind(quote, 'click', quoteInline.toggle));
|
_results.push($.bind(quote, 'click', quoteInline.toggle));
|
||||||
}
|
}
|
||||||
@ -1745,9 +1748,7 @@
|
|||||||
},
|
},
|
||||||
toggle: function(e) {
|
toggle: function(e) {
|
||||||
var el, id, inline, req, root, table, threadID;
|
var el, id, inline, req, root, table, threadID;
|
||||||
if (!(id = this.hash.slice(1))) {
|
id = this.hash.slice(1);
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
root = $.x('ancestor::td[1]', this);
|
root = $.x('ancestor::td[1]', this);
|
||||||
if (table = $("#i" + id, root)) {
|
if (table = $("#i" + id, root)) {
|
||||||
@ -1837,6 +1838,9 @@
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quote = _ref[_i];
|
quote = _ref[_i];
|
||||||
|
if (!quote.hash) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$.bind(quote, 'mouseover', quotePreview.mouseover);
|
$.bind(quote, 'mouseover', quotePreview.mouseover);
|
||||||
$.bind(quote, 'mousemove', ui.hover);
|
$.bind(quote, 'mousemove', ui.hover);
|
||||||
$.bind(quote, 'mouseout', ui.hoverend);
|
$.bind(quote, 'mouseout', ui.hoverend);
|
||||||
@ -1853,9 +1857,7 @@
|
|||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var el, id, qp, quote, replyID, req, threadID, _i, _len, _ref;
|
var el, id, qp, quote, replyID, req, threadID, _i, _len, _ref;
|
||||||
if (!(id = this.hash.slice(1))) {
|
id = this.hash.slice(1);
|
||||||
return;
|
|
||||||
}
|
|
||||||
qp = $('#qp');
|
qp = $('#qp');
|
||||||
if (el = d.getElementById(id)) {
|
if (el = d.getElementById(id)) {
|
||||||
qp.innerHTML = el.innerHTML;
|
qp.innerHTML = el.innerHTML;
|
||||||
|
|||||||
@ -1394,10 +1394,11 @@ quoteInline =
|
|||||||
g.callbacks.push quoteInline.node
|
g.callbacks.push quoteInline.node
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
for quote in $$ 'a.quotelink, a.backlink', root
|
for quote in $$ 'a.quotelink, a.backlink', root
|
||||||
|
continue unless quote.hash
|
||||||
quote.removeAttribute 'onclick'
|
quote.removeAttribute 'onclick'
|
||||||
$.bind quote, 'click', quoteInline.toggle
|
$.bind quote, 'click', quoteInline.toggle
|
||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
return unless id = @hash[1..]
|
id = @hash[1..]
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
root = $.x 'ancestor::td[1]', @
|
root = $.x 'ancestor::td[1]', @
|
||||||
if table = $ "#i#{id}", root
|
if table = $ "#i#{id}", root
|
||||||
@ -1462,6 +1463,7 @@ quotePreview =
|
|||||||
$.append d.body, preview
|
$.append d.body, preview
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
for quote in $$ 'a.quotelink, a.backlink', root
|
for quote in $$ 'a.quotelink, a.backlink', root
|
||||||
|
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', ui.hoverend
|
$.bind quote, 'mouseout', ui.hoverend
|
||||||
@ -1470,7 +1472,7 @@ quotePreview =
|
|||||||
return unless el = d.getElementById @hash[1..]
|
return unless el = d.getElementById @hash[1..]
|
||||||
$.removeClass el, 'qphl'
|
$.removeClass el, 'qphl'
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
return unless id = @hash[1..]
|
id = @hash[1..]
|
||||||
qp = $ '#qp'
|
qp = $ '#qp'
|
||||||
if el = d.getElementById id
|
if el = d.getElementById id
|
||||||
qp.innerHTML = el.innerHTML
|
qp.innerHTML = el.innerHTML
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user