Quote Hash Navigation
This commit is contained in:
parent
65be86c5bd
commit
7c330f39bc
@ -200,6 +200,7 @@
|
||||
'Quote Backlinks': [true, 'Add quote backlinks.'],
|
||||
'OP Backlinks': [true, 'Add backlinks to the OP.'],
|
||||
'Quote Inlining': [true, 'Inline quoted post on click.'],
|
||||
'Quote Hash Navigation': [false, 'Include an extra link after quotes for autoscrolling to quoted posts.'],
|
||||
'Forward Hiding': [true, 'Hide original posts of inlined backlinks.'],
|
||||
'Quote Previewing': [true, 'Show quoted post on hover.'],
|
||||
'Quote Highlighting': [true, 'Highlight the previewed post.'],
|
||||
@ -3488,7 +3489,7 @@
|
||||
});
|
||||
},
|
||||
firstNode: function() {
|
||||
var a, clone, container, containers, link, post, quote, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
|
||||
var a, clone, container, containers, frag, link, post, quote, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
|
||||
|
||||
if (this.isClone || !this.quotes.length) {
|
||||
return;
|
||||
@ -3511,14 +3512,17 @@
|
||||
}
|
||||
for (_k = 0, _len2 = containers.length; _k < _len2; _k++) {
|
||||
container = containers[_k];
|
||||
link = a.cloneNode(true);
|
||||
frag = [$.tn(' '), link = a.cloneNode(true)];
|
||||
if (Conf['Quote Previewing']) {
|
||||
$.on(link, 'mouseover', QuotePreview.mouseover);
|
||||
}
|
||||
if (Conf['Quote Inlining']) {
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
frag.pushArrays(QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
}
|
||||
}
|
||||
$.add(container, [$.tn(' '), link]);
|
||||
$.add(container, frag);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3594,19 +3598,41 @@
|
||||
if (Conf['Comment Expansion']) {
|
||||
ExpandComment.callbacks.push(this.node);
|
||||
}
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
this.node = function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.after(link, QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
this.node = function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
};
|
||||
}
|
||||
return Post.prototype.callbacks.push({
|
||||
name: 'Quote Inlining',
|
||||
cb: this.node
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
qiQuote: function(link, hidden) {
|
||||
return [
|
||||
$.tn(' '), $.el('a', {
|
||||
className: hidden ? 'hashlink filtered' : 'hashlink',
|
||||
textContent: '#',
|
||||
href: link.href
|
||||
})
|
||||
];
|
||||
},
|
||||
toggle: function(e) {
|
||||
var boardID, context, postID, threadID, _ref;
|
||||
|
||||
@ -201,6 +201,7 @@
|
||||
'Quote Backlinks': [true, 'Add quote backlinks.'],
|
||||
'OP Backlinks': [true, 'Add backlinks to the OP.'],
|
||||
'Quote Inlining': [true, 'Inline quoted post on click.'],
|
||||
'Quote Hash Navigation': [false, 'Include an extra link after quotes for autoscrolling to quoted posts.'],
|
||||
'Forward Hiding': [true, 'Hide original posts of inlined backlinks.'],
|
||||
'Quote Previewing': [true, 'Show quoted post on hover.'],
|
||||
'Quote Highlighting': [true, 'Highlight the previewed post.'],
|
||||
@ -3484,7 +3485,7 @@
|
||||
});
|
||||
},
|
||||
firstNode: function() {
|
||||
var a, clone, container, containers, link, post, quote, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
|
||||
var a, clone, container, containers, frag, link, post, quote, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
|
||||
|
||||
if (this.isClone || !this.quotes.length) {
|
||||
return;
|
||||
@ -3507,14 +3508,17 @@
|
||||
}
|
||||
for (_k = 0, _len2 = containers.length; _k < _len2; _k++) {
|
||||
container = containers[_k];
|
||||
link = a.cloneNode(true);
|
||||
frag = [$.tn(' '), link = a.cloneNode(true)];
|
||||
if (Conf['Quote Previewing']) {
|
||||
$.on(link, 'mouseover', QuotePreview.mouseover);
|
||||
}
|
||||
if (Conf['Quote Inlining']) {
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
frag.pushArrays(QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
}
|
||||
}
|
||||
$.add(container, [$.tn(' '), link]);
|
||||
$.add(container, frag);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3590,19 +3594,41 @@
|
||||
if (Conf['Comment Expansion']) {
|
||||
ExpandComment.callbacks.push(this.node);
|
||||
}
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
this.node = function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.after(link, QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
this.node = function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
};
|
||||
}
|
||||
return Post.prototype.callbacks.push({
|
||||
name: 'Quote Inlining',
|
||||
cb: this.node
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
qiQuote: function(link, hidden) {
|
||||
return [
|
||||
$.tn(' '), $.el('a', {
|
||||
className: hidden ? 'hashlink filtered' : 'hashlink',
|
||||
textContent: '#',
|
||||
href: link.href
|
||||
})
|
||||
];
|
||||
},
|
||||
toggle: function(e) {
|
||||
var boardID, context, postID, threadID, _ref;
|
||||
|
||||
@ -183,6 +183,7 @@
|
||||
'Quote Backlinks': [true, 'Add quote backlinks.'],
|
||||
'OP Backlinks': [true, 'Add backlinks to the OP.'],
|
||||
'Quote Inlining': [true, 'Inline quoted post on click.'],
|
||||
'Quote Hash Navigation': [false, 'Include an extra link after quotes for autoscrolling to quoted posts.'],
|
||||
'Forward Hiding': [true, 'Hide original posts of inlined backlinks.'],
|
||||
'Quote Previewing': [true, 'Show quoted post on hover.'],
|
||||
'Quote Highlighting': [true, 'Highlight the previewed post.'],
|
||||
@ -3487,7 +3488,7 @@
|
||||
});
|
||||
},
|
||||
firstNode: function() {
|
||||
var a, clone, container, containers, link, post, quote, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
|
||||
var a, clone, container, containers, frag, link, post, quote, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
|
||||
|
||||
if (this.isClone || !this.quotes.length) {
|
||||
return;
|
||||
@ -3510,14 +3511,17 @@
|
||||
}
|
||||
for (_k = 0, _len2 = containers.length; _k < _len2; _k++) {
|
||||
container = containers[_k];
|
||||
link = a.cloneNode(true);
|
||||
frag = [$.tn(' '), link = a.cloneNode(true)];
|
||||
if (Conf['Quote Previewing']) {
|
||||
$.on(link, 'mouseover', QuotePreview.mouseover);
|
||||
}
|
||||
if (Conf['Quote Inlining']) {
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
frag.pushArrays(QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
}
|
||||
}
|
||||
$.add(container, [$.tn(' '), link]);
|
||||
$.add(container, frag);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3593,19 +3597,41 @@
|
||||
if (Conf['Comment Expansion']) {
|
||||
ExpandComment.callbacks.push(this.node);
|
||||
}
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
this.node = function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.after(link, QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
this.node = function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
};
|
||||
}
|
||||
return Post.prototype.callbacks.push({
|
||||
name: 'Quote Inlining',
|
||||
cb: this.node
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
var link, _i, _len, _ref;
|
||||
|
||||
_ref = this.nodes.quotelinks.concat(__slice.call(this.nodes.backlinks));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
}
|
||||
qiQuote: function(link, hidden) {
|
||||
return [
|
||||
$.tn(' '), $.el('a', {
|
||||
className: hidden ? 'hashlink filtered' : 'hashlink',
|
||||
textContent: '#',
|
||||
href: link.href
|
||||
})
|
||||
];
|
||||
},
|
||||
toggle: function(e) {
|
||||
var boardID, context, postID, threadID, _ref;
|
||||
|
||||
@ -303,6 +303,10 @@ Config =
|
||||
true
|
||||
'Inline quoted post on click.'
|
||||
]
|
||||
'Quote Hash Navigation': [
|
||||
false
|
||||
'Include an extra link after quotes for autoscrolling to quoted posts.'
|
||||
]
|
||||
'Forward Hiding': [
|
||||
true
|
||||
'Hide original posts of inlined backlinks.'
|
||||
|
||||
@ -36,12 +36,13 @@ QuoteBacklink =
|
||||
for clone in post.clones
|
||||
containers.push clone.nodes.backlinkContainer
|
||||
for container in containers
|
||||
link = a.cloneNode true
|
||||
frag = [$.tn(' '), link = a.cloneNode true]
|
||||
if Conf['Quote Previewing']
|
||||
$.on link, 'mouseover', QuotePreview.mouseover
|
||||
if Conf['Quote Inlining']
|
||||
$.on link, 'click', QuoteInline.toggle
|
||||
$.add container, [$.tn(' '), link]
|
||||
frag.pushArrays QuoteInline.qiQuote link, $.hasClass link, 'filtered' if Conf['Quote Hash Navigation']
|
||||
$.add container, frag
|
||||
return
|
||||
secondNode: ->
|
||||
if @isClone and (@origin.isReply or Conf['OP Backlinks'])
|
||||
|
||||
@ -5,13 +5,32 @@ QuoteInline =
|
||||
if Conf['Comment Expansion']
|
||||
ExpandComment.callbacks.push @node
|
||||
|
||||
if Conf['Quote Hash Navigation']
|
||||
@node = ->
|
||||
for link in @nodes.quotelinks.concat [@nodes.backlinks...]
|
||||
$.after link, QuoteInline.qiQuote link, $.hasClass link, 'filtered'
|
||||
$.on link, 'click', QuoteInline.toggle
|
||||
return
|
||||
|
||||
else
|
||||
@node = ->
|
||||
for link in @nodes.quotelinks.concat [@nodes.backlinks...]
|
||||
$.on link, 'click', QuoteInline.toggle
|
||||
return
|
||||
|
||||
Post::callbacks.push
|
||||
name: 'Quote Inlining'
|
||||
cb: @node
|
||||
node: ->
|
||||
for link in @nodes.quotelinks.concat [@nodes.backlinks...]
|
||||
$.on link, 'click', QuoteInline.toggle
|
||||
return
|
||||
|
||||
qiQuote: (link, hidden) ->
|
||||
[
|
||||
$.tn(' ')
|
||||
$.el 'a',
|
||||
className: if hidden then 'hashlink filtered' else 'hashlink'
|
||||
textContent: '#'
|
||||
href: link.href
|
||||
]
|
||||
|
||||
toggle: (e) ->
|
||||
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
|
||||
e.preventDefault()
|
||||
@ -29,6 +48,7 @@ QuoteInline =
|
||||
quotelink.parentNode.parentNode
|
||||
else
|
||||
$.x 'ancestor-or-self::*[parent::blockquote][1]', quotelink
|
||||
|
||||
add: (quotelink, boardID, threadID, postID, context) ->
|
||||
isBacklink = $.hasClass quotelink, 'backlink'
|
||||
inline = $.el 'div',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user