Apparently xpath works as expected on Firefox if you specify that you want the [1] node.
This commit is contained in:
parent
081ae491f4
commit
97d725ce34
@ -3345,12 +3345,6 @@
|
|||||||
},
|
},
|
||||||
add: function(q, id) {
|
add: function(q, id) {
|
||||||
var board, el, i, inline, isBacklink, path, postID, root, threadID;
|
var board, el, i, inline, isBacklink, path, postID, root, threadID;
|
||||||
if (!(isBacklink = /\bbacklink\b/.test(q.className))) {
|
|
||||||
root = q;
|
|
||||||
while (root.parentNode.nodeName !== 'BLOCKQUOTE') {
|
|
||||||
root = root.parentNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (q.host === 'boards.4chan.org') {
|
if (q.host === 'boards.4chan.org') {
|
||||||
path = q.pathname.split('/');
|
path = q.pathname.split('/');
|
||||||
board = path[1];
|
board = path[1];
|
||||||
@ -3366,7 +3360,8 @@
|
|||||||
id: "i" + postID,
|
id: "i" + postID,
|
||||||
className: el ? 'inline' : 'inline crosspost'
|
className: el ? 'inline' : 'inline crosspost'
|
||||||
});
|
});
|
||||||
$.after((isBacklink ? q.parentNode : root), inline);
|
root = (isBacklink = /\bbacklink\b/.test(q.className)) ? q.parentNode : $.x('ancestor::*[parent::blockquote][1]', q);
|
||||||
|
$.after(root, inline);
|
||||||
Get.post(board, threadID, postID, inline);
|
Get.post(board, threadID, postID, inline);
|
||||||
if (!el) {
|
if (!el) {
|
||||||
return;
|
return;
|
||||||
@ -3424,7 +3419,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var board, el, parent, path, postID, qp, quote, quoterID, threadID, _i, _len, _ref;
|
var board, el, path, postID, qp, quote, quoterID, threadID, _i, _len, _ref;
|
||||||
if (/\binlined\b/.test(this.className)) {
|
if (/\binlined\b/.test(this.className)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3489,11 +3484,7 @@
|
|||||||
$.addClass(el, 'qphl');
|
$.addClass(el, 'qphl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parent = this.parentNode;
|
quoterID = $.x('ancestor::*[@id][1]', this).id.match(/\d+$/)[0];
|
||||||
while (!parent.id) {
|
|
||||||
parent = parent.parentNode;
|
|
||||||
}
|
|
||||||
quoterID = parent.id.match(/\d+$/)[0];
|
|
||||||
_ref = $$('.quotelink, .backlink', qp);
|
_ref = $$('.quotelink, .backlink', qp);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quote = _ref[_i];
|
quote = _ref[_i];
|
||||||
|
|||||||
@ -2598,13 +2598,6 @@ QuoteInline =
|
|||||||
@classList.toggle 'inlined'
|
@classList.toggle 'inlined'
|
||||||
|
|
||||||
add: (q, id) ->
|
add: (q, id) ->
|
||||||
# Can't use this because Firefox a shit:
|
|
||||||
# root = $.x 'ancestor::*[parent::blockquote]', q
|
|
||||||
unless isBacklink = /\bbacklink\b/.test q.className
|
|
||||||
root = q
|
|
||||||
until root.parentNode.nodeName is 'BLOCKQUOTE'
|
|
||||||
root = root.parentNode
|
|
||||||
|
|
||||||
if q.host is 'boards.4chan.org'
|
if q.host is 'boards.4chan.org'
|
||||||
path = q.pathname.split '/'
|
path = q.pathname.split '/'
|
||||||
board = path[1]
|
board = path[1]
|
||||||
@ -2619,7 +2612,12 @@ QuoteInline =
|
|||||||
inline = $.el 'div',
|
inline = $.el 'div',
|
||||||
id: "i#{postID}"
|
id: "i#{postID}"
|
||||||
className: if el then 'inline' else 'inline crosspost'
|
className: if el then 'inline' else 'inline crosspost'
|
||||||
$.after (if isBacklink then q.parentNode else root), inline
|
root =
|
||||||
|
if isBacklink = /\bbacklink\b/.test q.className
|
||||||
|
q.parentNode
|
||||||
|
else
|
||||||
|
$.x 'ancestor::*[parent::blockquote][1]', q
|
||||||
|
$.after root, inline
|
||||||
Get.post board, threadID, postID, inline
|
Get.post board, threadID, postID, inline
|
||||||
|
|
||||||
return unless el
|
return unless el
|
||||||
@ -2709,11 +2707,7 @@ QuotePreview =
|
|||||||
$.addClass el.parentNode, 'qphl'
|
$.addClass el.parentNode, 'qphl'
|
||||||
else
|
else
|
||||||
$.addClass el, 'qphl'
|
$.addClass el, 'qphl'
|
||||||
# can't use xpath because >firefox
|
quoterID = $.x('ancestor::*[@id][1]', @).id.match(/\d+$/)[0]
|
||||||
parent = @parentNode
|
|
||||||
until parent.id
|
|
||||||
parent = parent.parentNode
|
|
||||||
quoterID = parent.id.match(/\d+$/)[0]
|
|
||||||
for quote in $$ '.quotelink, .backlink', qp
|
for quote in $$ '.quotelink, .backlink', qp
|
||||||
if quote.hash[2..] is quoterID
|
if quote.hash[2..] is quoterID
|
||||||
$.addClass quote, 'forwardlink'
|
$.addClass quote, 'forwardlink'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user