diff --git a/index.html b/index.html index 3222cd5..17d51a0 100644 --- a/index.html +++ b/index.html @@ -336,7 +336,7 @@ npm run build-electron-{windows, darwin, linux} <>
+ --> diff --git a/js/filters.js b/js/filters.js index 027acbe..272f61a 100644 --- a/js/filters.js +++ b/js/filters.js @@ -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.