this.$el = $(_.template($('#tmpl_applet_settings').html().trim(), text));\r
\r
if (!navigator.registerProtocolHandler) {\r
- this.$el.find('.protocol_handler').remove();\r
+ this.$('.protocol_handler').remove();\r
}\r
\r
- if (!window.webkitNotifications) {\r
- this.$el.find('notification_enabler').remove();\r
+ if (!(window.Notification || window.webkitNotifications || window.mozNotification)) {\r
+ this.$('notification_enabler').remove();\r
}\r
\r
// Incase any settings change while we have this open, update them\r
\r
$.each(_kiwi.global.settings.attributes, function(key, value) {\r
\r
- var $el = $('[data-setting="' + key + '"]', that.$el);\r
+ var $el = that.$('[data-setting="' + key + '"]');\r
\r
// Only deal with settings we have a UI element for\r
if (!$el.length)\r
saveSettings: function (event) {\r
var value,\r
settings = _kiwi.global.settings,\r
- $setting = $(event.currentTarget, this.$el);\r
+ $setting = this.$(event.currentTarget);\r
\r
switch (event.currentTarget.type) {\r
case 'checkbox':\r
selectTheme: function(event) {\r
event.preventDefault();\r
\r
- $('[data-setting="theme"].active', this.$el).removeClass('active');\r
+ this.$('[data-setting="theme"].active').removeClass('active');\r
$(event.currentTarget).addClass('active').trigger('change');\r
},\r
\r
navigator.registerProtocolHandler('ircs', document.location.origin + _kiwi.app.get('base_path') + '/%s', 'Kiwi IRC');\r
},\r
\r
- enableNotifications: function(event){\r
+ enableNotifications: function(event) {\r
event.preventDefault();\r
+ var Notify = window.Notification || window.webkitNotifications;\r
\r
- if ('webkitNotifications' in window) {\r
- window.webkitNotifications.requestPermission();\r
- } else if ('Notification' in window) {\r
- Notification.requestPermission();\r
+ if (Notify) {\r
+ Notify.requestPermission();\r
}\r
}\r
\r