Merge pull request #763 from winne42/fix_encoding_error

fix encoding error in chat.js
This commit is contained in:
Jean-Baptiste Onofré 2022-04-18 16:07:23 +02:00 committed by GitHub
commit d4ef7d3ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 19 additions and 19 deletions

View File

@ -133,7 +133,7 @@ var css = {
removeClassFromElement: function(el, classString) { removeClassFromElement: function(el, classString) {
var classArray = this.privateGetClassArray(el); var classArray = this.privateGetClassArray(el);
for (x in classArray) { for (let x in classArray) {
if (classString == classArray[x]) { if (classString == classArray[x]) {
classArray[x] = ''; classArray[x] = '';
break; break;

View File

@ -536,7 +536,7 @@ PlotKit.SVGRenderer.prototype._renderPieAxis = function() {
} }
else { else {
var label = this.createSVGElement("text", svgattrib); var label = this.createSVGElement("text", svgattrib);
label.appendChild(this.document.createTextNode(this.layout.xticks[i][1])) label.appendChild(this.document.createTextNode(this.layout.xticks[i][1]));
this.root.appendChild(label); this.root.appendChild(label);
} }
} }
@ -668,7 +668,7 @@ PlotKit.SVGRenderer.isSupported = function() {
*/ */
if (operaVersion && (operaVersion[1] > 8.9)) if (operaVersion && (operaVersion[1] > 8.9))
return true return true;
if (mozillaVersion && (mozillaVersion > 1.7)) if (mozillaVersion && (mozillaVersion > 1.7))
return true; return true;

View File

@ -20,7 +20,7 @@ try {
} }
} }
catch (e) { catch (e) {
throw "SweetCanvas depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, Canvas}" throw "SweetCanvas depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, Canvas}";
} }

View File

@ -21,7 +21,7 @@ try {
} }
} }
catch (e) { catch (e) {
throw "SweetSVG depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, SVG}" throw "SweetSVG depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, SVG}";
} }

View File

@ -245,7 +245,7 @@ org.activemq.Amq = function() {
// we need to ensure that messages which set headers are sent by themselves. // we need to ensure that messages which set headers are sent by themselves.
// if 2 'listen' messages were sent together, and a 'selector' header were added to one of them, // if 2 'listen' messages were sent together, and a 'selector' header were added to one of them,
// AMQ would add the selector to both 'listen' commands. // AMQ would add the selector to both 'listen' commands.
for(i=0;i<messageQueue.length;i++) { for (let i=0; i < messageQueue.length; i++) {
// a message with headers should always be sent by itself. if other messages have been added, send this one later. // a message with headers should always be sent by itself. if other messages have been added, send this one later.
if ( messageQueue[ i ].headers && messagesToSend.length == 0 ) { if ( messageQueue[ i ].headers && messagesToSend.length == 0 ) {
messagesToSend[ messagesToSend.length ] = messageQueue[ i ].message; messagesToSend[ messagesToSend.length ] = messageQueue[ i ].message;

View File

@ -73,7 +73,7 @@ org.activemq.AmqAdapter = {
if( headers ) { if( headers ) {
request.beforeSend = function(xhr) { request.beforeSend = function(xhr) {
for( h in headers ) { for( let h in headers ) {
xhr.setRequestHeader( h, headers[ h ] ); xhr.setRequestHeader( h, headers[ h ] );
} }
} }

View File

@ -169,8 +169,8 @@ org.activemq.Chat = function() {
chat: function(text) { chat: function(text) {
if (text != null && text.length > 0) { if (text != null && text.length > 0) {
// TODO more encoding? // TODO more encoding?
text = text.replace('<', '&lt;'); text = text.replace(/</g, '&lt;');
text = text.replace('>', '&gt;'); text = text.replace(/>/g, '&gt;');
amq.sendMessage(chatTopic, '<message type="chat" from="' + user + '">' + text + '</message>'); amq.sendMessage(chatTopic, '<message type="chat" from="' + user + '">' + text + '</message>');
} }

View File

@ -62,7 +62,7 @@ $(document).ready(function(){
$('#send_form').submit(function() { $('#send_form').submit(function() {
var text = $('#send_form_input').val(); var text = $('#send_form_input').val();
if (text) { if (text) {
message = new Messaging.Message(text); let message = new Messaging.Message(text);
message.destinationName = destination; message.destinationName = destination;
client.send(message); client.send(message);
$('#send_form_input').val(""); $('#send_form_input').val("");

View File

@ -74,7 +74,7 @@ function fixedDigits(t, digits) {
* Find direct child of an element, by id. * Find direct child of an element, by id.
*/ */
function find(t, id) { function find(t, id) {
for (i = 0; i < t.childNodes.length; i++) { for (let i = 0; i < t.childNodes.length; i++) {
var child = t.childNodes[i] var child = t.childNodes[i]
if (child.id == id) { if (child.id == id) {
return child return child

View File

@ -51,15 +51,15 @@ var Behaviour = {
}, },
apply : function(){ apply : function(){
for (var h=0;sheet=Behaviour.list[h];h++){ for (let h = 0; sheet = Behaviour.list[h]; h++) {
for (selector in sheet){ for (let selector in sheet) {
list = document.getElementsBySelector(selector); let list = document.getElementsBySelector(selector);
if (!list){ if (!list) {
continue; continue;
} }
for (var i=0;element=list[i];i++){ for (let i = 0; element = list[i]; i++) {
sheet[selector](element); sheet[selector](element);
} }
} }
@ -119,7 +119,7 @@ document.getElementsBySelector = function(selector) {
var tokens = selector.split(' '); var tokens = selector.split(' ');
var currentContext = new Array(document); var currentContext = new Array(document);
for (var i = 0; i < tokens.length; i++) { for (var i = 0; i < tokens.length; i++) {
token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');; let token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');
if (token.indexOf('#') > -1) { if (token.indexOf('#') > -1) {
// Token is an ID selector // Token is an ID selector
var bits = token.split('#'); var bits = token.split('#');

View File

@ -16,7 +16,7 @@
--> -->
<!-- <!--
Lets deploy some Enterprise Integration Patterns inside the ActiveMQ Message Broker Let's deploy some Enterprise Integration Patterns inside the ActiveMQ Message Broker
For more information, see: For more information, see:
http://camel.apache.org http://camel.apache.org

View File

@ -181,7 +181,7 @@ $(document).ready(function(){
$('#send_form').submit(function() { $('#send_form').submit(function() {
var text = $('#send_form_input').val(); var text = $('#send_form_input').val();
if (text) { if (text) {
message = new Messaging.Message(text); let message = new Messaging.Message(text);
message.destinationName = destination; message.destinationName = destination;
client.send(message); client.send(message);
$('#send_form_input').val(""); $('#send_form_input').val("");