summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas NOEL <tnoel@entrouvert.com>2013-11-22 09:16:20 (GMT)
committerThomas NOEL <tnoel@entrouvert.com>2013-11-22 09:16:20 (GMT)
commit336af6fd746ba46db980ba119f45cec47c1b9e28 (patch)
treee0910487f0e1bcec617d11403f27506622d8d5b2
parent21db9e286644f2fbfff4acf89a796d34df35d360 (diff)
downloadorleans-themes-wcs-336af6fd746ba46db980ba119f45cec47c1b9e28.zip
orleans-themes-wcs-336af6fd746ba46db980ba119f45cec47c1b9e28.tar.gz
orleans-themes-wcs-336af6fd746ba46db980ba119f45cec47c1b9e28.tar.bz2
with IE, with love, AGAAAINNNN
-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);
+ }
}
}