The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Chat box: problems with HTML!

4 posters

Go down

Solved Chat box: problems with HTML!

Post by JScript Tue 12 May - 20:10

Hello everybody!

I posted the following message in the chat:
Tag code test: [ code]if (_userdata.session_logged_in) { console.log('Ok!') };[/ code]

And the result is in the picture below:
222222 - Chat box: problems with HTML! 36ZvsZm

Note that the HTML of BBCode is outside of the block <span style = "color: #222222"> </ span>

I noticed this problem on various forums, not only on my forum, this also happens with a test forum that I have without any JavaScript added!

The correct way should look like this:
222222 - Chat box: problems with HTML! ZaSZVOj

For reference, here's the JSON returned in the message:
Code:

<span style="color: #222222">Tag code test:
    <dl class="codebox contcode">
        <dt>Code:</dt>
        <dd>
            <code>if (_userdata.session_logged_in) { console.log(&apos;Ok!&apos;) }</code>
        </dd>
    </dl>
</span>
222222 - Chat box: problems with HTML! BStInH3

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

View user profile http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Van-Helsing Wed 13 May - 6:38

Hello @JScript,
Is there a new change which must we do in code?
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

View user profile http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript Wed 13 May - 10:51

@Black-Shadow"
What? I think you misunderstand the topic! This problem is in chatbox8.js code, not mine!


@Buttercup and/or @The Godfather
The reason of the problem lies in the use of tag <p> that only defines paragraphs!
Not accepting certain tags within it, only the <div> tag that represents a container is that behave any other tag in it!

In this case, the following code snippet in chatbox8.js:
Code:

            for (var j = 0; j < this.messages.length; j++) {
               var message = this.messages[j];
               var html = '<p class=\'chatbox_row_' + (j % 2 == 1 ? 2 : 1) + ' clearfix\'>' + '<span class=\'date-and-time\' title=\'' + message.date + '\'>[' + message.datetime + ']</span>';
               if (message.userId == -10) {
                  html += '<span class=\'msg\'>' + '<span style=\'color:' + message.msgColor + '\'>' + '<strong> ' + message.msg + '</strong>' + '</span>' + '</span>'
               } else {
                  html += '<span class=\'user-msg\'>';
                  if (this.avatar) {
                     html += '\t<span class=\'cb-avatar\'><img src=\'' + message.user.avatar + '\' /></span>'
                  }
                  html += '\t<span class=\'user\' style=\'color:' + message.user.color + '\'>' + '<strong> ' + (message.user.admin ? '@ ' : '') + '<span class=\'chatbox-username chatbox-message-username\'  data-user=\'' + message.userId + '\' >' + message.username + '</span>&nbsp;:&nbsp;' + '</strong>' + '</span>' + '<span class=\'msg\'>' + message.msg + '</span>' + '</span>'
               }
               html += '</p>';
               content += html
            }

It should look like this:
Code:

            for (var j = 0; j < this.messages.length; j++) {
               var message = this.messages[j];
               var html = '<div class=\'chatbox_row_' + (j % 2 == 1 ? 2 : 1) + ' clearfix\'>' + '<span class=\'date-and-time\' title=\'' + message.date + '\'>[' + message.datetime + ']</span>';
               if (message.userId == -10) {
                  html += '<span class=\'msg\'>' + '<span style=\'color:' + message.msgColor + '\'>' + '<strong> ' + message.msg + '</strong>' + '</span>' + '</span>'
               } else {
                  html += '<span class=\'user-msg\'>';
                  if (this.avatar) {
                     html += '\t<span class=\'cb-avatar\'><img src=\'' + message.user.avatar + '\' /></span>'
                  }
                  html += '\t<span class=\'user\' style=\'color:' + message.user.color + '\'>' + '<strong> ' + (message.user.admin ? '@ ' : '') + '<span class=\'chatbox-username chatbox-message-username\'  data-user=\'' + message.userId + '\' >' + message.username + '</span>&nbsp;:&nbsp;' + '</strong>' + '</span>' + '<span class=\'msg\'>' + message.msg + '</span>' + '</span>'
               }
               html += '</div>';
               content += html
            }
With the <div> tag instead of <p>

Result:
222222 - Chat box: problems with HTML! 7gOndzt

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

View user profile http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Ace 1 Wed 13 May - 10:55

I don't see a difference in the code...

Nvm why use div?


Last edited by Ace 1 on Mon 18 May - 10:30; edited 2 times in total
Ace 1
Ace 1
Helper
Helper

Male Posts : 843
Reputation : 64
Language : English - French?
Location : Druid Hill Park

View user profile https://help.forumotion.com

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript Wed 13 May - 11:17

Ace 1 wrote:I don't see a difference in the code...
Once again: What?
I regret that you can not see the difference...


Please only respond this topic who really can solve it, okay?
It does not help that did not get answer, or do not see any difference, as this will only slow the progress of the solution.


Possible solution of the problem: https://help.forumotion.com/t140648-chat-box-problems-with-html#956674

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

View user profile http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Van-Helsing Wed 13 May - 13:53

Ok @JScript,
Sorry for misunderstood.

Best Regards,
Black-Shadow.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

View user profile http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript Mon 18 May - 8:00

Someone?


JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

View user profile http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow Mon 18 May - 10:20

Hello

The problem has been reported to our technicians. Thanks :rose:
Shadow
Shadow
Administrator
Administrator

Male Posts : 16209
Reputation : 1825
Language : French, English

View user profile

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript Tue 26 May - 7:45

@Buttercup
Thank you!

Apparently we do not have any answers on the subject?

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

View user profile http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow Tue 26 May - 7:46

Hello

I just sent a new email to our technicians Wink I'll let you know Smile

EDIT: Our technicians are currently studying your proposal. They told me you are true but they are not sure they can do it without impacting forums that modify their CSS and templates.

I'll let you know when I have more info Smile
Shadow
Shadow
Administrator
Administrator

Male Posts : 16209
Reputation : 1825
Language : French, English

View user profile

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript Thu 28 May - 6:07

Buttercup wrote:(...)
EDIT: Our technicians are currently studying your proposal. They told me you are true but they are not sure they can do it without impacting forums that modify their CSS and templates.(...)
Okay, I had already noticed this problem with CSS, but if we look at the default values of each version, we can see that the change is minimal:

Spoiler:

Basically just replace the p by div...

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

View user profile http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow Fri 29 May - 4:10

Hello Script

I got technicians answer. After studying your proposal they told me you are true. But making this change would create additional problems for all forums with CSS and personalize JS and HTML pages.

The chatbox is very touchy, so we won't take the risk of creating some bugs. However, you're true and our technicians are thankful for your remark Smile

Thanks
Shadow
Shadow
Administrator
Administrator

Male Posts : 16209
Reputation : 1825
Language : French, English

View user profile

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript Fri 29 May - 5:18

@Buttercup
Ok, no problem, so I can publish a JavaScript that corrects this problem for those who wish?
My code corrects the CSS to suit div tag!

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

View user profile http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow Fri 29 May - 5:20

Yes you can publish it and even create a short tutorial that we cannot display on our tutorial section Wink (of course if you've enough time Smile )

Thanks for your help Very Happy
Shadow
Shadow
Administrator
Administrator

Male Posts : 16209
Reputation : 1825
Language : French, English

View user profile

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum