Add button to register Kiwi as a handler for the irc: protocol
authorJack Allnutt <m2ys4u@gmail.com>
Fri, 28 Jun 2013 21:09:07 +0000 (22:09 +0100)
committerJack Allnutt <m2ys4u@gmail.com>
Fri, 28 Jun 2013 21:15:52 +0000 (22:15 +0100)
client/assets/src/applets/settings.js
client/assets/src/index.html.tmpl

index afe120964f0c5bfc0011ef07dd12bb848b9b10f6..16fc8825cf98e3ac0b2416847a00c06fc224349f 100644 (file)
@@ -2,12 +2,17 @@
     var View = Backbone.View.extend({\r
         events: {\r
             'change [data-setting]': 'saveSettings',\r
-            'click [data-setting="theme"]': 'selectTheme'\r
+            'click [data-setting="theme"]': 'selectTheme',\r
+            'click .registerProtocol': 'registerProtocol'\r
         },\r
 \r
         initialize: function (options) {\r
             this.$el = $($('#tmpl_applet_settings').html().trim());\r
 \r
+            if (!navigator.registerProtocolHandler) {\r
+                this.$el.find('.protoHandler').remove();\r
+            }\r
+\r
             // Incase any settings change while we have this open, update them\r
             _kiwi.global.settings.on('change', this.loadSettings, this);\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
+            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
 \r
index 81856d36f41a06dca6a728a4bac67d4e76af28a1..fa96a7692a51ff53bd74b6dd528f9a5b222ed07e 100644 (file)
                     </label>\r
                 </div>\r
             </section>\r
+\r
+            <section class="protoHandler">\r
+                <h6>irc: protocol hander</h6>\r
+                <div class="control-group">\r
+                    <button class="registerProtocol">Register protocol handler</button>\r
+                    <br>\r
+                    <span>Allow Kiwi IRC to handle irc: links <small>(Example: <a href="irc:irc.example.com:6667/irchelp">irc:irc.example.com:6667/irchelp</a>)</small></span>\r
+                </div>\r
+            </section>\r
         </div>\r
     </script>\r
 \r