Merge branch 'master' of https://github.com/glowing-bear/glowing-bear into FixLinky2

This commit is contained in:
Jeremy Mahieu 2020-07-21 16:03:02 +02:00
commit 7037371248
2 changed files with 6 additions and 13 deletions

View File

@ -160,17 +160,6 @@ weechat.filter('DOMfilter', ['$filter', '$sce', function($filter, $sce) {
};
}]);
// This is used by the cordova app to change link targets to "window.open(<url>, '_system')"
// so that they're opened in a browser window and don't navigate away from Glowing Bear
weechat.filter('linksForCordova', ['$sce', function($sce) {
return function(text) {
// XXX TODO this needs to be improved
text = text.replace(/<a (rel="[a-z ]+"\s+)?(?:target="_[a-z]+"\s+)?href="([^"]+)"/gi,
"<a $1 onClick=\"window.open('$2', '_system')\"");
return $sce.trustAsHtml(text);
};
}]);
weechat.filter('getBufferQuickKeys', function () {
return function (obj, $scope) {
if (!$scope) { return obj; }

View File

@ -18,6 +18,10 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
this.outgoingQueries = [];
var parseRichText = function(text) {
if(!text) {
return [{'text': text}];
}
var textElements = weeChat.Protocol.rawText2Rich(text),
typeToClassPrefixFg = {
'option': 'cof-',
@ -64,8 +68,8 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
*/
this.Buffer = function(message) {
// weechat properties
var fullName = message.full_name;
var shortName = message.short_name;
var fullName = parseRichText(message.full_name)[0].text;
var shortName = parseRichText(message.short_name)[0].text;
var hidden = message.hidden;
// If it's a channel, trim away the prefix (#, &, or +). If that is empty and the buffer
// has a short name, use a space (because the prefix will be displayed separately, and we don't want