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

codeql
Jeremy Mahieu 5 years ago
commit 7037371248
  1. 11
      js/filters.js
  2. 8
      js/models.js

@ -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 () { weechat.filter('getBufferQuickKeys', function () {
return function (obj, $scope) { return function (obj, $scope) {
if (!$scope) { return obj; } if (!$scope) { return obj; }

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

Loading…
Cancel
Save