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. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,7 @@ ImageExpand =
for ID, post of g.posts for ID, post of g.posts
for post in [post].concat post.clones for post in [post].concat post.clones
{file} = post {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 if ImageExpand.on and
(!Conf['Expand spoilers'] and file.isSpoiler or (!Conf['Expand spoilers'] and file.isSpoiler or
Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0) Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0)

View File

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