Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3
Conflicts: src/General/Header.coffee src/Images/ImageExpand.coffee src/Monitoring/ThreadUpdater.coffee
This commit is contained in:
commit
d02ce2ff0f
@ -1787,9 +1787,9 @@
|
||||
top = post.getBoundingClientRect().top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.bar.getBoundingClientRect();
|
||||
top += -headRect.top - headRect.height;
|
||||
top -= headRect.top + headRect.height;
|
||||
}
|
||||
return doc.scrollTop += top;
|
||||
return window.scrollBy(0, top);
|
||||
},
|
||||
addShortcut: function(el) {
|
||||
var shortcut;
|
||||
@ -2351,8 +2351,8 @@
|
||||
$.add(Header.hover, menu);
|
||||
mRect = menu.getBoundingClientRect();
|
||||
bRect = button.getBoundingClientRect();
|
||||
bTop = doc.scrollTop + d.body.scrollTop + bRect.top;
|
||||
bLeft = doc.scrollLeft + d.body.scrollLeft + bRect.left;
|
||||
bTop = window.scrollY + bRect.top;
|
||||
bLeft = window.scrollX + bRect.left;
|
||||
cHeight = doc.clientHeight;
|
||||
cWidth = doc.clientWidth;
|
||||
_ref1 = bRect.top + bRect.height + mRect.height < cHeight ? [bRect.bottom, null] : [null, cHeight - bRect.top], top = _ref1[0], bottom = _ref1[1];
|
||||
@ -6283,7 +6283,7 @@
|
||||
}
|
||||
},
|
||||
toggle: function(post) {
|
||||
var headRect, node, rect, root, thumb, top;
|
||||
var headRect, node, rect, thumb, x, y;
|
||||
|
||||
thumb = post.file.thumb;
|
||||
if (!(post.file.isExpanded || $.hasClass(thumb, 'expanding'))) {
|
||||
@ -6309,17 +6309,18 @@
|
||||
if (!(rect.top <= 0 || rect.left <= 0)) {
|
||||
return;
|
||||
}
|
||||
top = rect.top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.bar.getBoundingClientRect();
|
||||
top += -headRect.top - headRect.height;
|
||||
}
|
||||
root = doc;
|
||||
if (rect.top < 0) {
|
||||
root.scrollTop += top;
|
||||
y = rect.top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.toggle.getBoundingClientRect();
|
||||
y -= headRect.top + headRect.height;
|
||||
}
|
||||
}
|
||||
if (rect.left < 0) {
|
||||
return root.scrollLeft = 0;
|
||||
x = -window.scrollX;
|
||||
}
|
||||
if (x || y) {
|
||||
return window.scrollBy(x, y);
|
||||
}
|
||||
},
|
||||
contract: function(post) {
|
||||
@ -6370,16 +6371,15 @@
|
||||
}
|
||||
prev = post.nodes.root.getBoundingClientRect();
|
||||
return $.queueTask(function() {
|
||||
var curr, root;
|
||||
var curr;
|
||||
|
||||
$.addClass(post.nodes.root, 'expanded-image');
|
||||
$.rmClass(post.file.thumb, 'expanding');
|
||||
if (!(prev.top + prev.height <= 0)) {
|
||||
return;
|
||||
}
|
||||
root = doc;
|
||||
curr = post.nodes.root.getBoundingClientRect();
|
||||
return root.scrollTop += curr.height - prev.height + curr.top - prev.top;
|
||||
return window.scrollBy(0, curr.height - prev.height + curr.top - prev.top);
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
@ -7613,7 +7613,7 @@
|
||||
}
|
||||
if (scroll) {
|
||||
if (Conf['Bottom Scroll']) {
|
||||
doc.scrollTop = d.body.clientHeight;
|
||||
window.scrollTo(0, d.body.clientHeight);
|
||||
} else {
|
||||
if (root) {
|
||||
Header.scrollToPost(root);
|
||||
|
||||
@ -1798,9 +1798,9 @@
|
||||
top = post.getBoundingClientRect().top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.bar.getBoundingClientRect();
|
||||
top += -headRect.top - headRect.height;
|
||||
top -= headRect.top + headRect.height;
|
||||
}
|
||||
return d.body.scrollTop += top;
|
||||
return window.scrollBy(0, top);
|
||||
},
|
||||
addShortcut: function(el) {
|
||||
var shortcut;
|
||||
@ -2362,8 +2362,8 @@
|
||||
$.add(Header.hover, menu);
|
||||
mRect = menu.getBoundingClientRect();
|
||||
bRect = button.getBoundingClientRect();
|
||||
bTop = doc.scrollTop + d.body.scrollTop + bRect.top;
|
||||
bLeft = doc.scrollLeft + d.body.scrollLeft + bRect.left;
|
||||
bTop = window.scrollY + bRect.top;
|
||||
bLeft = window.scrollX + bRect.left;
|
||||
cHeight = doc.clientHeight;
|
||||
cWidth = doc.clientWidth;
|
||||
_ref1 = bRect.top + bRect.height + mRect.height < cHeight ? [bRect.bottom, null] : [null, cHeight - bRect.top], top = _ref1[0], bottom = _ref1[1];
|
||||
@ -6263,7 +6263,7 @@
|
||||
}
|
||||
},
|
||||
toggle: function(post) {
|
||||
var headRect, node, rect, root, thumb, top;
|
||||
var headRect, node, rect, thumb, x, y;
|
||||
|
||||
thumb = post.file.thumb;
|
||||
if (!(post.file.isExpanded || $.hasClass(thumb, 'expanding'))) {
|
||||
@ -6289,17 +6289,18 @@
|
||||
if (!(rect.top <= 0 || rect.left <= 0)) {
|
||||
return;
|
||||
}
|
||||
top = rect.top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.bar.getBoundingClientRect();
|
||||
top += -headRect.top - headRect.height;
|
||||
}
|
||||
root = d.body;
|
||||
if (rect.top < 0) {
|
||||
root.scrollTop += top;
|
||||
y = rect.top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.toggle.getBoundingClientRect();
|
||||
y -= headRect.top + headRect.height;
|
||||
}
|
||||
}
|
||||
if (rect.left < 0) {
|
||||
return root.scrollLeft = 0;
|
||||
x = -window.scrollX;
|
||||
}
|
||||
if (x || y) {
|
||||
return window.scrollBy(x, y);
|
||||
}
|
||||
},
|
||||
contract: function(post) {
|
||||
@ -6350,16 +6351,15 @@
|
||||
}
|
||||
prev = post.nodes.root.getBoundingClientRect();
|
||||
return $.queueTask(function() {
|
||||
var curr, root;
|
||||
var curr;
|
||||
|
||||
$.addClass(post.nodes.root, 'expanded-image');
|
||||
$.rmClass(post.file.thumb, 'expanding');
|
||||
if (!(prev.top + prev.height <= 0)) {
|
||||
return;
|
||||
}
|
||||
root = d.body;
|
||||
curr = post.nodes.root.getBoundingClientRect();
|
||||
return root.scrollTop += curr.height - prev.height + curr.top - prev.top;
|
||||
return window.scrollBy(0, curr.height - prev.height + curr.top - prev.top);
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
@ -7593,7 +7593,7 @@
|
||||
}
|
||||
if (scroll) {
|
||||
if (Conf['Bottom Scroll']) {
|
||||
d.body.scrollTop = d.body.clientHeight;
|
||||
window.scrollTo(0, d.body.clientHeight);
|
||||
} else {
|
||||
if (root) {
|
||||
Header.scrollToPost(root);
|
||||
|
||||
@ -302,8 +302,8 @@ Header =
|
||||
{top} = post.getBoundingClientRect()
|
||||
if Conf['Fixed Header'] and not Conf['Bottom Header']
|
||||
headRect = Header.bar.getBoundingClientRect()
|
||||
top += - headRect.top - headRect.height
|
||||
<% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop += top
|
||||
top -= headRect.top + headRect.height
|
||||
window.scrollBy 0, top
|
||||
|
||||
addShortcut: (el) ->
|
||||
shortcut = $.el 'span',
|
||||
|
||||
@ -70,8 +70,8 @@ UI = do ->
|
||||
# Position
|
||||
mRect = menu.getBoundingClientRect()
|
||||
bRect = button.getBoundingClientRect()
|
||||
bTop = doc.scrollTop + d.body.scrollTop + bRect.top
|
||||
bLeft = doc.scrollLeft + d.body.scrollLeft + bRect.left
|
||||
bTop = window.scrollY + bRect.top
|
||||
bLeft = window.scrollX + bRect.left
|
||||
cHeight = doc.clientHeight
|
||||
cWidth = doc.clientWidth
|
||||
[top, bottom] = if bRect.top + bRect.height + mRect.height < cHeight
|
||||
|
||||
@ -60,6 +60,8 @@ ImageExpand =
|
||||
return
|
||||
ImageExpand.contract post
|
||||
node = post.nodes.root
|
||||
# Scroll back to the thumbnail when contracting the image
|
||||
# to avoid being left miles away from the relevant post.
|
||||
rect = if Conf['Advance on contract'] then do ->
|
||||
# FIXME does not work with Quote Threading
|
||||
while node.nextElementSibling
|
||||
@ -71,15 +73,15 @@ ImageExpand =
|
||||
post.nodes.root.getBoundingClientRect()
|
||||
return unless rect.top <= 0 or rect.left <= 0
|
||||
|
||||
{top} = rect
|
||||
if Conf['Fixed Header'] and not Conf['Bottom Header']
|
||||
headRect = Header.bar.getBoundingClientRect()
|
||||
top += - headRect.top - headRect.height
|
||||
if rect.top < 0
|
||||
y = rect.top
|
||||
if Conf['Fixed Header'] and not Conf['Bottom Header']
|
||||
headRect = Header.toggle.getBoundingClientRect()
|
||||
y -= headRect.top + headRect.height
|
||||
|
||||
root = <% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>
|
||||
|
||||
root.scrollTop += top if rect.top < 0
|
||||
root.scrollLeft = 0 if rect.left < 0
|
||||
if rect.left < 0
|
||||
x = -window.scrollX
|
||||
window.scrollBy x, y if x or y
|
||||
|
||||
contract: (post) ->
|
||||
$.rmClass post.nodes.root, 'expanded-image'
|
||||
@ -119,9 +121,8 @@ ImageExpand =
|
||||
$.addClass post.nodes.root, 'expanded-image'
|
||||
$.rmClass post.file.thumb, 'expanding'
|
||||
return unless prev.top + prev.height <= 0
|
||||
root = <% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>
|
||||
curr = post.nodes.root.getBoundingClientRect()
|
||||
root.scrollTop += curr.height - prev.height + curr.top - prev.top
|
||||
window.scrollBy 0, curr.height - prev.height + curr.top - prev.top
|
||||
|
||||
error: ->
|
||||
post = Get.postFromNode @
|
||||
|
||||
@ -293,7 +293,6 @@ ThreadUpdater =
|
||||
unless count
|
||||
ThreadUpdater.set 'status', null, null
|
||||
ThreadUpdater.outdateCount++
|
||||
|
||||
else
|
||||
ThreadUpdater.set 'status', "+#{count}", 'new'
|
||||
ThreadUpdater.outdateCount = 0
|
||||
@ -319,7 +318,7 @@ ThreadUpdater =
|
||||
|
||||
if scroll
|
||||
if Conf['Bottom Scroll']
|
||||
<% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop = d.body.clientHeight
|
||||
window.scrollTo 0, d.body.clientHeight
|
||||
else
|
||||
Header.scrollToPost root if root
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user