12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /****************************************************************
- ** IBM Confidential
- **
- ** OCO Source Materials
- **
- ** BI and PM: tm1web
- **
- ** (C) Copyright IBM Corp. 2010
- **
- ** The source code for this program is not published or otherwise
- ** divested of its trade secrets, irrespective of what has been
- ** deposited with the U.S. Copyright Office.
- *****************************************************************/
- // NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
- // This file is code that is meant to run BEFORE dojo is loaded and therefore
- // cannot depend on any dojo library objects, or use dojo to load other code.
- // NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
- var common = {DjConfig : {}};
- ;(function() {
- var DjConfig = common.DjConfig;
-
- DjConfig.setupPage = function() {
- // see if there's a debug=true arg in the URL
- var isDebug = isDebugUrl(document.location.href);
-
- // setup Dojo config object prior to loading dojo
- djConfig = {
- parseOnLoad:false,
- isDebug:isDebug,
- popup:isDebug,
- breakOnAssert:true,
- defaultDuration:100
- };
- };
-
- DjConfig.setDebugClickElement = function(dcElement) {
- dojo.connect(dcElement, "onclick", DjConfig, DjConfig.reloadPageInDebugMode);
- };
-
- DjConfig.reloadPageInDebugMode = function(event) {
- if (!(event.shiftKey && event.ctrlKey)) {
- return;
- }
- var curHref = document.location.href;
- var newHref = curHref;
- newHref = newHref.replace(/debug=(\w)*/,"");
- newHref = (newHref.indexOf("?") != -1) ? newHref : newHref + "?";
- newHref = newHref.replace(/\&\&/,"");
- document.location.href = newHref + "&debug=true";
- };
- DjConfig.setupPage();
-
- function isDebugUrl(urlText) {
- var debugValue = getQueryArgValue(document.location.href, "debug", false);
- var isDebug = debugValue != null && debugValue != "false" && debugValue != "0" && debugValue != false;
- return isDebug;
- }
- function getQueryArgValue(urlText, argName, defaultValue) {
- var urlParts = urlText.split("?");
- if (urlParts.length < 2) {
- return null;
- }
-
- var argArray = urlParts[1].split("&");
- var value = defaultValue;
- for (var i = 0; i < argArray.length; i++) {
- var arg = argArray[i];
- var argParts = arg.split("=");
- var name = argParts[0];
- if (name == argName) {
- if (argParts.length > 1) {
- value = argParts[1];
- } else {
- value = true;
- }
- break;
- }
- }
-
- return value;
- }
- }());
|