'change [data-setting]': 'saveSettings',\r
'click [data-setting="theme"]': 'selectTheme',\r
'click .register_protocol': 'registerProtocol',\r
- 'click .enable_notifications': 'enableNoticiations'\r
+ 'click .enable_notifications': 'enableNotifications'\r
},\r
\r
initialize: function (options) {\r
this.$el.find('.protocol_handler').remove();\r
}\r
\r
- if (!window.webkitNotifications) {\r
- this.$el.find('notification_enabler').remove();\r
+\r
+ if (_kiwi.global.utils.notifications.allowed() !== null) {\r
+ this.$el.find('.notification_enabler').remove();\r
}\r
\r
// Incase any settings change while we have this open, update them\r
},\r
\r
selectTheme: function(event) {\r
+ event.preventDefault();\r
+\r
$('[data-setting="theme"].active', this.$el).removeClass('active');\r
$(event.currentTarget).addClass('active').trigger('change');\r
- event.preventDefault();\r
},\r
\r
registerProtocol: function (event) {\r
+ event.preventDefault();\r
+\r
navigator.registerProtocolHandler('irc', document.location.origin + _kiwi.app.get('base_path') + '/%s', 'Kiwi IRC');\r
navigator.registerProtocolHandler('ircs', document.location.origin + _kiwi.app.get('base_path') + '/%s', 'Kiwi IRC');\r
},\r
\r
- enableNoticiations: function(event){\r
- window.webkitNotifications.requestPermission();\r
+ enableNotifications: function(event){\r
+ event.preventDefault();\r
+ var notifications = _kiwi.global.utils.notifications;\r
+ notifications.requestPermission().always(_.bind(function () {\r
+ if (notifications.allowed() !== null) {\r
+ this.$('.notification_enabler').remove();\r
+ }\r
+ }, this));\r
}\r
\r
});\r