From 69200c78548f5f3792f920decf3f763fdaf3f60f Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Mon, 28 Oct 2013 13:55:46 +0100 Subject: [PATCH 1/2] Prevent user from accidentally leaving the page --- js/websockets.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/websockets.js b/js/websockets.js index 6f4aa1b..c1d5995 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -667,6 +667,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } } + // Prevent user from accidentally leaving the page + window.onbeforeunload = function(event) { + event.preventDefault(); + }; + }] ); From 1615f3016bfa1e901a0126feee52bba7a9660d6f Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Mon, 28 Oct 2013 14:37:21 +0100 Subject: [PATCH 2/2] Use angular function to linkify text. Fixes bugs with HTML escaping in text --- index.html | 2 +- js/plugins.js | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/index.html b/index.html index 9d6bafb..990212d 100644 --- a/index.html +++ b/index.html @@ -254,7 +254,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel {{ part.text }} - +
diff --git a/js/plugins.js b/js/plugins.js index 33db097..5599972 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -80,19 +80,6 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) { } } - /* Replace all URLs with hyperlinks */ - - var urlRegexp = RegExp(/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/g); - for(k in message.content) { - var text = message.content[k].text; - var url = text.match(urlRegexp); - for(i in url) { - var u = url[i]; - text = text.replace(u, '' + u + ''); - } - message.content[k].text = $sce.trustAsHtml(text); - } - return message; }