Ignore:
Timestamp:
07/12/12 17:53:57 (12 years ago)
Author:
thiago
Message:

Ticket #2951 - Nossa montagem das notificacao foram implementadas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/js/desktop.notification.js

    r6768 r6774  
    44 
    55    initDesktopNotificationAddon: function(){ 
    6         if(useDesktopNotification()){ 
     6                if(useDesktopNotification()){ 
    77 
    8             if (!window.webkitNotifications && $.browser.mozilla) 
    9                 this.installDektopNotificationAddon(); 
     8                        if (!window.webkitNotifications && $.browser.mozilla) 
     9                        this.installDektopNotificationAddon(); 
    1010 
    11             if(window.webkitNotifications && window.webkitNotifications.checkPermission()) 
    12                 window.webkitNotifications.requestPermission(); 
     11                        if(window.webkitNotifications && window.webkitNotifications.checkPermission()) 
     12                        window.webkitNotifications.requestPermission(); 
    1313 
    14         } 
     14                } 
    1515    }, 
    1616 
     
    1919        var params = { 
    2020            "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                     return this.URL; 
    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                        } 
    2727            } 
    2828        }; 
     
    3535    verifyComplement: function(){ 
    3636 
    37         if(!window.webkitNotifications) 
    38             return false; 
     37                if(!window.webkitNotifications) 
     38                        return false; 
    3939 
    40         if(window.webkitNotifications.checkPermission()) 
    41             return false; 
     40                if(window.webkitNotifications.checkPermission()) 
     41                        return false; 
    4242 
    43         return true; 
    44  
     43                return true; 
    4544    }, 
    4645 
    4746    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        }, 
    5051 
     52        cancelByReference: function(index){ 
     53                if(this.notification[index]) 
     54                        this.notification[index].cancel(); 
     55        }, 
     56         
     57         
    5158    showNotification: function(onClose, onClick, onDisplay, onError){ 
    52         var length = this.notification.length -1;  
     59                var length = this.notification.length -1;  
    5360 
    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; 
    5865 
    59         this.notification[length].show(); 
     66                this.notification[length].show(); 
    6067    } 
    6168} 
     
    6774            activePage = true;   
    6875            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); 
    7984            } 
    8085        }) 
Note: See TracChangeset for help on using the changeset viewer.