I have decided to improve on it a little by adding in things that my message logger does (server-side) to turn things like:
Expand|Select|Wrap|Line Numbers
- http://www.example.com
Expand|Select|Wrap|Line Numbers
- http://example.com
Expand|Select|Wrap|Line Numbers
- <a href="http://www.example.com" target="_blank">www.example.com</a>
Expand|Select|Wrap|Line Numbers
- www.example.com
I checked and double-checked the message log, and it is properly parsing the text to include valid HTML. The problem occurs when I receive the text on the client. It iterates through all the child elements of the <content> element of each <message> element, and appends them to a <span> element inside a <p> element that it will be appended to the chat history. It seems to be properly attaching the <a> element including the text inside, but it is not clickable, as if I passed it without the href attribute. Anyone have any insight to this?
Library file: http://preview.moltx.name/chat_v2/library.js
EDIT: The place in which I am attaching all the elements of the message occur between lines 264 and 274.
If you wish to test the script, just enter a username, and create a room, then enter any URL into the script at:
http://preview.moltx.name/chat_v2/
Also, inspecting the elements using Firebug in Firefox reveals that the href is there, but unless I delete and re-add the element manually, it does not act like a link completely (but it stands out like one).