Don't linkify hostnames in join/part messages.

update-travis
Robert Scullin 6 years ago
parent 358a0f7dcd
commit 2b4ca93cf9
  1. 3
      index.html
  2. 11
      js/filters.js

@ -336,7 +336,8 @@ npm run build-electron-{windows, darwin, linux}</pre>
<td class="prefix"><span ng-class="::{'repeated-prefix': bufferline.prefixtext==bufferlines[$index-1].prefixtext}"><a ng-click="addMention(bufferline)"><span class="hidden-bracket" ng-if="::(bufferline.showHiddenBrackets)">&lt;</span><span ng-repeat="part in ::bufferline.prefix" ng-class="::part.classes" ng-bind="::part.text|prefixlimit:25"></span><span class="hidden-bracket" ng-if="::(bufferline.showHiddenBrackets)">&gt;</span></a></span></td><!--
--><td class="message"><!--
--><div ng-repeat="metadata in ::bufferline.metadata" plugin data="::metadata"></div><!--
--><span ng-repeat="part in ::bufferline.content" class="text" ng-class="::part.classes.concat(['line-' + part.$$hashKey.replace(':','_')])" ng-bind-html="::part.text | linky:'_blank':{rel:'noopener noreferrer'} | DOMfilter:'irclinky' | DOMfilter:'emojify':settings.enableJSEmoji | DOMfilter:'inlinecolour' | DOMfilter:'latexmath':('.line-' + part.$$hashKey.replace(':','_')):settings.enableMathjax"></span>
--><span ng-repeat="part in ::bufferline.content" class="text" ng-class="::part.classes.concat(['line-' + part.$$hashKey.replace(':','_')])" ng-bind-html="::part.text | conditionalLinkify:part.classes.includes('cof-chat_host') | DOMfilter:'irclinky' | DOMfilter:'emojify':settings.enableJSEmoji | DOMfilter:'inlinecolour' | DOMfilter:'latexmath':('.line-' + part.$$hashKey.replace(':','_')):settings.enableMathjax"></span>
<!-- <pre>{{bufferline | json}}</pre> -->
</td>
</tr>
<tr class="readmarker" ng-if="activeBuffer().lastSeen==$index">

@ -59,6 +59,17 @@ weechat.filter('inlinecolour', function() {
};
});
// Calls the 'linky' filter unless the disable flag is set. Useful for things like join/quit messages,
// so you don't accidentally click a mailto: on someone's hostmask.
weechat.filter('conditionalLinkify', ['$filter', function($filter) {
return function(text, disable) {
if (!text || disable) {
return text;
}
return $filter('linky')(text, '_blank', {rel:'noopener noreferrer'});
};
}]);
// apply a filter to an HTML string's text nodes, and do so with not exceedingly terrible performance
weechat.filter('DOMfilter', ['$filter', '$sce', function($filter, $sce) {
// To prevent nested anchors, we need to know if a filter is going to create them.

Loading…
Cancel
Save