Compare commits
13 Commits
543885a30e
...
9d0836c2e7
Author | SHA1 | Date |
---|---|---|
Lorenz Hübschle-Schneider | 9d0836c2e7 | |
Lorenz Hübschle-Schneider | 6ac2e5b4c2 | |
Tor Hveem | 52b1aa0228 | |
Tor Hveem | 23833dbab0 | |
Lorenz Hübschle | f39fe804b1 | |
Lorenz Hübschle | 44ca6491b8 | |
Lorenz Hübschle | e07cfd1806 | |
Lorenz Hübschle | c0e8810de8 | |
Andrius Bentkus | bfa893fde9 | |
Andrius Bentkus | af2d12134d | |
dependabot[bot] | 1a392f2801 | |
dependabot[bot] | f0c95444f6 | |
dependabot[bot] | 731c9b4fdd |
File diff suppressed because it is too large
Load Diff
|
@ -68,30 +68,20 @@ weechat.filter('conditionalLinkify', ['$filter', function($filter) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return linkifyStr(text, {
|
||||||
return text.replaceAll(/\S+/g, function (match, p2) {
|
className: '',
|
||||||
const result = linkifyStr(match, {
|
attributes: {
|
||||||
className: '',
|
rel: 'noopener noreferrer'
|
||||||
attributes: {
|
},
|
||||||
rel: 'noopener noreferrer'
|
target: {
|
||||||
},
|
url: '_blank'
|
||||||
target: {
|
},
|
||||||
url: '_blank'
|
validate: {
|
||||||
},
|
email: function () {
|
||||||
validate: {
|
return false; //Do not linkify emails
|
||||||
email: function () {
|
|
||||||
return false; //Do not linkify emails
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (result.endsWith("</a>")) {
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
return match
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
export const sortBy = (key) => {
|
export const sortBy = (key) => {
|
||||||
return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
|
return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
|
||||||
}
|
};
|
||||||
|
|
|
@ -30,14 +30,6 @@ describe('Filters', function() {
|
||||||
result = $filter('conditionalLinkify')(url);
|
result = $filter('conditionalLinkify')(url);
|
||||||
expect(result).toEqual(link);
|
expect(result).toEqual(link);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('convert the entire words to links', angular.mock.inject(function($filter) {
|
|
||||||
var text = 'weechat.network.connection_timeout',
|
|
||||||
link = 'weechat.network.connection_timeout',
|
|
||||||
result = $filter('conditionalLinkify')(text);
|
|
||||||
expect(result).toEqual(link);
|
|
||||||
}));
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('irclinky', function() {
|
describe('irclinky', function() {
|
||||||
|
|
Loading…
Reference in New Issue