// module: // dijit/tests/boilerplate // description: // A // ... // var dir = "", theme = "claro", testMode = null; dojoConfig = { async: true, isDebug: true }; // Parse the URL, get parameters if(window.location.href.indexOf("?") > -1){ var str = window.location.href.substr(window.location.href.indexOf("?")+1).split(/#/); var ary = str[0].split(/&/); for(var i = 0; i < ary.length; i++){ var split = ary[i].split("="), key = split[0], value = (split[1]||'').replace(/[^\w]/g, ""); // replace() to prevent XSS attack switch(key){ case "locale": // locale string | null dojoConfig.locale = value; break; case "dir": // rtl | null dir = value; break; case "theme": // tundra | soria | nihilo | claro | null theme = /null|none/.test(value) ? null : value; break; case "a11y": if(value){ testMode = "dj_a11y"; } break; } } } // Find the '); // On IE9 the following inlined script will run before dojo has finished loading, leading to an error because require() // isn't defined yet. Workaround it by putting the code in a separate file. //document.write(''); document.write(''); function boilerplateOnLoad(){ // This function is the first registered domReady() callback, allowing us to setup // theme stuff etc. before the widgets start instantiating. // theme (claro, tundra, etc.) if(theme){ // Set to point to the specified theme document.body.className = theme; } // a11y (flag for faux high-contrast testing) if(testMode){ document.body.className += " " + testMode; } // BIDI if(dir == "rtl"){ // set dir=rtl on node document.body.parentNode.setAttribute("dir", "rtl"); require(["dojo/query!css2", "dojo/NodeList-dom"], function(query){ // pretend all the labels are in an RTL language, because // that affects how they lay out relative to inline form widgets query("label").attr("dir", "rtl"); }); } // parseOnLoad: true requires that the parser itself be loaded. if(dojoConfig.parseOnLoad){ require(["dojo/parser"]); } }