Skip to content

Commit

Permalink
escapehtml function implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
princekhunt committed Mar 12, 2024
1 parent 7e6c333 commit 7106a07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 6 additions & 5 deletions assets/js/chat/Base.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
function escapeHtml(text) {
return text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
}

function getUserName(){
//check if current page is waiting room without function
if (window.location.href.indexOf("waiting-room") > -1) {
name = 'user';
name = escapeHtml(name);
name = name.replace(/\[/g, '\\[').replace(/\]/g, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
Expand Down Expand Up @@ -139,8 +144,4 @@ $(document).ready(function() {
}
});
})
});

function escapeHtml(text) {
return text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
});
5 changes: 5 additions & 0 deletions assets/js/chat/waiting_room.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
function escapeHtml(text) {
return text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
}

$(document).ready(function(){
function getUrlParameter(name) {
name = escapeHtml(name);
name = name.replace(/\[/g, '\\[').replace(/\]/g, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
Expand Down

0 comments on commit 7106a07

Please # to comment.