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