Element.contains was not Array.contains, lol

This commit is contained in:
Zixaphir 2013-12-25 10:10:51 -07:00
parent 8bad58920a
commit 6dd2e60e9a
7 changed files with 18 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.2.44 - 2013-12-24
* 4chan X - Version 1.2.44 - 2013-12-25
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -22,7 +22,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.2.44 - 2013-12-24
* 4chan X - Version 1.2.44 - 2013-12-25
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -3564,9 +3564,7 @@
}
$.on(root, 'mousemove', o.hover);
o.workaround = function(e) {
var _ref;
if (_ref = e.target, __indexOf.call(root, _ref) < 0) {
if (!root.contains(e.target)) {
return o.hoverend();
}
};
@ -4322,7 +4320,7 @@
return $.prepend(this.OP.nodes.root, ThreadHiding.makeButton(this, 'hide'));
},
onIndexBuild: function(_arg) {
var i, nodes, root, thread, _i, _len, _ref;
var i, nodes, root, thread, _i, _len;
nodes = _arg.detail;
for (i = _i = 0, _len = nodes.length; _i < _len; i = _i += 2) {
@ -4333,7 +4331,7 @@
}
if (!thread.stub) {
nodes[i + 1].hidden = true;
} else if (_ref = thread.stub, __indexOf.call(root, _ref) < 0) {
} else if (!root.contains(thread.stub)) {
ThreadHiding.makeStub(thread, root);
}
}
@ -7853,7 +7851,7 @@
return ImageExpand.toggle(Get.postFromNode(this));
},
toggleAll: function() {
var ID, file, func, post, _i, _len, _ref, _ref1, _ref2;
var ID, file, func, post, _i, _len, _ref, _ref1;
$.event('CloseMenu');
if (ImageExpand.on = $.hasClass(ImageExpand.EAI, 'expand-all-shortcut')) {
@ -7872,7 +7870,7 @@
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
post = _ref1[_i];
file = post.file;
if (!(file && file.isImage && (_ref2 = post.nodes.root, __indexOf.call(doc, _ref2) >= 0))) {
if (!(file && file.isImage && doc.contains(post.nodes.root))) {
continue;
}
if (ImageExpand.on && (!Conf['Expand spoilers'] && file.isSpoiler || Conf['Expand from here'] && Header.getTopOf(file.thumb) < 0)) {
@ -8116,7 +8114,7 @@
var URL, post, src, timeoutID,
_this = this;
if (__indexOf.call(doc, this) < 0) {
if (!doc.contains(this)) {
return;
}
post = g.posts[this.dataset.fullID];

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.2.44 - 2013-12-24
* 4chan X - Version 1.2.44 - 2013-12-25
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4325,7 +4325,7 @@
return $.prepend(this.OP.nodes.root, ThreadHiding.makeButton(this, 'hide'));
},
onIndexBuild: function(_arg) {
var i, nodes, root, thread, _i, _len, _ref;
var i, nodes, root, thread, _i, _len;
nodes = _arg.detail;
for (i = _i = 0, _len = nodes.length; _i < _len; i = _i += 2) {
@ -4336,7 +4336,7 @@
}
if (!thread.stub) {
nodes[i + 1].hidden = true;
} else if (_ref = thread.stub, __indexOf.call(root, _ref) < 0) {
} else if (!root.contains(thread.stub)) {
ThreadHiding.makeStub(thread, root);
}
}
@ -7836,7 +7836,7 @@
return ImageExpand.toggle(Get.postFromNode(this));
},
toggleAll: function() {
var ID, file, func, post, _i, _len, _ref, _ref1, _ref2;
var ID, file, func, post, _i, _len, _ref, _ref1;
$.event('CloseMenu');
if (ImageExpand.on = $.hasClass(ImageExpand.EAI, 'expand-all-shortcut')) {
@ -7855,7 +7855,7 @@
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
post = _ref1[_i];
file = post.file;
if (!(file && file.isImage && (_ref2 = post.nodes.root, __indexOf.call(doc, _ref2) >= 0))) {
if (!(file && file.isImage && doc.contains(post.nodes.root))) {
continue;
}
if (ImageExpand.on && (!Conf['Expand spoilers'] && file.isSpoiler || Conf['Expand from here'] && Header.getTopOf(file.thumb) < 0)) {
@ -8099,7 +8099,7 @@
var URL, post, src, timeoutID,
_this = this;
if (__indexOf.call(doc, this) < 0) {
if (!doc.contains(this)) {
return;
}
post = g.posts[this.dataset.fullID];

View File

@ -21,7 +21,7 @@ ThreadHiding =
continue unless thread.isHidden
unless thread.stub
nodes[i + 1].hidden = true
else unless thread.stub in root
else unless root.contains thread.stub
# When we come back to a page, the stub is already there.
ThreadHiding.makeStub thread, root
return

View File

@ -326,7 +326,7 @@ UI = do ->
$.on root, 'mousemove', o.hover
<% if (type === 'userscript') { %>
# Workaround for https://github.com/MayhemYDG/4chan-x/issues/377
o.workaround = (e) -> o.hoverend() unless e.target in root
o.workaround = (e) -> o.hoverend() unless root.contains e.target
$.on doc, 'mousemove', o.workaround
<% } %>

View File

@ -43,7 +43,7 @@ ImageExpand =
for ID, post of g.posts
for post in [post].concat post.clones
{file} = post
continue unless file and file.isImage and post.nodes.root in doc
continue unless file and file.isImage and doc.contains post.nodes.root
if ImageExpand.on and
(!Conf['Expand spoilers'] and file.isSpoiler or
Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0)

View File

@ -23,7 +23,7 @@ ImageHover =
asapTest: -> el.naturalHeight
$.on el, 'error', ImageHover.error
error: ->
return unless @ in doc
return unless doc.contains @
post = g.posts[@dataset.fullID]
src = @src.split '/'