summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/local.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/js/local.js b/js/local.js
index ad3e924..0973071 100644
--- a/js/local.js
+++ b/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);
+ }
}
}