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 May 13th 2015, 3:10 am

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:
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:
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>
Chat box: problems with HTML! BStInH3

JS
JScript
JScript
Forumember

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

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Van-Helsing May 13th 2015, 1:38 pm

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

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript May 13th 2015, 5:51 pm

@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:
Chat box: problems with HTML! 7gOndzt

JS
JScript
JScript
Forumember

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

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Ace 1 May 13th 2015, 5:55 pm

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

Nvm why use div?


Last edited by Ace 1 on May 18th 2015, 5:30 pm; edited 2 times in total
Ace 1
Ace 1
Helper
Helper

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

https://help.forumotion.com

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript May 13th 2015, 6:17 pm

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

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Van-Helsing May 13th 2015, 8:53 pm

Ok @JScript,
Sorry for misunderstood.

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

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

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript May 18th 2015, 3:00 pm

Someone?


JS
JScript
JScript
Forumember

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

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow May 18th 2015, 5:20 pm

Hello

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

Male Posts : 16217
Reputation : 1831
Language : French, English

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript May 26th 2015, 2:45 pm

@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

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow May 26th 2015, 2:46 pm

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
Manager
Manager

Male Posts : 16217
Reputation : 1831
Language : French, English

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript May 28th 2015, 1:07 pm

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

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow May 29th 2015, 11:10 am

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
Manager
Manager

Male Posts : 16217
Reputation : 1831
Language : French, English

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by JScript May 29th 2015, 12:18 pm

@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

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Chat box: problems with HTML!

Post by Shadow May 29th 2015, 12:20 pm

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
Manager
Manager

Male Posts : 16217
Reputation : 1831
Language : French, English

Back to top Go down

Back to top

- Similar topics

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