Merge Tor's work on HTML escaping

Refs: #77
This commit is contained in:
Vivien Didelot 2013-10-28 10:19:19 -04:00
commit d75b420e4d
3 changed files with 6 additions and 14 deletions

View File

@ -254,7 +254,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
</td>
<td class="prefix"><span ng-repeat="part in bufferline.prefix" ng-class="{{ part.classes }}">{{ part.text }}</span></td>
<td class="message">
<span ng-repeat="part in bufferline.content" class="text" ng-class="{{ part.classes }}" ng-bind-html="part.text"></span>
<span ng-repeat="part in bufferline.content" class="text" ng-class="{{ part.classes }}" ng-bind-html="part.text|linky:'_blank'"></span>
<div ng-repeat="metadata in bufferline.metadata">
<div ng-show="metadata.visible">

View File

@ -80,19 +80,6 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) {
}
}
/* Replace all URLs with hyperlinks */
var urlRegexp = RegExp(/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&amp;:\/~+#-]*[\w@?^=%&amp;\/~+#-])?/g);
for(k in message.content) {
var text = message.content[k].text;
var url = text.match(urlRegexp);
for(i in url) {
var u = url[i];
text = text.replace(u, '<a target="_blank" href="' + u + '">' + u + '</a>');
}
message.content[k].text = $sce.trustAsHtml(text);
}
return message;
}

View File

@ -667,6 +667,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}
}
// Prevent user from accidentally leaving the page
window.onbeforeunload = function(event) {
event.preventDefault();
};
}]
);