unread count

This commit is contained in:
James Campos 2010-12-28 11:00:07 -08:00
parent 75022da98f
commit 417206ed17
2 changed files with 36 additions and 1 deletions

View File

@ -28,6 +28,7 @@ config =
'Thread Navigation': [true, 'Navigate to previous / next thread']
'Thread Updater': [true, 'Update threads']
'Thread Watcher': [true, 'Bookmark threads']
'Unread Count': [true, 'Show unread post count in tab title']
#utility
AEOS =
@ -1077,6 +1078,15 @@ for el in $$ '#recaptcha_table a'
recaptcha = $ '#recaptcha_response_field'
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
if getConfig 'Image Expansion'
delform = $ 'form[name=delform]'
@ -1307,5 +1317,11 @@ else #not reply
for a in as
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
d.body.addEventListener('DOMNodeInserted', nodeInserted, true)

View File

@ -27,7 +27,8 @@
'Thread Hiding': [true, 'Hide entire threads'],
'Thread Navigation': [true, 'Navigate to previous / next thread'],
'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 = {
init: function() {
@ -1359,6 +1360,18 @@
}
recaptcha = $('#recaptcha_response_field');
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')) {
delform = $('form[name=delform]');
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;
for (_m = 0, _len6 = _ref4.length; _m < _len6; _m++) {
callback = _ref4[_m];