[Building Sakai] Question over headscripts.js and getting access to jQuery in each Sakai CLE tool

Richwine, Brian L brichwin at indiana.edu
Tue Aug 16 09:18:42 PDT 2011


Hi,

I'm attempting to find a way to get a couple jQuery routines to run in each tool after they have rendered that will automatically address two commonly occurring critical accessibility issues: select elements with onchange event handlers that change page context (SAK-11199) and implicitly labeled form controls (technique not well supported by adaptive technologies) (SAK-21031).

One way to do this would be to place the two jQuery routines in headscripts.js and set them to run once the tool's iframe has loaded. Unfortunately, not every tool loads jQuery. The setMainFrameHeight function in headscripts.js calls jQuerySetup in an attempt to load jQuery (/library/js/jquery.js) for each tool where jQuery isn't already loaded; however, it does not attempt to load jQuery when the browser is IE.

My question is: What is the best way to get jQuery loaded in each tool's iFrame?

1.       I tried various attempts at routines to dynamically load jQuery from headscripts.js when the browser is IE and am mystified why it won't load in the Sakai CLE environment.

2.       I'm assuming it would be a bad idea to add a script tag to load jQuery in the setupForward function in portal-tool/tool/src/java/org/sakaiproject/portal/tool/ToolPortal.java and portal-tool/tool/src/java/org/sakaiproject/portal/tool/SkinnableCharonPortal.java since tools utilizing these functions might otherwise load jQuery.

3.       Is the best way really to modify each tool individually so it always loads jQuery?


Skeleton example of what I'm trying to accomplish:
[-- Additions to headscripts.js --]
if (window.attachEvent) {window.attachEvent('onload', installA11yFixes);}
else if (window.addEventListener) {window.addEventListener('load', installA11yFixes, false);}
else if (document.addEventListener) {document.addEventListener('load', installA11yFixes, false);}

function installA11yFixes() {
      installA11ySelectHandler();
      fixImplicitLabels();
}

function installA11ySelectHandler() {
if(isIE() && typeof jQuery != 'undefined') {
            // install jQuery interaction handler on select elements w/onchange events...
            // only needed on Internet Explorer
}
}

function fixImplicitLabels() {
if(typeof jQuery != 'undefined') {
            // code using jQuery to convert implicit labels to explicit ...
}
}
[-- End Additions to headscripts.js --]




Brian Richwine
UITS Adaptive Technology and Accessibility Centers
Indiana University - Bloomington / Indianapolis
http://iuadapts.indiana.edu
(812) 856-2757 [Direct Line]
(812) 856-4112 [Office Number]
(812) 650-2897 [Cell]
brichwin at indiana.edu<mailto:brichwin at indiana.edu>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110816/836346bf/attachment.html 


More information about the sakai-dev mailing list