]> git.mjollnir.org Git - moodle.git/commitdiff
Follow up for MDL-12256, "Course AJAX has very poor accessibility - ALT text" - IE...
authornfreear <nfreear>
Tue, 20 Nov 2007 14:37:58 +0000 (14:37 +0000)
committernfreear <nfreear>
Tue, 20 Nov 2007 14:37:58 +0000 (14:37 +0000)
lib/ajax/ajaxcourse.js
lib/ajax/section_classes.js

index 8b6c55e45bfdef1d83b106b4aa0ecd200929e982..da903b03b5760d4ea52fc8075acd02f9c59763b6 100644 (file)
@@ -161,7 +161,11 @@ main_class.prototype.mk_button = function(tag, imgSrc, text, attributes, imgAttr
 
     if (attributes != null) {
         for (var c=0; c<attributes.length; c++) {
-            container.setAttribute(attributes[c][0], attributes[c][1]);
+            if (attributes[c][0] == 'title' && this.is_ie()) {
+                image.setAttribute(attributes[c][0], attributes[c][1]); //IE hack: transfer 'title'.
+            } else {
+                container.setAttribute(attributes[c][0], attributes[c][1]);
+            }
         }
     }
     if (imgAttributes != null) {
@@ -233,6 +237,14 @@ main_class.prototype.getString = function(identifier, variable) {
     }
 }
 
+main_class.prototype.is_ie = function() {
+    var agent = navigator.userAgent.toLowerCase();
+    if ((agent.indexOf('msie') != -1)) {
+        return true;
+    }
+    return false;
+}
+
 
 var main = new main_class();
 
index 9c3cd5ef92c49095c4c893f71b3a7812ba566dda..24c9ca2d1c100f1671791c5841eaa6a406647823 100755 (executable)
@@ -291,6 +291,7 @@ section_class.prototype.toggle_hide = function(e,target,superficial) {
         YAHOO.util.Dom.removeClass(this.getEl(), 'hidden');
         this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
         this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strshow, strhide);
+        this.viewButton.childNodes[0].title = this.viewButton.childNodes[0].title.replace(strshow, strhide); //IE hack.
         this.viewButton.title = this.viewButton.title.replace(strshow, strhide);
         this.hidden = false;
 
@@ -306,6 +307,7 @@ section_class.prototype.toggle_hide = function(e,target,superficial) {
         YAHOO.util.Dom.addClass(this.getEl(), 'hidden');
         this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
         this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strhide, strshow);
+        this.viewButton.childNodes[0].title = this.viewButton.childNodes[0].title.replace(strhide, strshow); //IE hack.
         this.viewButton.title = this.viewButton.title.replace(strhide, strshow);
         this.hidden = true;