Merge branch 'Fx10'
Conflicts: 4chan_x.user.js script.coffee
This commit is contained in:
commit
5809b0e5bd
@ -885,7 +885,6 @@
|
|||||||
},
|
},
|
||||||
keydown: function(e) {
|
keydown: function(e) {
|
||||||
var o, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2;
|
var o, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2;
|
||||||
updater.focus = true;
|
|
||||||
if (!(key = keybinds.keyCode(e)) || /TEXTAREA|INPUT/.test(e.target.nodeName) && !(e.altKey || e.ctrlKey || e.keyCode === 27)) {
|
if (!(key = keybinds.keyCode(e)) || /TEXTAREA|INPUT/.test(e.target.nodeName) && !(e.altKey || e.ctrlKey || e.keyCode === 27)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2228,18 +2227,6 @@
|
|||||||
updater = {
|
updater = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var checkbox, checked, dialog, html, input, name, title, _i, _len, _ref;
|
var checkbox, checked, dialog, html, input, name, title, _i, _len, _ref;
|
||||||
if (conf['Scrolling']) {
|
|
||||||
if (conf['Scroll BG']) {
|
|
||||||
updater.focus = true;
|
|
||||||
} else {
|
|
||||||
$.on(window, 'focus', (function() {
|
|
||||||
return updater.focus = true;
|
|
||||||
}));
|
|
||||||
$.on(window, 'blur', (function() {
|
|
||||||
return updater.focus = false;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html = "<div class=move><span id=count></span> <span id=timer>-" + conf['Interval'] + "</span></div>";
|
html = "<div class=move><span id=count></span> <span id=timer>-" + conf['Interval'] + "</span></div>";
|
||||||
checkbox = config.updater.checkbox;
|
checkbox = config.updater.checkbox;
|
||||||
for (name in checkbox) {
|
for (name in checkbox) {
|
||||||
@ -2261,6 +2248,10 @@
|
|||||||
$.on(input, 'click', function() {
|
$.on(input, 'click', function() {
|
||||||
return conf[this.name] = this.checked;
|
return conf[this.name] = this.checked;
|
||||||
});
|
});
|
||||||
|
if (input.name === 'Scroll BG') {
|
||||||
|
$.on(input, 'click', updater.cb.scrollBG);
|
||||||
|
updater.cb.scrollBG.call(input);
|
||||||
|
}
|
||||||
if (input.name === 'Verbose') {
|
if (input.name === 'Verbose') {
|
||||||
$.on(input, 'click', updater.cb.verbose);
|
$.on(input, 'click', updater.cb.verbose);
|
||||||
updater.cb.verbose.call(input);
|
updater.cb.verbose.call(input);
|
||||||
@ -2301,6 +2292,13 @@
|
|||||||
return clearTimeout(updater.timeoutID);
|
return clearTimeout(updater.timeoutID);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
scrollBG: function() {
|
||||||
|
return updater.scrollBG = this.checked ? function() {
|
||||||
|
return true;
|
||||||
|
} : function() {
|
||||||
|
return !(d.hidden || d.oHidden || d.mozHidden || d.webkitHidden);
|
||||||
|
};
|
||||||
|
},
|
||||||
update: function() {
|
update: function() {
|
||||||
var body, frag, id, newPosts, reply, scroll, _i, _len, _ref, _ref2;
|
var body, frag, id, newPosts, reply, scroll, _i, _len, _ref, _ref2;
|
||||||
if (this.status === 404) {
|
if (this.status === 404) {
|
||||||
@ -2350,7 +2348,7 @@
|
|||||||
$.prepend(frag, reply.parentNode.parentNode.parentNode);
|
$.prepend(frag, reply.parentNode.parentNode.parentNode);
|
||||||
}
|
}
|
||||||
newPosts = frag.childNodes.length;
|
newPosts = frag.childNodes.length;
|
||||||
scroll = conf['Scrolling'] && updater.focus && newPosts && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20);
|
scroll = conf['Scrolling'] && updater.scrollBG() && newPosts && updater.br.previousElementSibling.getBoundingClientRect().bottom - d.body.clientHeight < 25;
|
||||||
if (conf['Verbose']) {
|
if (conf['Verbose']) {
|
||||||
updater.count.textContent = '+' + newPosts;
|
updater.count.textContent = '+' + newPosts;
|
||||||
if (newPosts === 0) {
|
if (newPosts === 0) {
|
||||||
@ -2360,7 +2358,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.before(updater.br, frag);
|
$.before(updater.br, frag);
|
||||||
if (scroll) return scrollTo(0, d.body.scrollHeight);
|
if (scroll) return updater.br.previousSibling.scrollIntoView(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
timeout: function() {
|
timeout: function() {
|
||||||
@ -3044,7 +3042,6 @@
|
|||||||
},
|
},
|
||||||
scroll: function() {
|
scroll: function() {
|
||||||
var bottom, height, i, reply, _len, _ref;
|
var bottom, height, i, reply, _len, _ref;
|
||||||
updater.focus = true;
|
|
||||||
height = d.body.clientHeight;
|
height = d.body.clientHeight;
|
||||||
_ref = unread.replies;
|
_ref = unread.replies;
|
||||||
for (i = 0, _len = _ref.length; i < _len; i++) {
|
for (i = 0, _len = _ref.length; i < _len; i++) {
|
||||||
|
|||||||
@ -643,7 +643,6 @@ keybinds =
|
|||||||
$.on d, 'keydown', keybinds.keydown
|
$.on d, 'keydown', keybinds.keydown
|
||||||
|
|
||||||
keydown: (e) ->
|
keydown: (e) ->
|
||||||
updater.focus = true
|
|
||||||
if not (key = keybinds.keyCode(e)) or /TEXTAREA|INPUT/.test(e.target.nodeName) and not (e.altKey or e.ctrlKey or e.keyCode is 27)
|
if not (key = keybinds.keyCode(e)) or /TEXTAREA|INPUT/.test(e.target.nodeName) and not (e.altKey or e.ctrlKey or e.keyCode is 27)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1750,12 +1749,6 @@ threadHiding =
|
|||||||
|
|
||||||
updater =
|
updater =
|
||||||
init: ->
|
init: ->
|
||||||
if conf['Scrolling']
|
|
||||||
if conf['Scroll BG']
|
|
||||||
updater.focus = true
|
|
||||||
else
|
|
||||||
$.on window, 'focus', (-> updater.focus = true)
|
|
||||||
$.on window, 'blur', (-> updater.focus = false)
|
|
||||||
html = "<div class=move><span id=count></span> <span id=timer>-#{conf['Interval']}</span></div>"
|
html = "<div class=move><span id=count></span> <span id=timer>-#{conf['Interval']}</span></div>"
|
||||||
{checkbox} = config.updater
|
{checkbox} = config.updater
|
||||||
for name of checkbox
|
for name of checkbox
|
||||||
@ -1779,6 +1772,9 @@ updater =
|
|||||||
if input.type is 'checkbox'
|
if input.type is 'checkbox'
|
||||||
$.on input, 'click', $.cb.checked
|
$.on input, 'click', $.cb.checked
|
||||||
$.on input, 'click', -> conf[@name] = @checked
|
$.on input, 'click', -> conf[@name] = @checked
|
||||||
|
if input.name is 'Scroll BG'
|
||||||
|
$.on input, 'click', updater.cb.scrollBG
|
||||||
|
updater.cb.scrollBG.call input
|
||||||
if input.name is 'Verbose'
|
if input.name is 'Verbose'
|
||||||
$.on input, 'click', updater.cb.verbose
|
$.on input, 'click', updater.cb.verbose
|
||||||
updater.cb.verbose.call input
|
updater.cb.verbose.call input
|
||||||
@ -1811,6 +1807,12 @@ updater =
|
|||||||
updater.timeoutID = setTimeout updater.timeout, 1000
|
updater.timeoutID = setTimeout updater.timeout, 1000
|
||||||
else
|
else
|
||||||
clearTimeout updater.timeoutID
|
clearTimeout updater.timeoutID
|
||||||
|
scrollBG: ->
|
||||||
|
updater.scrollBG =
|
||||||
|
if @checked
|
||||||
|
-> true
|
||||||
|
else
|
||||||
|
-> !(d.hidden or d.oHidden or d.mozHidden or d.webkitHidden)
|
||||||
update: ->
|
update: ->
|
||||||
if @status is 404
|
if @status is 404
|
||||||
updater.timer.textContent = ''
|
updater.timer.textContent = ''
|
||||||
@ -1857,7 +1859,8 @@ updater =
|
|||||||
$.prepend frag, reply.parentNode.parentNode.parentNode #table
|
$.prepend frag, reply.parentNode.parentNode.parentNode #table
|
||||||
|
|
||||||
newPosts = frag.childNodes.length
|
newPosts = frag.childNodes.length
|
||||||
scroll = conf['Scrolling'] && updater.focus && newPosts && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20)
|
scroll = conf['Scrolling'] && updater.scrollBG() && newPosts &&
|
||||||
|
updater.br.previousElementSibling.getBoundingClientRect().bottom - d.body.clientHeight < 25
|
||||||
if conf['Verbose']
|
if conf['Verbose']
|
||||||
updater.count.textContent = '+' + newPosts
|
updater.count.textContent = '+' + newPosts
|
||||||
if newPosts is 0
|
if newPosts is 0
|
||||||
@ -1867,7 +1870,7 @@ updater =
|
|||||||
|
|
||||||
$.before updater.br, frag
|
$.before updater.br, frag
|
||||||
if scroll
|
if scroll
|
||||||
scrollTo 0, d.body.scrollHeight
|
updater.br.previousSibling.scrollIntoView(false)
|
||||||
|
|
||||||
timeout: ->
|
timeout: ->
|
||||||
updater.timeoutID = setTimeout updater.timeout, 1000
|
updater.timeoutID = setTimeout updater.timeout, 1000
|
||||||
@ -2344,7 +2347,6 @@ unread =
|
|||||||
Favicon.update()
|
Favicon.update()
|
||||||
|
|
||||||
scroll: ->
|
scroll: ->
|
||||||
updater.focus = true
|
|
||||||
height = d.body.clientHeight
|
height = d.body.clientHeight
|
||||||
for reply, i in unread.replies
|
for reply, i in unread.replies
|
||||||
{bottom} = reply.getBoundingClientRect()
|
{bottom} = reply.getBoundingClientRect()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user