Browse Source

Revert to old auto-reload.js

with barrucadu's modifications
pull/40/head
Simon McFarlane 9 years ago
parent
commit
7ab9cc43d1
  1. 20
      js/auto-reload.js

20
js/auto-reload.js

@ -17,9 +17,15 @@
*
*/
au = false;
auto_reload_enabled = true; // for watch.js to interop
function makeIcon(){
if(au) return;
au = true;
$("link[rel='icon']").attr("href", "../static/favicon_au.png");
}
$(document).ready(function(){
if($('div.banner').length == 0)
return; // not index
@ -30,7 +36,7 @@ $(document).ready(function(){
var countdown_interval;
// Add an update link
$('.boardlist.bottom').prev().after("<span id='updater'><a href='#' id='update_thread' style='padding-left:10px'>["+_("Update")+"]</a> (<input type='checkbox' id='auto_update_status' checked> "+_("Auto")+") <span id='update_secs'></span></span>");
$(".threadlinks span:last-child").after("<span id='updater'><a href='#' id='update_thread' style='padding-left:10px'>"+_("Update")+"</a> ] (<input type='checkbox' id='auto_update_status' checked> "+_("Auto")+") <span id='update_secs'></span></span>");
// Grab the settings
var settings = new script_settings('auto-reload');
@ -102,7 +108,7 @@ $(document).ready(function(){
var recheck_activated = function() {
if (new_posts && window_active &&
$(window).scrollTop() + $(window).height() >=
$('div.boardlist.bottom').position().top) {
$('footer').position().top) {
new_posts = 0;
}
@ -144,13 +150,14 @@ $(document).ready(function(){
url: document.location,
success: function(data) {
var loaded_posts = 0; // the number of new posts loaded in this update
$(data).find('div.post.reply').each(function() {
var id = $(this).attr('id');
$(data).find('div.postcontainer').each(function() {
var id = $(this).attr('id').substring(2);
if($('#' + id).length == 0) {
if (!new_posts) {
first_new_post = this;
makeIcon();
}
$(this).insertAfter($('div.post:last').next()).after('<br class="clear">');
$(this).insertAfter($('div.postcontainer:last').next()).after('<br class="clear">');
new_posts++;
loaded_posts++;
$(document).trigger('new_post', this);
@ -234,4 +241,3 @@ $(document).ready(function(){
auto_update(poll_interval_delay);
}
});

Loading…
Cancel
Save