8 |
|
|
9 |
var preloadDistance = 1000; |
var preloadDistance = 1000; |
10 |
var isUpdating = false; |
var isUpdating = false; |
11 |
|
var isMouseDown = false; |
12 |
var checker; |
var checker; |
13 |
var v; |
var v; |
14 |
var cookie = 'no_pager'; |
var cookie = 'no_pager'; |
35 |
setCookie(cookie+"_scroll", getScrollHeight() - _getWindowHeight() ); |
setCookie(cookie+"_scroll", getScrollHeight() - _getWindowHeight() ); |
36 |
|
|
37 |
if ( isUpdating == true |
if ( isUpdating == true |
38 |
|
|| isMouseDown == true |
39 |
|| getPageHeight() - getScrollHeight() > preloadDistance |
|| getPageHeight() - getScrollHeight() > preloadDistance |
40 |
|| v.page >= v.max_page |
|| v.page >= v.max_page |
41 |
) return; |
) return; |
62 |
}, |
}, |
63 |
function ( response ) { |
function ( response ) { |
64 |
|
|
65 |
if (response.length < 500) { |
$('#next_page').html( response ); |
|
$('#footer').show(); |
|
|
if ( v.page > 0 ) { |
|
|
$('#more_history').html('<h2 style="text-align: center; font-style:italic; padding: 2em;">No more results.</h2>'); |
|
|
} else { |
|
|
$('#more_history').html('<h2 style="text-align: center; font-style:italic; padding: 2em;">No results matched your search.</h2>'); |
|
|
} |
|
|
$('#status').html( 'All results shown.' ); |
|
|
return; |
|
|
} |
|
|
|
|
|
response += "<div id='more_history'>"; |
|
|
response += " <strong>More posts are being loaded...</strong> <br />"; |
|
|
response += " If you are using the scroll bar, release the mouse to see more posts."; |
|
|
response += "</div>" |
|
|
$('#more_history').html( response ); |
|
66 |
|
|
67 |
eval( 'v=' + $('#json').val() ); |
eval( 'v=' + $('#json').val() ); |
68 |
|
|
104 |
scroll( 0, getCookie(cookie+'_scroll') ); |
scroll( 0, getCookie(cookie+'_scroll') ); |
105 |
} |
} |
106 |
|
|
107 |
|
$(window).mousedown( function () { |
108 |
|
isMouseDown = true; |
109 |
|
}); |
110 |
|
$(window).mouseup( function () { |
111 |
|
isMouseDown = false; |
112 |
|
}); |
113 |
|
|
114 |
checker = setInterval(function () { |
checker = setInterval(function () { |
115 |
load_page(); |
load_page(); |