Trackmania Color Parser in Javascript

Trackmania Color Parser in Javascript is a port of the original TMFColorParser written in PHP by fuckfish, a programmer who contributed a lot of stuff to the Trackmania community in general.

It converts (or translates) strings including Trackmania codes like this ones into valid HTML code, so stylized phrases from Trackmania can be displayed on websites. This could be very useful for web statistics, for example.

Why I've made a JS port? I developed in several web projects with Trackmania, working with Trackmania content directly (web statistics for events, user profiles imported into own user databases etc.) and I always struggled with the fact that every conversion from text with TM codes into HTML were made server-side. If we've so modern computers, why we can't do that on the client side?

The library is nearly equivalent to the PHP version, even the code is nearly the same, just converted to JS. That's why you can use the known functions, just in JS. But I haven't implemented everything from the old PHP library. If you want more features, just ask me or modify the code by yourself and then make a pull request on Github. Thanks!

Examples (wait 5 seconds, real JS :D)

Automatic shadowing:

$7d0H$fffunt$7d0M$fffania$7d0¬$fffJonni$i$07D

Comparison without shadowing:

$7d0H$fffunt$7d0M$fffania$7d0¬$fffJonni$i$07D

Link & manialink parsing:

$l[http://huntmania.net]HuntMania.net$l$i - the Trackmania event forge!

Try it on your own
...
The text updates only if you click somewhere else on the page, to unfocus the input field.