From: Jack Allnutt Date: Fri, 28 Jun 2013 21:09:07 +0000 (+0100) Subject: Add button to register Kiwi as a handler for the irc: protocol X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ed5b9cd6b7e27de529029999831b7f8292d12a6c;p=KiwiIRC.git Add button to register Kiwi as a handler for the irc: protocol --- diff --git a/client/assets/src/applets/settings.js b/client/assets/src/applets/settings.js index afe1209..16fc882 100644 --- a/client/assets/src/applets/settings.js +++ b/client/assets/src/applets/settings.js @@ -2,12 +2,17 @@ var View = Backbone.View.extend({ events: { 'change [data-setting]': 'saveSettings', - 'click [data-setting="theme"]': 'selectTheme' + 'click [data-setting="theme"]': 'selectTheme', + 'click .registerProtocol': 'registerProtocol' }, initialize: function (options) { this.$el = $($('#tmpl_applet_settings').html().trim()); + if (!navigator.registerProtocolHandler) { + this.$el.find('.protoHandler').remove(); + } + // Incase any settings change while we have this open, update them _kiwi.global.settings.on('change', this.loadSettings, this); @@ -76,6 +81,11 @@ $('[data-setting="theme"].active', this.$el).removeClass('active'); $(event.currentTarget).addClass('active').trigger('change'); event.preventDefault(); + }, + + registerProtocol: function (event) { + navigator.registerProtocolHandler('irc', document.location.origin + _kiwi.app.get('base_path') + '/%s', 'Kiwi IRC'); + navigator.registerProtocolHandler('ircs', document.location.origin + _kiwi.app.get('base_path') + '/%s', 'Kiwi IRC'); } }); diff --git a/client/assets/src/index.html.tmpl b/client/assets/src/index.html.tmpl index 81856d3..fa96a76 100644 --- a/client/assets/src/index.html.tmpl +++ b/client/assets/src/index.html.tmpl @@ -244,6 +244,15 @@ + +
+
irc: protocol hander
+
+ +
+ Allow Kiwi IRC to handle irc: links (Example: irc:irc.example.com:6667/irchelp) +
+