This commit is contained in:
Nicolas Stepien 2012-07-04 18:06:10 +02:00
parent 27d79dc72c
commit 3c3ed30709
2 changed files with 16 additions and 7 deletions

View File

@ -424,7 +424,7 @@
},
nodes: function(nodes) {
var frag, node, _i, _len;
if (nodes instanceof Node) {
if (!(nodes instanceof Array)) {
return nodes;
}
frag = d.createDocumentFragment();
@ -1182,6 +1182,9 @@
return e.stopPropagation();
});
$.on(this.el, 'keydown', this.keybinds);
$.on(d, 'AddMenuEntry', function(e) {
return Menu.addEntry(e.detail);
});
return Main.callbacks.push(this.node);
},
node: function(post) {
@ -1215,9 +1218,9 @@
el.setAttribute('data-id', post.ID);
el.setAttribute('data-rootid', post.root.id);
funk = function(entry, parent) {
var child, children, open, subMenu, _i, _len;
open = entry.open, children = entry.children;
if (!open(post)) {
var child, children, subMenu, _i, _len;
children = entry.children;
if (!entry.open(post)) {
return;
}
$.add(parent, entry.el);

View File

@ -329,7 +329,10 @@ $.extend $,
tn: (s) ->
d.createTextNode s
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
frag = d.createDocumentFragment()
for node in nodes
@ -945,6 +948,9 @@ Menu =
$.on @el, 'click', (e) -> e.stopPropagation()
$.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
node: (post) ->
if post.isInlined and !post.isCrosspost
@ -979,8 +985,8 @@ Menu =
el.setAttribute 'data-rootid', post.root.id
funk = (entry, parent) ->
{open, children} = entry
return unless open post
{children} = entry
return unless entry.open post
$.add parent, entry.el
return unless children
subMenu = $.el 'div',