Advertisement
framp

Buddypress html5 notifications - per Pollycoke

May 27th, 2011
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (window.webkitNotifications) {
  2.   if (window.webkitNotifications.checkPermission() != 0){
  3.     jQuery('#content>div>ul:eq(1)').append(
  4.       '<li>' +
  5.         '<a href="#" id="html5-notifications" title="Attiva le notifiche dei pollycokers" >' +
  6.           '<img height="20px" ' +
  7.             'src="http://www.html5rocks.com/static/images/identity/html5-badge-h-performance.png"' +
  8.           '/>' +
  9.         '</a>' +
  10.       '</li>');
  11.     jQuery("#html5-notifications").click(function(){
  12.       if (window.webkitNotifications.checkPermission() != 0) {
  13.         window.webkitNotifications.requestPermission();
  14.       }
  15.     });
  16.   }
  17.  
  18.   BPLN_Helper.notify = function (msg){
  19.    if (window.webkitNotifications.checkPermission() == 0)
  20.     window.webkitNotifications.createNotification(
  21.       'http://www.gravatar.com/avatar/7a1451683db87b00ffb3f85982ebbfb5',
  22.       'Nuova segnalazione su pollycoke',
  23.       msg).show();
  24.    else
  25.     jq.achtung({message: msg, timeout:10});//show for 10 seconds
  26.  }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement