19 |
|
|
20 |
function getMoreHistory(){ |
function getMoreHistory(){ |
21 |
var indexVal = getElement("history_index").value; |
var indexVal = getElement("history_index").value; |
22 |
var xmlDoc = doSimpleXMLHttpRequest("index.cgi/snippet", {index: indexVal, q: document.getElementById('q').value }); |
var q = getElement('q').value; |
23 |
|
getElement('status').innerHTML = 'Loading page '+ ( parseInt(indexVal) + 1 ) + '...'; |
24 |
|
var xmlDoc = doSimpleXMLHttpRequest("index.cgi/snippet", {index: indexVal, q: q}); |
25 |
xmlDoc.addCallbacks(addMoreHistory, failure); |
xmlDoc.addCallbacks(addMoreHistory, failure); |
26 |
} |
} |
27 |
|
|
40 |
var index_el = getElement("history_index"); |
var index_el = getElement("history_index"); |
41 |
var indexVal = parseInt(index_el.value); |
var indexVal = parseInt(index_el.value); |
42 |
|
|
43 |
// minimum response length? |
// minimum response length? |
44 |
if (response.length < 300){ |
if (response.length < 500){ |
45 |
|
|
46 |
showElement("footer") |
showElement("footer") |
47 |
if( indexVal > 0 ){ |
if( indexVal > 0 ){ |
50 |
); |
); |
51 |
}else{ |
}else{ |
52 |
var out = H2({'style':'text-align:center; font-style:italic; padding: 2em;'}, |
var out = H2({'style':'text-align:center; font-style:italic; padding: 2em;'}, |
53 |
"No posts matched your search." |
"No results matched your search." |
54 |
); |
); |
55 |
} |
} |
56 |
replaceChildNodes( "more_history", out ) |
replaceChildNodes( "more_history", out ) |
57 |
|
getElement("status").innerHTML = ''; |
58 |
return; |
return; |
59 |
} |
} |
60 |
|
|
70 |
swapDOM( "more_history", new_history ); |
swapDOM( "more_history", new_history ); |
71 |
|
|
72 |
isUpdating = false; |
isUpdating = false; |
73 |
|
|
74 |
|
var status_update = getElement("status_update"); |
75 |
|
var status = getElement("status"); |
76 |
|
if (status_update && status) { |
77 |
|
status.innerHTML = status_update.innerHTML; |
78 |
|
log("status updated"); |
79 |
|
} |
80 |
|
|
81 |
} |
} |
82 |
|
|
83 |
function updatePage(){ |
function updatePage(){ |
84 |
if ( isUpdating == false |
if ( isUpdating == false |
85 |
&& mouseState == "up" |
&& mouseState == "up" |
86 |
&& getPageHeight() - getScrollHeight() < preloadDistance){ |
&& getPageHeight() - getScrollHeight() < preloadDistance){ |
87 |
log("Getting segment: ", $("history_index").value); |
log("Getting segment: ", $("history_index").value); |
88 |
setCookie(id, $("history_index").value ); |
setCookie(id, $("history_index").value ); |
89 |
isUpdating = true; |
isUpdating = true; |
90 |
getMoreHistory(); |
getMoreHistory(); |
91 |
} |
} |
92 |
checker.cancel(); |
checker.cancel(); |