Faster Menu's makeButton. Callback name fixes.
This commit is contained in:
parent
6b87f9c977
commit
d4089d09c5
@ -1679,7 +1679,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return Post.prototype.callbacks.push({
|
return Post.prototype.callbacks.push({
|
||||||
name: 'Thread Hiding',
|
name: 'Filter',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -2104,7 +2104,7 @@
|
|||||||
if (!Conf['Hiding Buttons']) {
|
if (!Conf['Hiding Buttons']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return $.replace($('.sideArrows', this.nodes.root), ReplyHiding.makeButton(this, 'hide'));
|
return $.replace(this.nodes.root.firstElementChild, ReplyHiding.makeButton(this, 'hide'));
|
||||||
},
|
},
|
||||||
getHiddenPosts: function() {
|
getHiddenPosts: function() {
|
||||||
var hiddenPosts;
|
var hiddenPosts;
|
||||||
@ -2348,20 +2348,25 @@
|
|||||||
}
|
}
|
||||||
return $.add(this.nodes.info, [$.tn('\u00A0'), button]);
|
return $.add(this.nodes.info, [$.tn('\u00A0'), button]);
|
||||||
},
|
},
|
||||||
makeButton: function(post) {
|
makeButton: (function() {
|
||||||
var a;
|
var a;
|
||||||
a = $.el('a', {
|
a = null;
|
||||||
className: 'menu-button',
|
return function(post) {
|
||||||
innerHTML: '[<span></span>]',
|
var clone;
|
||||||
href: 'javascript:;'
|
a || (a = $.el('a', {
|
||||||
});
|
className: 'menu-button',
|
||||||
a.setAttribute('data-postid', post.fullID);
|
innerHTML: '[<span></span>]',
|
||||||
if (post.isClone) {
|
href: 'javascript:;'
|
||||||
a.setAttribute('data-clone', true);
|
}));
|
||||||
}
|
clone = a.cloneNode(true);
|
||||||
$.on(a, 'click', Menu.toggle);
|
clone.setAttribute('data-postid', post.fullID);
|
||||||
return a;
|
if (post.isClone) {
|
||||||
},
|
clone.setAttribute('data-clone', true);
|
||||||
|
}
|
||||||
|
$.on(clone, 'click', Menu.toggle);
|
||||||
|
return clone;
|
||||||
|
};
|
||||||
|
})(),
|
||||||
toggle: function(e) {
|
toggle: function(e) {
|
||||||
var post;
|
var post;
|
||||||
post = this.dataset.clone ? Get.postFromNode(this) : g.posts[this.dataset.postid];
|
post = this.dataset.clone ? Get.postFromNode(this) : g.posts[this.dataset.postid];
|
||||||
@ -4611,7 +4616,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return Post.prototype.callbacks.push({
|
return Post.prototype.callbacks.push({
|
||||||
name: 'Auto-GIF',
|
name: 'Image Hover',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -666,7 +666,7 @@ Filter =
|
|||||||
|
|
||||||
return unless Object.keys(@filters).length
|
return unless Object.keys(@filters).length
|
||||||
Post::callbacks.push
|
Post::callbacks.push
|
||||||
name: 'Thread Hiding'
|
name: 'Filter'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
createFilter: (regexp, op, stub, hl, top) ->
|
createFilter: (regexp, op, stub, hl, top) ->
|
||||||
@ -1036,7 +1036,7 @@ ReplyHiding =
|
|||||||
else
|
else
|
||||||
Recursive.hide @, data.makeStub
|
Recursive.hide @, data.makeStub
|
||||||
return unless Conf['Hiding Buttons']
|
return unless Conf['Hiding Buttons']
|
||||||
$.replace $('.sideArrows', @nodes.root), ReplyHiding.makeButton @, 'hide'
|
$.replace @nodes.root.firstElementChild, ReplyHiding.makeButton @, 'hide'
|
||||||
|
|
||||||
getHiddenPosts: ->
|
getHiddenPosts: ->
|
||||||
hiddenPosts = $.get "hiddenPosts.#{g.BOARD}"
|
hiddenPosts = $.get "hiddenPosts.#{g.BOARD}"
|
||||||
@ -1209,15 +1209,18 @@ Menu =
|
|||||||
return
|
return
|
||||||
$.add @nodes.info, [$.tn('\u00A0'), button]
|
$.add @nodes.info, [$.tn('\u00A0'), button]
|
||||||
|
|
||||||
makeButton: (post) ->
|
makeButton: do ->
|
||||||
a = $.el 'a',
|
a = null
|
||||||
className: 'menu-button'
|
(post) ->
|
||||||
innerHTML: '[<span></span>]'
|
a or= $.el 'a',
|
||||||
href: 'javascript:;'
|
className: 'menu-button'
|
||||||
a.setAttribute 'data-postid', post.fullID
|
innerHTML: '[<span></span>]'
|
||||||
a.setAttribute 'data-clone', true if post.isClone
|
href: 'javascript:;'
|
||||||
$.on a, 'click', Menu.toggle
|
clone = a.cloneNode true
|
||||||
a
|
clone.setAttribute 'data-postid', post.fullID
|
||||||
|
clone.setAttribute 'data-clone', true if post.isClone
|
||||||
|
$.on clone, 'click', Menu.toggle
|
||||||
|
clone
|
||||||
|
|
||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
post =
|
post =
|
||||||
@ -3070,7 +3073,7 @@ ImageHover =
|
|||||||
return if g.VIEW is 'catalog' or !Conf['Image Hover']
|
return if g.VIEW is 'catalog' or !Conf['Image Hover']
|
||||||
|
|
||||||
Post::callbacks.push
|
Post::callbacks.push
|
||||||
name: 'Auto-GIF'
|
name: 'Image Hover'
|
||||||
cb: @node
|
cb: @node
|
||||||
node: ->
|
node: ->
|
||||||
return unless @file?.isImage
|
return unless @file?.isImage
|
||||||
|
|||||||
@ -431,6 +431,7 @@ Main =
|
|||||||
# get the nodes' length only once
|
# get the nodes' length only once
|
||||||
len = nodes.length
|
len = nodes.length
|
||||||
for callback in klass::callbacks
|
for callback in klass::callbacks
|
||||||
|
# console.profile callback.name
|
||||||
for i in [0...len]
|
for i in [0...len]
|
||||||
node = nodes[i]
|
node = nodes[i]
|
||||||
try
|
try
|
||||||
@ -441,6 +442,7 @@ Main =
|
|||||||
errors.push
|
errors.push
|
||||||
message: "\"#{callback.name}\" crashed on #{klass.name} No.#{node} (/#{node.board}/)."
|
message: "\"#{callback.name}\" crashed on #{klass.name} No.#{node} (/#{node.board}/)."
|
||||||
error: err
|
error: err
|
||||||
|
# console.profileEnd callback.name
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
|
|
||||||
handleErrors: (errors) ->
|
handleErrors: (errors) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user