miércoles, 22 de junio de 2011

Mejoras en el mapa de los .tel

Ok I've made a bunch of changes that I'm now testing. Of course it turned out tougher than expected, what with the IDN stuff and hardening of the codebase.
I believe I've solved the IDN problem with 长滩岛.tel for example, but it's a tricky unicode thing so I suspect some of you will find some weird use cases that I'll have to look into.

Anyway, I also added a little gift... the ability to pass in a template for the info window so you won't bother me with wanting to put the image on the left or add a tag on the right or make the background pink...
Once the thing is live (it's still being tested) you'll be able to pass in the info template with the parameter 'info='.
It is tricky though. The format is actually a javascript snippet, with the default being:

'<div><span style="float: left; margin-right: 10px;">' + r['logo'] + '</span><span>' + r['dds'] + '<br /><a href="http://' + domain + '" target="_blank">' + idndomain + '</a><br /><br />' + r['firstnaptr'] + '</span></div>'
If you want to change it, note that this is a javascript string concatenation. It's pretty clear what the params are:
domain : the punycode domain
idndomain : the unicode IDN domain (what you want to show to users)
r : the result from the domain lookup, which has 'logo', 'dds' and 'firstnaptr', respectively the logo image, the title of your domain (dds), and the first naptr. All of those are actual html snippets.

If you want to pass in the 'info=' parameter using GET, you'd better escape the whole thing. And don't forget to put single quotes at start and finish, like the example above.
If you use POST, you're good to go.

Note that you can completely screw up the page if you pass in a broken javascript string, as it'll break the whole javascript code on the page. You've been warned. None of us at Telnic will waste time debugging your code. Use at your own risk. Etc.. etc...

No hay comentarios:

Publicar un comentario