- Timestamp:
- 07/12/12 17:53:57 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.2-expresso1/prototype/modules/calendar/js/desktop.notification.js
r6768 r6774 4 4 5 5 initDesktopNotificationAddon: function(){ 6 if(useDesktopNotification()){6 if(useDesktopNotification()){ 7 7 8 9 this.installDektopNotificationAddon();8 if (!window.webkitNotifications && $.browser.mozilla) 9 this.installDektopNotificationAddon(); 10 10 11 12 window.webkitNotifications.requestPermission();11 if(window.webkitNotifications && window.webkitNotifications.checkPermission()) 12 window.webkitNotifications.requestPermission(); 13 13 14 }14 } 15 15 }, 16 16 … … 19 19 var params = { 20 20 "Foo": { 21 URL: '../prototype/plugins/desktop.notification/html_desktop_notifications-1.0.7-fx.xpi' ,22 IconURL:'../prototype/plugins/desktop.notification/desktop-notification.png',23 //Hash:'sha1:28857e60d043447c5f4550853f2d40770b326a13',24 toString: function () {25 26 }21 URL: '../prototype/plugins/desktop.notification/html_desktop_notifications-1.0.7-fx.xpi' , 22 IconURL:'../prototype/plugins/desktop.notification/desktop-notification.png', 23 //Hash:'sha1:28857e60d043447c5f4550853f2d40770b326a13', 24 toString: function () { 25 return this.URL; 26 } 27 27 } 28 28 }; … … 35 35 verifyComplement: function(){ 36 36 37 if(!window.webkitNotifications)38 37 if(!window.webkitNotifications) 38 return false; 39 39 40 if(window.webkitNotifications.checkPermission())41 40 if(window.webkitNotifications.checkPermission()) 41 return false; 42 42 43 return true; 44 43 return true; 45 44 }, 46 45 47 46 sentNotification: function(icon, title, body){ 48 this.notification[this.notification.length] = window.webkitNotifications.createNotification( icon, title, body); 49 }, 47 var reference = this.notification.length; 48 this.notification[reference] = window.webkitNotifications.createNotification( icon, title, body); 49 return reference; 50 }, 50 51 52 cancelByReference: function(index){ 53 if(this.notification[index]) 54 this.notification[index].cancel(); 55 }, 56 57 51 58 showNotification: function(onClose, onClick, onDisplay, onError){ 52 var length = this.notification.length -1;59 var length = this.notification.length -1; 53 60 54 this.notification[length].ondisplay = onDisplay;55 this.notification[length].onclose = onClose;56 this.notification[length].onclick = onClick;57 this.notification[length].onerror = onError;61 this.notification[length].ondisplay = onDisplay; 62 this.notification[length].onclose = onClose; 63 this.notification[length].onclick = onClick; 64 this.notification[length].onerror = onError; 58 65 59 this.notification[length].show();66 this.notification[length].show(); 60 67 } 61 68 } … … 67 74 activePage = true; 68 75 if(!desktopNotification.verifyComplement()){ 69 setTimeout(function(){ 70 console.log(desktopNotification.notification); 71 72 for(var i = 0; i < desktopNotification.notification.length; i++){ 73 desktopNotification.notification[i].cancel(); 74 } 75 desktopNotification.notification = []; 76 77 console.log(desktopNotification.notification); 78 }, 60000); 76 setTimeout(function(){ 77 78 for(var i = 0; i < desktopNotification.notification.length; i++){ 79 desktopNotification.notification[i].cancel(); 80 } 81 desktopNotification.notification = []; 82 83 }, 60000); 79 84 } 80 85 })
Note: See TracChangeset
for help on using the changeset viewer.