Close #578.
This commit is contained in:
parent
27d79dc72c
commit
3c3ed30709
@ -424,7 +424,7 @@
|
|||||||
},
|
},
|
||||||
nodes: function(nodes) {
|
nodes: function(nodes) {
|
||||||
var frag, node, _i, _len;
|
var frag, node, _i, _len;
|
||||||
if (nodes instanceof Node) {
|
if (!(nodes instanceof Array)) {
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
frag = d.createDocumentFragment();
|
frag = d.createDocumentFragment();
|
||||||
@ -1182,6 +1182,9 @@
|
|||||||
return e.stopPropagation();
|
return e.stopPropagation();
|
||||||
});
|
});
|
||||||
$.on(this.el, 'keydown', this.keybinds);
|
$.on(this.el, 'keydown', this.keybinds);
|
||||||
|
$.on(d, 'AddMenuEntry', function(e) {
|
||||||
|
return Menu.addEntry(e.detail);
|
||||||
|
});
|
||||||
return Main.callbacks.push(this.node);
|
return Main.callbacks.push(this.node);
|
||||||
},
|
},
|
||||||
node: function(post) {
|
node: function(post) {
|
||||||
@ -1215,9 +1218,9 @@
|
|||||||
el.setAttribute('data-id', post.ID);
|
el.setAttribute('data-id', post.ID);
|
||||||
el.setAttribute('data-rootid', post.root.id);
|
el.setAttribute('data-rootid', post.root.id);
|
||||||
funk = function(entry, parent) {
|
funk = function(entry, parent) {
|
||||||
var child, children, open, subMenu, _i, _len;
|
var child, children, subMenu, _i, _len;
|
||||||
open = entry.open, children = entry.children;
|
children = entry.children;
|
||||||
if (!open(post)) {
|
if (!entry.open(post)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.add(parent, entry.el);
|
$.add(parent, entry.el);
|
||||||
|
|||||||
@ -329,7 +329,10 @@ $.extend $,
|
|||||||
tn: (s) ->
|
tn: (s) ->
|
||||||
d.createTextNode s
|
d.createTextNode s
|
||||||
nodes: (nodes) ->
|
nodes: (nodes) ->
|
||||||
if nodes instanceof Node
|
# In (at least) Chrome, elements created inside different
|
||||||
|
# scripts/window contexts inherit from unequal prototypes.
|
||||||
|
# window_ext1.Node !== window_ext2.Node
|
||||||
|
unless nodes instanceof Array
|
||||||
return nodes
|
return nodes
|
||||||
frag = d.createDocumentFragment()
|
frag = d.createDocumentFragment()
|
||||||
for node in nodes
|
for node in nodes
|
||||||
@ -945,6 +948,9 @@ Menu =
|
|||||||
$.on @el, 'click', (e) -> e.stopPropagation()
|
$.on @el, 'click', (e) -> e.stopPropagation()
|
||||||
$.on @el, 'keydown', @keybinds
|
$.on @el, 'keydown', @keybinds
|
||||||
|
|
||||||
|
# Doc here: https://github.com/MayhemYDG/4chan-x/wiki/Menu-API
|
||||||
|
$.on d, 'AddMenuEntry', (e) -> Menu.addEntry e.detail
|
||||||
|
|
||||||
Main.callbacks.push @node
|
Main.callbacks.push @node
|
||||||
node: (post) ->
|
node: (post) ->
|
||||||
if post.isInlined and !post.isCrosspost
|
if post.isInlined and !post.isCrosspost
|
||||||
@ -979,8 +985,8 @@ Menu =
|
|||||||
el.setAttribute 'data-rootid', post.root.id
|
el.setAttribute 'data-rootid', post.root.id
|
||||||
|
|
||||||
funk = (entry, parent) ->
|
funk = (entry, parent) ->
|
||||||
{open, children} = entry
|
{children} = entry
|
||||||
return unless open post
|
return unless entry.open post
|
||||||
$.add parent, entry.el
|
$.add parent, entry.el
|
||||||
return unless children
|
return unless children
|
||||||
subMenu = $.el 'div',
|
subMenu = $.el 'div',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user