Merge Mayhem X
This commit is contained in:
commit
33c1d58d5f
@ -1436,18 +1436,22 @@
|
||||
return Polyfill.visibility();
|
||||
},
|
||||
visibility: function() {
|
||||
var event, prefix, property;
|
||||
|
||||
if ('visibilityState' in document || !(prefix = ('webkitVisibilityState' in document ? 'webkit' : 'mozVisibilityState' in document ? 'moz' : void 0))) {
|
||||
if (!('webkitHidden' in document)) {
|
||||
return;
|
||||
}
|
||||
property = prefix + 'VisibilityState';
|
||||
event = prefix + 'visibilitychange';
|
||||
d.visibilityState = d[property];
|
||||
d.hidden = d.visibilityState === 'hidden';
|
||||
return $.on(d, event, function() {
|
||||
d.visibilityState = d[property];
|
||||
d.hidden = d.visibilityState === 'hidden';
|
||||
Object.defineProperties(HTMLDocument.prototype, {
|
||||
visibilityState: {
|
||||
get: function() {
|
||||
return this.webkitVisibilityState;
|
||||
}
|
||||
},
|
||||
hidden: {
|
||||
get: function() {
|
||||
return this.webkitHidden;
|
||||
}
|
||||
}
|
||||
});
|
||||
return $.on(d, 'webkitvisibilitychange', function() {
|
||||
return $.event('visibilitychange');
|
||||
});
|
||||
}
|
||||
@ -3821,12 +3825,16 @@
|
||||
return Unread.readSinglePost(post);
|
||||
},
|
||||
rm: function(quotelink, boardID, threadID, postID, context) {
|
||||
var el, inlined, isBacklink, post, root, _ref;
|
||||
var el, inlined, isBacklink, post, qroot, root, _ref;
|
||||
|
||||
isBacklink = $.hasClass(quotelink, 'backlink');
|
||||
root = QuoteInline.findRoot(quotelink, isBacklink);
|
||||
root = $.x("following-sibling::div[@id='i" + postID + "'][1]", root);
|
||||
qroot = $.x('ancestor::*[contains(@class,"postContainer")][1]', root);
|
||||
$.rm(root);
|
||||
if (!$('.inline', qroot)) {
|
||||
$.rmClass(qroot, 'hasInline');
|
||||
}
|
||||
if (!(el = root.firstElementChild)) {
|
||||
return;
|
||||
}
|
||||
@ -9030,7 +9038,7 @@
|
||||
}
|
||||
},
|
||||
hl: function(delta, thread) {
|
||||
var headRect, next, postEl, rect, replies, reply, root, topMargin, _i, _len;
|
||||
var axe, headRect, next, postEl, rect, replies, reply, root, topMargin, _i, _len;
|
||||
|
||||
if (Conf['Fixed Header'] && Conf['Bottom header']) {
|
||||
topMargin = 0;
|
||||
@ -9043,7 +9051,8 @@
|
||||
rect = postEl.getBoundingClientRect();
|
||||
if (rect.bottom >= topMargin && rect.top <= doc.clientHeight) {
|
||||
root = postEl.parentNode;
|
||||
next = $.x('child::div[contains(@class,"post reply")]', delta === +1 ? root.nextElementSibling : root.previousElementSibling);
|
||||
axe = delta === +1 ? 'following' : 'preceding';
|
||||
next = $.x("" + axe + "-sibling::div[contains(@class,'replyContainer')][1]/child::div[contains(@class,'reply')]", root);
|
||||
if (!next) {
|
||||
this.focus(postEl);
|
||||
return;
|
||||
|
||||
@ -1432,18 +1432,22 @@
|
||||
return Polyfill.visibility();
|
||||
},
|
||||
visibility: function() {
|
||||
var event, prefix, property;
|
||||
|
||||
if ('visibilityState' in document || !(prefix = ('webkitVisibilityState' in document ? 'webkit' : 'mozVisibilityState' in document ? 'moz' : void 0))) {
|
||||
if (!('webkitHidden' in document)) {
|
||||
return;
|
||||
}
|
||||
property = prefix + 'VisibilityState';
|
||||
event = prefix + 'visibilitychange';
|
||||
d.visibilityState = d[property];
|
||||
d.hidden = d.visibilityState === 'hidden';
|
||||
return $.on(d, event, function() {
|
||||
d.visibilityState = d[property];
|
||||
d.hidden = d.visibilityState === 'hidden';
|
||||
Object.defineProperties(HTMLDocument.prototype, {
|
||||
visibilityState: {
|
||||
get: function() {
|
||||
return this.webkitVisibilityState;
|
||||
}
|
||||
},
|
||||
hidden: {
|
||||
get: function() {
|
||||
return this.webkitHidden;
|
||||
}
|
||||
}
|
||||
});
|
||||
return $.on(d, 'webkitvisibilitychange', function() {
|
||||
return $.event('visibilitychange');
|
||||
});
|
||||
}
|
||||
@ -3817,12 +3821,16 @@
|
||||
return Unread.readSinglePost(post);
|
||||
},
|
||||
rm: function(quotelink, boardID, threadID, postID, context) {
|
||||
var el, inlined, isBacklink, post, root, _ref;
|
||||
var el, inlined, isBacklink, post, qroot, root, _ref;
|
||||
|
||||
isBacklink = $.hasClass(quotelink, 'backlink');
|
||||
root = QuoteInline.findRoot(quotelink, isBacklink);
|
||||
root = $.x("following-sibling::div[@id='i" + postID + "'][1]", root);
|
||||
qroot = $.x('ancestor::*[contains(@class,"postContainer")][1]', root);
|
||||
$.rm(root);
|
||||
if (!$('.inline', qroot)) {
|
||||
$.rmClass(qroot, 'hasInline');
|
||||
}
|
||||
if (!(el = root.firstElementChild)) {
|
||||
return;
|
||||
}
|
||||
@ -9024,7 +9032,7 @@
|
||||
}
|
||||
},
|
||||
hl: function(delta, thread) {
|
||||
var headRect, next, postEl, rect, replies, reply, root, topMargin, _i, _len;
|
||||
var axe, headRect, next, postEl, rect, replies, reply, root, topMargin, _i, _len;
|
||||
|
||||
if (Conf['Fixed Header'] && Conf['Bottom header']) {
|
||||
topMargin = 0;
|
||||
@ -9037,7 +9045,8 @@
|
||||
rect = postEl.getBoundingClientRect();
|
||||
if (rect.bottom >= topMargin && rect.top <= doc.clientHeight) {
|
||||
root = postEl.parentNode;
|
||||
next = $.x('child::div[contains(@class,"post reply")]', delta === +1 ? root.nextElementSibling : root.previousElementSibling);
|
||||
axe = delta === +1 ? 'following' : 'preceding';
|
||||
next = $.x("" + axe + "-sibling::div[contains(@class,'replyContainer')][1]/child::div[contains(@class,'reply')]", root);
|
||||
if (!next) {
|
||||
this.focus(postEl);
|
||||
return;
|
||||
|
||||
@ -1434,18 +1434,22 @@
|
||||
return Polyfill.visibility();
|
||||
},
|
||||
visibility: function() {
|
||||
var event, prefix, property;
|
||||
|
||||
if ('visibilityState' in document || !(prefix = ('webkitVisibilityState' in document ? 'webkit' : 'mozVisibilityState' in document ? 'moz' : void 0))) {
|
||||
if (!('webkitHidden' in document)) {
|
||||
return;
|
||||
}
|
||||
property = prefix + 'VisibilityState';
|
||||
event = prefix + 'visibilitychange';
|
||||
d.visibilityState = d[property];
|
||||
d.hidden = d.visibilityState === 'hidden';
|
||||
return $.on(d, event, function() {
|
||||
d.visibilityState = d[property];
|
||||
d.hidden = d.visibilityState === 'hidden';
|
||||
Object.defineProperties(HTMLDocument.prototype, {
|
||||
visibilityState: {
|
||||
get: function() {
|
||||
return this.webkitVisibilityState;
|
||||
}
|
||||
},
|
||||
hidden: {
|
||||
get: function() {
|
||||
return this.webkitHidden;
|
||||
}
|
||||
}
|
||||
});
|
||||
return $.on(d, 'webkitvisibilitychange', function() {
|
||||
return $.event('visibilitychange');
|
||||
});
|
||||
}
|
||||
@ -3819,12 +3823,16 @@
|
||||
return Unread.readSinglePost(post);
|
||||
},
|
||||
rm: function(quotelink, boardID, threadID, postID, context) {
|
||||
var el, inlined, isBacklink, post, root, _ref;
|
||||
var el, inlined, isBacklink, post, qroot, root, _ref;
|
||||
|
||||
isBacklink = $.hasClass(quotelink, 'backlink');
|
||||
root = QuoteInline.findRoot(quotelink, isBacklink);
|
||||
root = $.x("following-sibling::div[@id='i" + postID + "'][1]", root);
|
||||
qroot = $.x('ancestor::*[contains(@class,"postContainer")][1]', root);
|
||||
$.rm(root);
|
||||
if (!$('.inline', qroot)) {
|
||||
$.rmClass(qroot, 'hasInline');
|
||||
}
|
||||
if (!(el = root.firstElementChild)) {
|
||||
return;
|
||||
}
|
||||
@ -9007,7 +9015,7 @@
|
||||
}
|
||||
},
|
||||
hl: function(delta, thread) {
|
||||
var headRect, next, postEl, rect, replies, reply, root, topMargin, _i, _len;
|
||||
var axe, headRect, next, postEl, rect, replies, reply, root, topMargin, _i, _len;
|
||||
|
||||
if (Conf['Fixed Header'] && Conf['Bottom header']) {
|
||||
topMargin = 0;
|
||||
@ -9020,7 +9028,8 @@
|
||||
rect = postEl.getBoundingClientRect();
|
||||
if (rect.bottom >= topMargin && rect.top <= doc.clientHeight) {
|
||||
root = postEl.parentNode;
|
||||
next = $.x('child::div[contains(@class,"post reply")]', delta === +1 ? root.nextElementSibling : root.previousElementSibling);
|
||||
axe = delta === +1 ? 'following' : 'preceding';
|
||||
next = $.x("" + axe + "-sibling::div[contains(@class,'replyContainer')][1]/child::div[contains(@class,'reply')]", root);
|
||||
if (!next) {
|
||||
this.focus(postEl);
|
||||
return;
|
||||
|
||||
@ -3,21 +3,10 @@ Polyfill =
|
||||
Polyfill.visibility()
|
||||
visibility: ->
|
||||
# page visibility API
|
||||
return if 'visibilityState' of document or not (
|
||||
prefix = (
|
||||
if 'webkitVisibilityState' of document
|
||||
'webkit'
|
||||
else if 'mozVisibilityState' of document
|
||||
'moz'
|
||||
)
|
||||
)
|
||||
|
||||
property = prefix + 'VisibilityState'
|
||||
event = prefix + 'visibilitychange'
|
||||
|
||||
d.visibilityState = d[property]
|
||||
d.hidden = d.visibilityState is 'hidden'
|
||||
$.on d, event, ->
|
||||
d.visibilityState = d[property]
|
||||
d.hidden = d.visibilityState is 'hidden'
|
||||
$.event 'visibilitychange'
|
||||
return unless 'webkitHidden' of document
|
||||
Object.defineProperties HTMLDocument.prototype,
|
||||
visibilityState:
|
||||
get: -> @webkitVisibilityState
|
||||
hidden:
|
||||
get: -> @webkitHidden
|
||||
$.on d, 'webkitvisibilitychange', -> $.event 'visibilitychange'
|
||||
|
||||
@ -204,8 +204,11 @@ Keybinds =
|
||||
rect = postEl.getBoundingClientRect()
|
||||
if rect.bottom >= topMargin and rect.top <= doc.clientHeight # We're at least partially visible
|
||||
root = postEl.parentNode
|
||||
next = $.x 'child::div[contains(@class,"post reply")]',
|
||||
if delta is +1 then root.nextElementSibling else root.previousElementSibling
|
||||
axe = if delta is +1
|
||||
'following'
|
||||
else
|
||||
'preceding'
|
||||
next = $.x "#{axe}-sibling::div[contains(@class,'replyContainer')][1]/child::div[contains(@class,'reply')]", root
|
||||
unless next
|
||||
@focus postEl
|
||||
return
|
||||
@ -228,4 +231,4 @@ Keybinds =
|
||||
return
|
||||
|
||||
focus: (post) ->
|
||||
$.addClass post, 'highlight'
|
||||
$.addClass post, 'highlight'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user