From 68c2316ce3f18110430eaf8d632b5383b719519a Mon Sep 17 00:00:00 2001
From: tomtom84 <thomas.bierey@gmx.de>
Date: Mon, 17 Sep 2012 17:54:07 +0200
Subject: [PATCH] Corrected titlebar notifications in Diabook

---
 view/theme/diabook/bottom.tpl | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/view/theme/diabook/bottom.tpl b/view/theme/diabook/bottom.tpl
index 0ab7de78e..08952aad6 100644
--- a/view/theme/diabook/bottom.tpl
+++ b/view/theme/diabook/bottom.tpl
@@ -130,7 +130,7 @@ $(document).ready(function() {
 	$(".comment-edit-bb-" + id).hide();
 	}
 	
-	$(document).ready(function(){
+	/*$(document).ready(function(){
 	var doctitle = document.title;
 	function checkNotify() {
 	if(document.getElementById("notify-update").innerHTML != "")
@@ -139,7 +139,17 @@ $(document).ready(function() {
 	document.title = doctitle;
 	};
 	setInterval(function () {checkNotify();}, 10 * 1000);
-	})
-
-	
+	})*/
+</script>
+<script>
+var pagetitle = null;
+$("nav").bind('nav-update',  function(e,data){
+  if (pagetitle==null) pagetitle = document.title;
+  var count = $(data).find('notif').attr('count');
+  if (count>0) {
+    document.title = "("+count+") "+pagetitle;
+  } else {
+    document.title = pagetitle;
+  }
+});
 </script>