with IE, with love, AGAAAINNNN
parent
21db9e2866
commit
336af6fd74
23
js/local.js
23
js/local.js
|
@ -1,3 +1,11 @@
|
|||
/* IE8 */
|
||||
if(!document.getElementsByClassName) {
|
||||
document.getElementsByClassName = function(className) {
|
||||
return this.querySelectorAll("." + className);
|
||||
};
|
||||
Element.prototype.getElementsByClassName = document.getElementsByClassName;
|
||||
}
|
||||
|
||||
/* dirty hack pour éviter le double-clic sur un submit */
|
||||
|
||||
var submit_buttons = document.getElementsByClassName('submit-button')[0];
|
||||
|
@ -14,7 +22,20 @@ if (submit_buttons) {
|
|||
var wcs_passwords = document.getElementsByClassName('wcs-password');
|
||||
if (wcs_passwords) {
|
||||
for(var i=0; i<wcs_passwords.length; i++) {
|
||||
wcs_passwords[i].getElementsByTagName('input')[0].type = 'password';
|
||||
input = wcs_passwords[i].getElementsByTagName('input')[0];
|
||||
try {
|
||||
input.type = 'password';
|
||||
} catch (e) { /* IE => on remplace le input complet */
|
||||
var inp = document.createElement('input');
|
||||
inp.type='password';
|
||||
var attributes = ['id', 'name', 'size'];
|
||||
for(i=0;i<attributes.length;i++){
|
||||
inp[attributes[i]] = input[attributes[i]];
|
||||
}
|
||||
var par = input.parentNode;
|
||||
par.insertBefore(inp,input);
|
||||
par.removeChild(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue