Fix links and embeds

Disable semi-broken plugins
cordova-0.4.8
Lorenz Hübschle-Schneider 11 years ago
parent 4100a37b04
commit c84e90d381
  1. 4
      index.html
  2. 9
      js/filters.js
  3. 4
      js/plugins.js
  4. 2
      test/unit/plugins.js

@ -188,7 +188,7 @@
<button ng-if="debugMode" ng-click="countWatchers()">Count<br />Watchers</button> <button ng-if="debugMode" ng-click="countWatchers()">Count<br />Watchers</button>
</div> </div>
<div class="title" title="{{activeBuffer().rtitle}}"> <div class="title" title="{{activeBuffer().rtitle}}">
<span ng-repeat="part in activeBuffer().title" ng-class="::part.classes" ng-bind-html="::(part.text | linky:'_blank' | DOMfilter:'irclinky')"></span> <span ng-repeat="part in activeBuffer().title" ng-class="::part.classes" ng-bind-html="::(part.text | linky:'_system' | linksForCordova | DOMfilter:'irclinky')"></span>
</div> </div>
<div class="actions pull-right vertical-line-left"> <div class="actions pull-right vertical-line-left">
<div class="pull-left"> <div class="pull-left">
@ -244,7 +244,7 @@
<td class="prefix"><a ng-click="addMention(bufferline.prefix)"><span ng-repeat="part in ::bufferline.prefix" ng-class="::part.classes" ng-bind="::part.text"></span></a></td><!-- <td class="prefix"><a ng-click="addMention(bufferline.prefix)"><span ng-repeat="part in ::bufferline.prefix" ng-class="::part.classes" ng-bind="::part.text"></span></a></td><!--
--><td class="message"><!-- --><td class="message"><!--
--><div ng-repeat="metadata in ::bufferline.metadata" plugin data="::metadata"></div><!-- --><div ng-repeat="metadata in ::bufferline.metadata" plugin data="::metadata"></div><!--
--><span ng-repeat="part in ::bufferline.content" class="text" ng-class="::part.classes" ng-bind-html="::part.text | linky:'_blank' | DOMfilter:'irclinky' | DOMfilter:'inlinecolour' "></span> --><span ng-repeat="part in ::bufferline.content" class="text" ng-class="::part.classes" ng-bind-html="::part.text | linky:'_system' | linksForCordova | DOMfilter:'irclinky' | DOMfilter:'inlinecolour' "></span>
</td> </td>
</tr> </tr>
<tr class="readmarker" ng-if="activeBuffer().lastSeen==$index"> <tr class="readmarker" ng-if="activeBuffer().lastSeen==$index">

@ -117,6 +117,15 @@ weechat.filter('DOMfilter', ['$filter', '$sce', function($filter, $sce) {
}; };
}]); }]);
weechat.filter('linksForCordova', ['$sce', function($sce) {
return function (text) {
// Cordova: need to use window.open instead of href
// XXX TODO this needs to be improved
text = text.replace(/<a (?:target="_[a-z]+"\s)?href="([^"]+)"/gi, "<a onClick=\"window.open('$1', '_system')\"");
return $sce.trustAsHtml(text);
};
}]);
weechat.filter('getBufferQuickKeys', function () { weechat.filter('getBufferQuickKeys', function () {
return function (obj, $scope) { return function (obj, $scope) {
if (!$scope) { return obj; } if (!$scope) { return obj; }

@ -331,6 +331,7 @@ plugins.factory('userPlugins', function() {
} }
}); });
/*
// Embed GitHub gists // Embed GitHub gists
var gistPlugin = new UrlPlugin('Gist', function(url) { var gistPlugin = new UrlPlugin('Gist', function(url) {
var regexp = /^https:\/\/gist\.github.com\/[^.?]+/i; var regexp = /^https:\/\/gist\.github.com\/[^.?]+/i;
@ -377,6 +378,7 @@ plugins.factory('userPlugins', function() {
}; };
} }
}); });
*/
/* /*
* Vine plugin * Vine plugin
@ -391,7 +393,7 @@ plugins.factory('userPlugins', function() {
}); });
return { return {
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin, vinePlugin] plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, vinePlugin]
}; };

@ -130,6 +130,7 @@ describe('filter', function() {
plugins); plugins);
})); }));
/*
it('should recognize gists', inject(function(plugins) { it('should recognize gists', inject(function(plugins) {
expectTheseMessagesToContain([ expectTheseMessagesToContain([
'https://gist.github.com/lorenzhs/e8c1a7d56fa170320eb8', 'https://gist.github.com/lorenzhs/e8c1a7d56fa170320eb8',
@ -146,6 +147,7 @@ describe('filter', function() {
'Tweet', 'Tweet',
plugins); plugins);
})); }));
*/
it('should recognize vines', inject(function(plugins) { it('should recognize vines', inject(function(plugins) {
expectTheseMessagesToContain([ expectTheseMessagesToContain([

Loading…
Cancel
Save