- Timestamp:
- 07/10/12 12:07:35 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.2-expresso1/expressoMail1_2/js/main.js
r6721 r6749 1 1 // Tempo do auto refresh (em milisegundos) 2 var time_refresh = 300000; 2 //var time_refresh = 300000; 3 var time_refresh = 30000; 3 4 // tempo do auto save (em milisegundos) 4 5 // 20000 = 20 segundos … … 9 10 var checkAlarmsFilter = false; 10 11 12 var notifyNewMessage = []; 13 11 14 var dynamicPersonalContacts = new Array(); 12 15 var dynamicContacts = new Array(); … … 20 23 } 21 24 } 22 23 24 25 25 26 function mount_url_folder(folders){ 26 27 return folders.join(cyrus_delimiter); … … 555 556 } 556 557 558 559 //here 560 561 function Notifier() {} 562 563 $(document).ready( function(){ 564 565 // Returns "true" if this browser supports notifications. 566 Notifier.prototype.HasSupport = function() { 567 if (window.webkitNotifications) 568 return true; 569 else 570 return false; 571 572 } 573 574 // Request permission for this page to send notifications. If allowed, 575 // calls function "cb" with true. 576 Notifier.prototype.RequestPermission = function(cb) { 577 window.webkitNotifications.requestPermission(); 578 } 579 580 // Popup a notification with icon, title, and body. Returns false if 581 // permission was not granted. 582 Notifier.prototype.Notify = function(icon, title, body) { 583 if (window.webkitNotifications.checkPermission() == 0) { 584 var popup = window.webkitNotifications.createNotification( 585 icon, title, body); 586 popup.show(); 587 588 return true; 589 } 590 591 return false; 592 } 593 594 $(function() { 595 var notifier = new Notifier(); 596 if (window.webkitNotifications.checkPermission() != 0){ 597 notifier.RequestPermission(); 598 } 599 }); 600 }); 601 602 557 603 function auto_archiving() { 558 604 expresso_mail_sync.start_sync(); 559 605 setTimeout('auto_archiving()',600000); 560 606 } 607 608 var auxNotification; 561 609 562 610 function refresh(alert_new_msg){ … … 582 630 showEmptyBoxMsg(box); 583 631 584 if (data.length > 0 ){632 if (data.length > 0 || notifyNewMessage.length > 0){ 585 633 for(var i=0;i< data.length;i++){ 586 634 if (!onceOpenedHeadersMessages[current_folder]) … … 712 760 select_msg("null","reload_msg","null"); 713 761 714 if(parseInt(alert_new_msg) && data.new_msgs > 0) 715 alert(data['new_msgs'] > 1 ? get_lang("You have %1 new messages", data['new_msgs']) + "!" : get_lang("You have 1 new message") +"!"); 762 if(parseInt(alert_new_msg) && (data.new_msgs > 0 || notifyNewMessage.length > 0) ){ 763 764 for(var i=0; i<data.length; i++){ 765 notifyNewMessage.push(true); 766 } 767 768 notification = webkitNotifications.createNotification("","Notificação",notifyNewMessage.length > 1 ? get_lang("You have %1 new messages", notifyNewMessage.length) + "!" : get_lang("You have 1 new message") +"!"); 769 notification.onclick = function(){ 770 window.focus(); 771 this.cancel(); 772 notifyNewMessage = []; 773 }; 774 775 if(auxNotification) 776 auxNotification.cancel(); 777 778 notification.ondisplay = function(){ 779 auxNotification = notification; 780 }; 781 notification.show(); 782 783 } 716 784 build_quota(data['quota']); 717 785 }
Note: See TracChangeset
for help on using the changeset viewer.