|
|
@ -116,7 +116,7 @@ $(document).ready(function(){ |
|
|
|
var title = document.title; |
|
|
|
|
|
|
|
if (typeof update_title == "undefined") { |
|
|
|
var update_title = function() { |
|
|
|
var update_title = function() { |
|
|
|
if (new_posts) { |
|
|
|
document.title = "("+new_posts+") "+title; |
|
|
|
} else { |
|
|
@ -134,6 +134,7 @@ $(document).ready(function(){ |
|
|
|
var window_active = true; |
|
|
|
$(window).focus(function() { |
|
|
|
window_active = true; |
|
|
|
recheck_activated(); |
|
|
|
|
|
|
|
// Reset the delay if needed
|
|
|
|
if(settings.get('reset_focus', true)) { |
|
|
@ -155,7 +156,6 @@ $(document).ready(function(){ |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var decrement_timer = function() { |
|
|
|
poll_current_time = poll_current_time - 1000; |
|
|
|
$('#update_secs').text(poll_current_time/1000); |
|
|
@ -165,6 +165,16 @@ $(document).ready(function(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var recheck_activated = function() { |
|
|
|
if (new_posts && window_active && |
|
|
|
$(window).scrollTop() <= |
|
|
|
$('header').position().top + $('header').outerHeight(true)) { |
|
|
|
new_posts = 0; |
|
|
|
} |
|
|
|
update_title(); |
|
|
|
first_new_post = null; |
|
|
|
}; |
|
|
|
|
|
|
|
// automatically updates the thread after a specified delay
|
|
|
|
var auto_update = function(delay) { |
|
|
|
clearInterval(countdown_interval); |
|
|
@ -207,11 +217,11 @@ $(document).ready(function(){ |
|
|
|
if($('#' + id).length == 0) { |
|
|
|
if (!new_posts) { |
|
|
|
first_new_post = this; |
|
|
|
makeIcon('reply'); |
|
|
|
if (notify === "all") { |
|
|
|
var body = $(this).children('.body').html().replace(/<br\s*[\/]?>/gi, "\n"); |
|
|
|
var n = new Notification("New reply to "+$('title').text(), {body: $('<div/>').html(body).text()}); |
|
|
|
} |
|
|
|
} |
|
|
|
// Notify on all posts, not just the first unread
|
|
|
|
if (notify === "all") { |
|
|
|
var body = $(this).children('.body').html().replace(/<br\s*[\/]?>/gi, "\n"); |
|
|
|
var n = new Notification("New reply to "+$('title').text(), {body: $('<div/>').html(body).text()}); |
|
|
|
} |
|
|
|
if ($("div.post,div.thread").length > 1){ |
|
|
|
$(this).parent().insertBefore($($('div.post,div.thread').not('.post-hover').first()).parent()); |
|
|
@ -222,6 +232,7 @@ $(document).ready(function(){ |
|
|
|
new_posts++; |
|
|
|
loaded_posts++; |
|
|
|
$(document).trigger('new_post', this); |
|
|
|
recheck_activated(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
@ -279,6 +290,9 @@ $(document).ready(function(){ |
|
|
|
|
|
|
|
return false; |
|
|
|
}; |
|
|
|
$(window).scrollStopped(function() { |
|
|
|
recheck_activated(); |
|
|
|
}); |
|
|
|
|
|
|
|
$('#update_thread').on('click', function() { poll(manualUpdate = true); return false; }); |
|
|
|
|
|
|
|