Wrap attempt at lang in try/catch for if egw.lang() isn't available

This commit is contained in:
Nathan Gray 2011-11-30 19:48:54 +00:00
parent 2c636586c6
commit 2d906d7a3e

View File

@ -60,7 +60,11 @@ function egwpopup_display() {
if(window.webkitNotifications && window.webkitNotifications.checkPermission() != EGW_BROWSER_NOTIFY_ALLOWED && if(window.webkitNotifications && window.webkitNotifications.checkPermission() != EGW_BROWSER_NOTIFY_ALLOWED &&
jQuery('#desktop_perms').length == 0) jQuery('#desktop_perms').length == 0)
{ {
var desktop_button = jQuery('<button id="desktop_perms">' + (egw?egw.lang('Desktop notifications') : 'Desktop notifications') + '</button>') var label = 'Desktop notifications';
try {
if(egw) label = egw.lang(label);
} catch(err) {}
var desktop_button = jQuery('<button id="desktop_perms">' + label + '</button>')
.click(function() { .click(function() {
window.webkitNotifications.requestPermission(); window.webkitNotifications.requestPermission();
jQuery(this).hide(); jQuery(this).hide();