set time interval to 30s for update check
[e-DoKo.git] / js / layout.js
index 74a0fe0e33a49aafcddb0ad8d8a12def3262c0d6..34847b8e3e2dffabc0a015b51383fddb507d6784 100644 (file)
@@ -28,3 +28,40 @@ $(".doregister select").wrap('<div class="controls">');
 $(".gravatar").addClass('img-polaroid');
 
 $(".welcomestats").addClass('offset1');
+
+// about
+$('div.about').addClass('row-fluid');
+$('div.code').addClass('offset2 span2');
+$('div.database').addClass('span2');
+$('div.graphics').addClass('span2');
+$('div.translation').addClass('span2');
+
+// favicon as indicator if it's your turn
+document.head || (document.head = document.getElementsByTagName('head')[0]);
+
+function checkFavicon() {
+    /* check if it's your turn */
+    url=window.location.href;
+    url=url.substring(0, url.lastIndexOf('index.php'))+"testfav.php";
+
+    $.getJSON(url)
+       .done(function( json ) {
+
+           var link = document.createElement('link'),
+           oldLink = document.getElementById('favicon');
+           link.id = 'favicon';
+           link.rel = 'shortcut icon';
+
+           if(json.turn=="yes")
+               link.href = "pics/edoko-favicon-your-turn.png";
+           else
+               link.href = "pics/edoko-favicon.png";
+
+           if (oldLink)
+               document.head.removeChild(oldLink);
+
+           document.head.appendChild(link);
+       });
+}
+checkFavicon();
+setInterval(checkFavicon,30000);