From ed5b9cd6b7e27de529029999831b7f8292d12a6c Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Fri, 28 Jun 2013 22:09:07 +0100 Subject: [PATCH] Add button to register Kiwi as a handler for the irc: protocol --- client/assets/src/applets/settings.js | 12 +++++++++++- client/assets/src/index.html.tmpl | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) 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) +
+
-- 2.25.1