From b40ab2f50499fddaaa03ea0378636743854d5ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Thu, 16 Oct 2014 19:08:09 +0200 Subject: [PATCH] Fix links and embeds Disable semi-broken plugins --- index.html | 4 ++-- js/filters.js | 9 +++++++++ js/plugins.js | 4 +++- test/unit/plugins.js | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 846e408..1f9e3cb 100644 --- a/index.html +++ b/index.html @@ -197,7 +197,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel -
+
@@ -251,7 +251,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
- + diff --git a/js/filters.js b/js/filters.js index 42335bd..12bbf0e 100644 --- a/js/filters.js +++ b/js/filters.js @@ -23,6 +23,9 @@ weechat.filter('irclinky', ['$filter', function($filter) { var linkiedText = $filter('linky')(text, target); + // Cordova: need to use window.open instead of href + linkiedText = linkiedText.replace(/href="([^"]+)"/gi, "onClick=\"window.open('$1', '_system')\""); + // This regex in no way matches all IRC channel names (they could also begin with &, + or an // exclamation mark followed by 5 alphanumeric characters, and are bounded in length by 50). // However, it matches all *common* IRC channels while trying to minimise false positives. @@ -49,4 +52,10 @@ weechat.filter('inlinecolour', ['$sce', function($sce) { return $sce.trustAsHtml(text.replace(hexColourRegex, substitute)); }; }]); + +weechat.filter('unsafe', ['$sce', function($sce) { + return function(text) { + return $sce.trustAsHtml(text); + }; +}]); })(); diff --git a/js/plugins.js b/js/plugins.js index 88d9cae..d1b7d95 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -338,6 +338,7 @@ plugins.factory('userPlugins', function() { ); yrPlugin.name = "meteogram"; +/* // Embed GitHub gists var gistPlugin = new Plugin( urlPlugin(function(url) { @@ -390,9 +391,10 @@ plugins.factory('userPlugins', function() { }) ); tweetPlugin.name = 'Tweet'; +*/ return { - plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin] + plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin] }; diff --git a/test/unit/plugins.js b/test/unit/plugins.js index 774e724..0e22980 100644 --- a/test/unit/plugins.js +++ b/test/unit/plugins.js @@ -119,6 +119,7 @@ describe('filter', function() { plugins); })); +/* it('should recognize gists', inject(function(plugins) { expectTheseMessagesToContain([ 'https://gist.github.com/lorenzhs/e8c1a7d56fa170320eb8', @@ -135,6 +136,7 @@ describe('filter', function() { 'Tweet', plugins); })); +*/ }); });