Make boardlist update only fire once every 5 minutes
[specialops2.git] / js / index.js
blobdf4107777d1025d016a6a2413b30927264378e23
1 /* © Special Ops 2006
2  * See the included COPYING file for licencing terms.
3  * $Id$
4  */
6 var boardlist;
7 var blCycle = 0;
9 function blUpdate() {
10         if ( boardlist.readyState == 4 && boardlist.status == 200 ) {
11                 var update = boardlist.responseXML.getElementById('boardlist');
12                 var boards = document.getElementById('boardlist');
13                 document.getElementById('so2-index').replaceChild(update, boards);
14         }
17 // Get boardlist every few seconds
18 timers.things.push(
19         function() {
20                 if ( blCycle % 5 ) {
21                         boardlist = new XMLHttpRequest();
22                         boardlist.onreadystatechange = blUpdate;
23                         boardlist.open('GET', 'index?xml', true);
24                         boardlist.send(null);
25                 }
26                 blCycle++;
27         }