Use addon to autogenerate mailto-links?Browser Info Environment
Is it possible to edit the add-on to enable the automatic creation of mailto: links, whenever someone writes ie. [email protected]?
Considering that the add-on does see all mail addresses and replace them with something else (in the sourcecode) I'm figuring it would be possible in someway.
Any ideas on how to approach this?
But I would say it's not very easy to do with the current code, I would suggest creating completely another add-on for that purpose.
The reason for why it's not very easy is that currently the add-on searches the email texts with a regular expression and just swaps all the email texts found on the page. To achieve something you want to achieve you'd also need to make sure that the found text is not already inside a link because otherwise you might get double links in your page source which would:
a) break your page source
b) might also break the functionality of those links already existing
c) make your page source syntax invalid.
But of course it's possible if you just write a proper regular expression to make sure the found texts are not already inside links (a-tags).
Also, if you want to use such add-on together with this one, you need to make sure that the other add-on (which creates the mailto-links) is run BEFORE automatic email obfuscator is run. This way your newly created links will get obfuscated as well.
We actually use the regexps from the MIT licensed "Transparent Email Obfuscator" add-on so those are freely available for use. You can also see them straight from here:
The very first regular expression is something you can start with. You'll need to modify it quite a lot but it's something to start with.
Antti / Mainio
Thanks for the quick response. I can see your point, so for now I'll probably skip it, since it's not that important for my usage. Also, I'm hilariously bad at regexps ;-)