Merge pull request #15 from Dids/gh-pages

Strip HTML tags from chat messages
This commit is contained in:
Garry Newman
2017-02-20 11:44:23 +00:00
committed by GitHub
+9
View File
@@ -20,6 +20,7 @@ function ChatController( $scope, rconService, $timeout )
$scope.OnMessage = function( msg ) $scope.OnMessage = function( msg )
{ {
msg.Message = stripHtml(msg.Message);
$scope.Output.push( msg ); $scope.Output.push( msg );
if($scope.isOnBottom()) { if($scope.isOnBottom()) {
@@ -76,4 +77,12 @@ function ChatController( $scope, rconService, $timeout )
} }
rconService.InstallService( $scope, $scope.GetHistory ) 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 || "";
} }