forked from GithubBackups/vichan
Add timer to auto reload js
This commit is contained in:
parent
62838ed707
commit
416a48838c
4
inc/secrets.php
Normal file
4
inc/secrets.php
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
$config['db']['password'] = '57x9RaVc8HQW2Ga0i74w';
|
||||||
|
$config['cookies']['salt'] = 'UiFLKolfLXUIZZCDQIFOQT1fjCvdyvWqIx3olOnJq0TJpbCAeC';
|
||||||
|
$config['secure_trip_salt'] = 'sK7A4umU4dU0875MAi012239p4WdE7A699032MJWxspSOqb39X';
|
@ -28,7 +28,7 @@ $(document).ready(function(){
|
|||||||
var poll_interval;
|
var poll_interval;
|
||||||
|
|
||||||
// Add an update link
|
// Add an update link
|
||||||
$('.boardlist.bottom').prev().after("<a href='#' id='update_thread' style='padding-left:10px'>["+_("Update thread")+"]</a>");
|
$('.boardlist.bottom').prev().after("<a href='#' id='update_thread' style='padding-left:10px'>["+_("Update thread")+"] (<span id='update_secs'></span>)</a>");
|
||||||
|
|
||||||
// Grab the settings
|
// Grab the settings
|
||||||
var settings = new script_settings('auto-reload');
|
var settings = new script_settings('auto-reload');
|
||||||
@ -39,6 +39,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// number of ms to wait before reloading
|
// number of ms to wait before reloading
|
||||||
var poll_interval_delay = poll_interval_mindelay_bottom;
|
var poll_interval_delay = poll_interval_mindelay_bottom;
|
||||||
|
var poll_current_time = poll_interval_delay;
|
||||||
|
|
||||||
var end_of_page = false;
|
var end_of_page = false;
|
||||||
|
|
||||||
@ -70,6 +71,14 @@ $(document).ready(function(){
|
|||||||
window_active = false;
|
window_active = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var timer_update = function() {
|
||||||
|
$('#update_secs').text(poll_current_time/1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
var decrement_timer = function() {
|
||||||
|
poll_current_time = poll_current_time - 1000;
|
||||||
|
}
|
||||||
|
|
||||||
var recheck_activated = function() {
|
var recheck_activated = function() {
|
||||||
if (new_posts && window_active &&
|
if (new_posts && window_active &&
|
||||||
$(window).scrollTop() + $(window).height() >=
|
$(window).scrollTop() + $(window).height() >=
|
||||||
@ -117,6 +126,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
poll_interval = setTimeout(poll, poll_interval_delay);
|
poll_interval = setTimeout(poll, poll_interval_delay);
|
||||||
|
poll_current_time = poll_interval_delay;
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).scroll(function() {
|
$(window).scroll(function() {
|
||||||
@ -130,11 +140,15 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
clearTimeout(poll_interval);
|
clearTimeout(poll_interval);
|
||||||
poll_interval = setTimeout(poll, poll_interval_shortdelay);
|
poll_interval = setTimeout(poll, poll_interval_shortdelay);
|
||||||
|
poll_current_time = poll_interval_shortdelay;
|
||||||
end_of_page = true;
|
end_of_page = true;
|
||||||
}).trigger('scroll');
|
}).trigger('scroll');
|
||||||
|
|
||||||
$('#update_thread').on('click', poll);
|
$('#update_thread').on('click', poll);
|
||||||
|
setInterval(timer_update, 1000);
|
||||||
|
setInterval(decrement_timer, 1000);
|
||||||
|
|
||||||
poll_interval = setTimeout(poll, poll_interval_delay);
|
poll_interval = setInterval(poll, poll_interval_delay);
|
||||||
|
timer_update();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user