unread count
This commit is contained in:
parent
75022da98f
commit
417206ed17
@ -28,6 +28,7 @@ config =
|
|||||||
'Thread Navigation': [true, 'Navigate to previous / next thread']
|
'Thread Navigation': [true, 'Navigate to previous / next thread']
|
||||||
'Thread Updater': [true, 'Update threads']
|
'Thread Updater': [true, 'Update threads']
|
||||||
'Thread Watcher': [true, 'Bookmark threads']
|
'Thread Watcher': [true, 'Bookmark threads']
|
||||||
|
'Unread Count': [true, 'Show unread post count in tab title']
|
||||||
|
|
||||||
#utility
|
#utility
|
||||||
AEOS =
|
AEOS =
|
||||||
@ -1077,6 +1078,15 @@ for el in $$ '#recaptcha_table a'
|
|||||||
recaptcha = $ '#recaptcha_response_field'
|
recaptcha = $ '#recaptcha_response_field'
|
||||||
recaptcha.addEventListener('keydown', recaptchaListener, true)
|
recaptcha.addEventListener('keydown', recaptchaListener, true)
|
||||||
|
|
||||||
|
scroll = ->
|
||||||
|
height = document.body.clientHeight
|
||||||
|
while reply = g.replies[0]
|
||||||
|
bottom = reply.getBoundingClientRect().bottom
|
||||||
|
if bottom > height #post is not completely read
|
||||||
|
break
|
||||||
|
g.replies.shift()
|
||||||
|
document.title = document.title.replace /\d+/, g.replies.length
|
||||||
|
|
||||||
#major features
|
#major features
|
||||||
if getConfig 'Image Expansion'
|
if getConfig 'Image Expansion'
|
||||||
delform = $ 'form[name=delform]'
|
delform = $ 'form[name=delform]'
|
||||||
@ -1307,5 +1317,11 @@ else #not reply
|
|||||||
for a in as
|
for a in as
|
||||||
a.addEventListener('click', expandComment, true)
|
a.addEventListener('click', expandComment, true)
|
||||||
|
|
||||||
|
if getConfig 'Unread Count'
|
||||||
|
g.replies = $$ 'td.reply, td.replyhl'
|
||||||
|
document.title = '(0) ' + document.title
|
||||||
|
scroll()
|
||||||
|
document.addEventListener 'scroll', scroll, true
|
||||||
|
|
||||||
callback() for callback in g.callbacks
|
callback() for callback in g.callbacks
|
||||||
d.body.addEventListener('DOMNodeInserted', nodeInserted, true)
|
d.body.addEventListener('DOMNodeInserted', nodeInserted, true)
|
||||||
|
|||||||
21
4chan_x.js
21
4chan_x.js
@ -27,7 +27,8 @@
|
|||||||
'Thread Hiding': [true, 'Hide entire threads'],
|
'Thread Hiding': [true, 'Hide entire threads'],
|
||||||
'Thread Navigation': [true, 'Navigate to previous / next thread'],
|
'Thread Navigation': [true, 'Navigate to previous / next thread'],
|
||||||
'Thread Updater': [true, 'Update threads'],
|
'Thread Updater': [true, 'Update threads'],
|
||||||
'Thread Watcher': [true, 'Bookmark threads']
|
'Thread Watcher': [true, 'Bookmark threads'],
|
||||||
|
'Unread Count': [true, 'Show unread post count in tab title']
|
||||||
};
|
};
|
||||||
AEOS = {
|
AEOS = {
|
||||||
init: function() {
|
init: function() {
|
||||||
@ -1359,6 +1360,18 @@
|
|||||||
}
|
}
|
||||||
recaptcha = $('#recaptcha_response_field');
|
recaptcha = $('#recaptcha_response_field');
|
||||||
recaptcha.addEventListener('keydown', recaptchaListener, true);
|
recaptcha.addEventListener('keydown', recaptchaListener, true);
|
||||||
|
scroll = function() {
|
||||||
|
var bottom, height, reply;
|
||||||
|
height = document.body.clientHeight;
|
||||||
|
while (reply = g.replies[0]) {
|
||||||
|
bottom = reply.getBoundingClientRect().bottom;
|
||||||
|
if (bottom > height) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
g.replies.shift();
|
||||||
|
}
|
||||||
|
return document.title = document.title.replace(/\d+/, g.replies.length);
|
||||||
|
};
|
||||||
if (getConfig('Image Expansion')) {
|
if (getConfig('Image Expansion')) {
|
||||||
delform = $('form[name=delform]');
|
delform = $('form[name=delform]');
|
||||||
expand = n('div', {
|
expand = n('div', {
|
||||||
@ -1671,6 +1684,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getConfig('Unread Count')) {
|
||||||
|
g.replies = $$('td.reply, td.replyhl');
|
||||||
|
document.title = '(0) ' + document.title;
|
||||||
|
scroll();
|
||||||
|
document.addEventListener('scroll', scroll, true);
|
||||||
|
}
|
||||||
_ref4 = g.callbacks;
|
_ref4 = g.callbacks;
|
||||||
for (_m = 0, _len6 = _ref4.length; _m < _len6; _m++) {
|
for (_m = 0, _len6 = _ref4.length; _m < _len6; _m++) {
|
||||||
callback = _ref4[_m];
|
callback = _ref4[_m];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user