Commits

r4vi  committed 608a594

kind of works. huhuhu. see the examples in Chrom[e|ium]. Must be run through a webserver rather than file://

  • Participants
  • Parent commits 3e4e6ab

Comments (0)

Files changed (1)

File jquery.jgrowl.js

 				o.closeDuration = o.speed;
 			}
 
-			this.notifications.push({ message: message , options: o });
+			if (window.webkitNotifications && window.webkitNotifications.checkPermission()==0)
+			{
+				var n = window.webkitNotifications.createNotification(o.header,'',message);
+				n.show();
+			}
+			else 
+			{
+				this.notifications.push({ message: message , options: o });
+				o.log.apply( this.element , [this.element,message,o] );
+			}
 			
-			o.log.apply( this.element , [this.element,message,o] );
 		},
 		
 		render: 		function( notification ) {
 
 			/** Trying to figure out how to check permission **/
 			if (window.webkitNotifications) {
-				var requestPermissionLink = document.createElement("a");
-				requestPermissionLink.id = "requestPermissionLink";
-				requestPermissionLink.href="#";
-				requestPermissionLink.innerHTML = "click me";
-				document.body.appendChild(requestPermissionLink);
-				$("#requestPermissionLink").click(function() {
-					window.webkitNotifications.requestPermission();
-				});
+				if (window.webkitNotifications.checkPermission != 0) {
+					var requestPermissionLink = document.createElement("a");
+					requestPermissionLink.id = "requestPermissionLink";
+					requestPermissionLink.href="#";
+					requestPermissionLink.innerHTML = "click me";
+					document.body.appendChild(requestPermissionLink);
+					$("#requestPermissionLink").click(function() {
+						window.webkitNotifications.requestPermission();
+					});
+				}
 			}
 		},