well, this actually fixes vichan-devel#41 i believe
This commit is contained in:
parent
9109096ea8
commit
808a5ab8f6
19
js/watch.js
19
js/watch.js
@ -23,6 +23,15 @@ $(function(){
|
|||||||
delete localStorage.watch;
|
delete localStorage.watch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var window_active = true;
|
||||||
|
$(window).focus(function() {
|
||||||
|
window_active = true;
|
||||||
|
$(window).trigger('scroll');
|
||||||
|
});
|
||||||
|
$(window).blur(function() {
|
||||||
|
window_active = false;
|
||||||
|
});
|
||||||
|
|
||||||
var status = {};
|
var status = {};
|
||||||
|
|
||||||
time_loaded = Date.now();
|
time_loaded = Date.now();
|
||||||
@ -225,6 +234,7 @@ $(function(){
|
|||||||
};
|
};
|
||||||
var fetch_jsons = function() {
|
var fetch_jsons = function() {
|
||||||
if (updating_suspended) return;
|
if (updating_suspended) return;
|
||||||
|
if (window_active) check_scroll();
|
||||||
|
|
||||||
var st = storage();
|
var st = storage();
|
||||||
for (var i in st) {
|
for (var i in st) {
|
||||||
@ -334,7 +344,7 @@ $(function(){
|
|||||||
post.position().top + post.height();
|
post.position().top + post.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(window).scroll(function() {
|
var check_scroll = function() {
|
||||||
if (!status) return;
|
if (!status) return;
|
||||||
var refresh = false;
|
var refresh = false;
|
||||||
for(var bid in status) {
|
for(var bid in status) {
|
||||||
@ -356,11 +366,16 @@ $(function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return refresh;
|
||||||
|
};
|
||||||
|
|
||||||
|
$(window).scroll(function() {
|
||||||
|
var refresh = check_scroll();
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
fetch_jsons();
|
fetch_jsons();
|
||||||
refresh = false;
|
refresh = false;
|
||||||
}
|
}
|
||||||
}).trigger("scroll");
|
});
|
||||||
|
|
||||||
if (typeof add_title_collector != "undefined")
|
if (typeof add_title_collector != "undefined")
|
||||||
add_title_collector(function() {
|
add_title_collector(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user