Special Ops 2.50
[specialops2.git] / js / index.js.txt
blob42c46e018ec6258295f0cc193b420c211fc0e80c
1 // Boardlist auto refresh code
2 var boardlist;
3 var blInterval = 2; // Start updating once in this many timer loops
4 var replacenode = 'so2-index';
6 function blUpdate() {
7     if ( boardlist.readyState == 4 && boardlist.status == 200 ) {
8         var update = boardlist.responseXML.getElementById(replacenode);
9         var boards = document.getElementById(replacenode);
10         document.getElementById(replacenode).parentNode.replaceChild(update, boards);
11     }
14 // Get boardlist every so often
15 timers.things.push(
16     function() {
17         if ( timers.loop % blInterval == 0 ) {
18             blInterval <<= 1; // double delay every update to prevent flooding the server
19             boardlist = new XMLHttpRequest();
20             boardlist.onreadystatechange = blUpdate;
21             boardlist.open('GET', 'index', true);
22             boardlist.send(null);
23         }
24     }