Fix bad js replace in demos / test

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2022-10-05 09:13:57 -05:00
parent ecea0e6d0a
commit d3050dee7b
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
4 changed files with 8 additions and 8 deletions

View File

@ -32,8 +32,8 @@
}
function send(user, message, handler, join)
{
if (message) message = message.replace('%', '%25').replace('&', '%26').replace('=', '%3D');
if (user) user = user.replace('%', '%25').replace('&', '%26').replace('=', '%3D');
if (message) message = message.replaceAll('%', '%25').replaceAll('&', '%26').replaceAll('=', '%3D');
if (user) user = user.replaceAll('%', '%25').replaceAll('&', '%26').replaceAll('=', '%3D');
var requestBody = 'user=' + user + (message ? '&message=' + message : '') + (join ? '&join=true' : '');
xhr('POST', 'chat', requestBody , handler);
}

View File

@ -44,8 +44,8 @@
_onmessage: function(m) {
if (m.data){
var c=m.data.indexOf(':');
var from=m.data.substring(0,c).replace('<','&lt;').replace('>','&gt;');
var text=m.data.substring(c+1).replace('<','&lt;').replace('>','&gt;');
var from=m.data.substring(0,c).replaceAll('<','&lt;').replaceAll('>','&gt;');
var text=m.data.substring(c+1).replaceAll('<','&lt;').replaceAll('>','&gt;');
var chat=$('chat');
var spanFrom = document.createElement('span');

View File

@ -44,8 +44,8 @@
_onmessage: function(m) {
if (m.data){
var c=m.data.indexOf(':');
var from=m.data.substring(0,c).replace('<','&lt;').replace('>','&gt;');
var text=m.data.substring(c+1).replace('<','&lt;').replace('>','&gt;');
var from=m.data.substring(0,c).replaceAll('<','&lt;').replaceAll('>','&gt;');
var text=m.data.substring(c+1).replaceAll('<','&lt;').replaceAll('>','&gt;');
var chat=$('chat');
var spanFrom = document.createElement('span');

View File

@ -52,8 +52,8 @@
_onmessage: function (m) {
if (m.data) {
var c = m.data.indexOf(':');
var from = m.data.substring(0, c).replace('<', '&lt;').replace('>', '&gt;');
var text = m.data.substring(c + 1).replace('<', '&lt;').replace('>', '&gt;');
var from = m.data.substring(0, c).replaceAll('<', '&lt;').replaceAll('>', '&gt;');
var text = m.data.substring(c + 1).replaceAll('<', '&lt;').replaceAll('>', '&gt;');
var chat = $('chat');
var spanFrom = document.createElement('span');