IDN Mail fix...
Friday, April 8, 2011 8:00:05 AM
The IDNMailFix extension changes forms which use HTML5's
input type="email" to incorporate email addresses, replacing the type with a pattern, which will accept anything with an '@' in the middle.
This is not a particularly robust hack - better would be to convert the address to punycode - but it does allow for some testing of IDNs in email forms. You can test it out...
I don't know if I will work on it much more even if it gets accepted. I haven't set up a source repository, but the magic is in the includes script which is as follows:
window.addEventListener('DOMContentLoaded', function() {
var emailFields = document.querySelectorAll('input[type=email]');
for (i in emailFields) {
if (i == 'length' || i == 'item') continue;
emailFields[i].addEventListener('focus',
function() {
this.style.setProperty('background',"url('data:image/png;
base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAAzElEQVR42q
2TixHDIAiG2Ymd2Imd2IkKVkJQ2ty13nkaHl9Af0E/DABWQI4VhfvYoxEsiSLRIDZI
pt38W041WDItAJzXHLPGDWQBNcn3uO9n1cmuImb9eYIifg16MuFkFEDNox4uIvUgd9
bqWCYozki06yBASyteTQqg8b20VH0IdAClm6mlOyBVcmt9a821QW/fgErTBmL81K+/
gtzBU2iofGzV9kv1U+UdKAsSKVXfCZLOoAm73tIF3Z9KqDpA/xCknVt7qE+n5Q7GC7
334aFWeaeVAAAAAElFTkSuQmCC') bottom right no-repeat",'important');
this.removeAttribute('type');
this.setAttribute('pattern','.*@.*');
},false);
}
},false);
(Note that you will need to re-concatenate the lines of the data URL to make it behave - I just split them to render mor or less usefully).
It adds an image to the right-hand side of fields that have been changed, and it changes any relevant field when you enter. Feel free to do anything you want with the code - it isn't exactly magic...


Nabih Saidhandsomestorm # Tuesday, December 27, 2011 9:13:54 PM