Strip HTML tags from chat messages

This commit is contained in:
Pauli Jokela
2017-02-20 13:35:52 +02:00
parent 26e8ce7cfd
commit 20611e26f8
+9
View File
@@ -20,6 +20,7 @@ function ChatController( $scope, rconService, $timeout )
$scope.OnMessage = function( msg )
{
msg.Message = stripHtml(msg.Message);
$scope.Output.push( msg );
if($scope.isOnBottom()) {
@@ -77,3 +78,11 @@ function ChatController( $scope, rconService, $timeout )
rconService.InstallService( $scope, $scope.GetHistory )
}
function stripHtml(html)
{
if (html == null) return "";
var tmp = document.createElement("div");
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || "";
}