Holy consistent implementations, Batman!
It would appear by making code blocks that are reusable that we can reuse them!
This commit is contained in:
parent
bec7045024
commit
2184727cd7
@ -6294,7 +6294,7 @@
|
|||||||
if (!Conf['Reply Hiding Buttons']) {
|
if (!Conf['Reply Hiding Buttons']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton(this, 'hide'));
|
return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton('hide'));
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
init: function() {
|
init: function() {
|
||||||
@ -6462,18 +6462,16 @@
|
|||||||
$.event('CloseMenu');
|
$.event('CloseMenu');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
makeButton: function(post, type) {
|
makeButton: function(type, noEvent) {
|
||||||
var a, span;
|
var a;
|
||||||
span = $.el('span', {
|
|
||||||
className: "fa",
|
|
||||||
textContent: "" + (type === 'hide' ? '\uf068' : '\uf067')
|
|
||||||
});
|
|
||||||
a = $.el('a', {
|
a = $.el('a', {
|
||||||
className: "" + type + "-reply-button",
|
className: "" + type + "-reply-button",
|
||||||
href: 'javascript:;'
|
href: 'javascript:;',
|
||||||
|
innerHTML: "<span class=fa>" + (type === 'hide' ? '\uf068' : '\uf067') + "</span>"
|
||||||
});
|
});
|
||||||
$.add(a, span);
|
if (!noEvent) {
|
||||||
$.on(a, 'click', PostHiding.toggle);
|
$.on(a, 'click', PostHiding.toggle);
|
||||||
|
}
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
saveHiddenState: function(post, isHiding, thisPost, makeStub, hideRecursively) {
|
saveHiddenState: function(post, isHiding, thisPost, makeStub, hideRecursively) {
|
||||||
@ -6525,7 +6523,7 @@
|
|||||||
post.nodes.root.hidden = true;
|
post.nodes.root.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a = PostHiding.makeButton(post, 'show');
|
a = PostHiding.makeButton('show');
|
||||||
postInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', post.nodes.info).textContent;
|
postInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', post.nodes.info).textContent;
|
||||||
$.add(a, $.tn(" " + postInfo));
|
$.add(a, $.tn(" " + postInfo));
|
||||||
post.nodes.stub = $.el('div', {
|
post.nodes.stub = $.el('div', {
|
||||||
@ -6819,11 +6817,8 @@
|
|||||||
},
|
},
|
||||||
makeButton: function(thread, type) {
|
makeButton: function(thread, type) {
|
||||||
var a;
|
var a;
|
||||||
a = $.el('a', {
|
a = PostHiding.makeButton(type, true);
|
||||||
className: "" + type + "-thread-button",
|
a.className = "" + type + "-thread-button";
|
||||||
innerHTML: "<span class=fa>" + (type === 'hide' ? '\uf068' : '\uf067') + "</span>",
|
|
||||||
href: 'javascript:;'
|
|
||||||
});
|
|
||||||
a.dataset.fullID = thread.fullID;
|
a.dataset.fullID = thread.fullID;
|
||||||
$.on(a, 'click', ThreadHiding.toggle);
|
$.on(a, 'click', ThreadHiding.toggle);
|
||||||
return a;
|
return a;
|
||||||
|
|||||||
@ -6297,7 +6297,7 @@
|
|||||||
if (!Conf['Reply Hiding Buttons']) {
|
if (!Conf['Reply Hiding Buttons']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton(this, 'hide'));
|
return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton('hide'));
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
init: function() {
|
init: function() {
|
||||||
@ -6465,18 +6465,16 @@
|
|||||||
$.event('CloseMenu');
|
$.event('CloseMenu');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
makeButton: function(post, type) {
|
makeButton: function(type, noEvent) {
|
||||||
var a, span;
|
var a;
|
||||||
span = $.el('span', {
|
|
||||||
className: "fa",
|
|
||||||
textContent: "" + (type === 'hide' ? '\uf068' : '\uf067')
|
|
||||||
});
|
|
||||||
a = $.el('a', {
|
a = $.el('a', {
|
||||||
className: "" + type + "-reply-button",
|
className: "" + type + "-reply-button",
|
||||||
href: 'javascript:;'
|
href: 'javascript:;',
|
||||||
|
innerHTML: "<span class=fa>" + (type === 'hide' ? '\uf068' : '\uf067') + "</span>"
|
||||||
});
|
});
|
||||||
$.add(a, span);
|
if (!noEvent) {
|
||||||
$.on(a, 'click', PostHiding.toggle);
|
$.on(a, 'click', PostHiding.toggle);
|
||||||
|
}
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
saveHiddenState: function(post, isHiding, thisPost, makeStub, hideRecursively) {
|
saveHiddenState: function(post, isHiding, thisPost, makeStub, hideRecursively) {
|
||||||
@ -6528,7 +6526,7 @@
|
|||||||
post.nodes.root.hidden = true;
|
post.nodes.root.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a = PostHiding.makeButton(post, 'show');
|
a = PostHiding.makeButton('show');
|
||||||
postInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', post.nodes.info).textContent;
|
postInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', post.nodes.info).textContent;
|
||||||
$.add(a, $.tn(" " + postInfo));
|
$.add(a, $.tn(" " + postInfo));
|
||||||
post.nodes.stub = $.el('div', {
|
post.nodes.stub = $.el('div', {
|
||||||
@ -6822,11 +6820,8 @@
|
|||||||
},
|
},
|
||||||
makeButton: function(thread, type) {
|
makeButton: function(thread, type) {
|
||||||
var a;
|
var a;
|
||||||
a = $.el('a', {
|
a = PostHiding.makeButton(type, true);
|
||||||
className: "" + type + "-thread-button",
|
a.className = "" + type + "-thread-button";
|
||||||
innerHTML: "<span class=fa>" + (type === 'hide' ? '\uf068' : '\uf067') + "</span>",
|
|
||||||
href: 'javascript:;'
|
|
||||||
});
|
|
||||||
a.dataset.fullID = thread.fullID;
|
a.dataset.fullID = thread.fullID;
|
||||||
$.on(a, 'click', ThreadHiding.toggle);
|
$.on(a, 'click', ThreadHiding.toggle);
|
||||||
return a;
|
return a;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ PostHiding =
|
|||||||
Recursive.apply PostHiding.hide, @, data.makeStub, true
|
Recursive.apply PostHiding.hide, @, data.makeStub, true
|
||||||
Recursive.add PostHiding.hide, @, data.makeStub, true
|
Recursive.add PostHiding.hide, @, data.makeStub, true
|
||||||
return unless Conf['Reply Hiding Buttons']
|
return unless Conf['Reply Hiding Buttons']
|
||||||
$.add $('.postInfo', @nodes.post), PostHiding.makeButton @, 'hide'
|
$.add $('.postInfo', @nodes.post), PostHiding.makeButton 'hide'
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
init: ->
|
init: ->
|
||||||
@ -151,15 +151,12 @@ PostHiding =
|
|||||||
$.event 'CloseMenu'
|
$.event 'CloseMenu'
|
||||||
return
|
return
|
||||||
|
|
||||||
makeButton: (post, type) ->
|
makeButton: (type, noEvent) ->
|
||||||
span = $.el 'span',
|
|
||||||
className: "fa"
|
|
||||||
textContent: "#{if type is 'hide' then '\uf068' else '\uf067'}"
|
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
className: "#{type}-reply-button"
|
className: "#{type}-reply-button"
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.add a, span
|
innerHTML: "<span class=fa>#{if type is 'hide' then '\uf068' else '\uf067'}</span>"
|
||||||
$.on a, 'click', PostHiding.toggle
|
$.on a, 'click', PostHiding.toggle unless noEvent
|
||||||
a
|
a
|
||||||
|
|
||||||
saveHiddenState: (post, isHiding, thisPost, makeStub, hideRecursively) ->
|
saveHiddenState: (post, isHiding, thisPost, makeStub, hideRecursively) ->
|
||||||
@ -196,7 +193,7 @@ PostHiding =
|
|||||||
post.nodes.root.hidden = true
|
post.nodes.root.hidden = true
|
||||||
return
|
return
|
||||||
|
|
||||||
a = PostHiding.makeButton post, 'show'
|
a = PostHiding.makeButton 'show'
|
||||||
postInfo =
|
postInfo =
|
||||||
if Conf['Anonymize']
|
if Conf['Anonymize']
|
||||||
'Anonymous'
|
'Anonymous'
|
||||||
|
|||||||
@ -144,13 +144,12 @@ ThreadHiding =
|
|||||||
return
|
return
|
||||||
|
|
||||||
makeButton: (thread, type) ->
|
makeButton: (thread, type) ->
|
||||||
a = $.el 'a',
|
a = PostHiding.makeButton type, true
|
||||||
className: "#{type}-thread-button"
|
a.className = "#{type}-thread-button"
|
||||||
innerHTML: "<span class=fa>#{if type is 'hide' then '\uf068' else '\uf067'}</span>"
|
|
||||||
href: 'javascript:;'
|
|
||||||
a.dataset.fullID = thread.fullID
|
a.dataset.fullID = thread.fullID
|
||||||
$.on a, 'click', ThreadHiding.toggle
|
$.on a, 'click', ThreadHiding.toggle
|
||||||
a
|
a
|
||||||
|
|
||||||
makeStub: (thread, root) ->
|
makeStub: (thread, root) ->
|
||||||
numReplies = $$('.thread > .replyContainer', root).length
|
numReplies = $$('.thread > .replyContainer', root).length
|
||||||
numReplies += +summary.textContent.match /\d+/ if summary = $ '.summary', root
|
numReplies += +summary.textContent.match /\d+/ if summary = $ '.summary', root
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user