/** * Copyright (c) 2004-2017 Omnitracs, LLC. All rights reserved. * Confidential and Proprietary - Omnitracs, LLC. * This software may be subject to U.S. and international export, re-export, or transfer * ("export") laws. * Diversion contrary to U.S. and international laws is strictly prohibited. */ // CSDI namespace /* To create CSDI name space, just call: CSDI.namespace("CSDI.myspace"); -OR- CSDI.namespace("myspace"); This creates a variable called CSDI instantiated as an object. In the example of CSDI.namespace("CSDI.myspace"), CSDI will have a property called myspace. This is similar to the Yahoo YUI global namespace variable. But this version had to be modified a bit to detect is the CSDI global variable itself had already been defined. By doing so, we remove the risk that the global namespace variable is nullified and redefined. */ if (!window.CSDI) { window.CSDI = function () { return { namespace: function (sNameSpace) { // if sNameSpace is null or empty, return nothing if (!sNameSpace || sNameSpace.length == 0) return null; // create CSDI namespace object var spaces = sNameSpace.split("."); // always have the top level name space as CSDI var ns = CSDI; if (spaces[0] == "CSDI") spaces.shift(); // create the rest of the namespaces for (var i = 0; i < spaces.length; i++) { // if the space doesn't exist, create it if (!ns[spaces[i]]) ns[spaces[i]] = {}; ns = ns[spaces[i]]; } return ns; }, browser: { isIE: window.attachEvent != undefined, isIE8: (navigator.userAgent.toString().toLowerCase().indexOf('trident/4.0') != -1), isIE9: (navigator.userAgent.toString().toLowerCase().indexOf("trident/5") > -1), isIE10: navigator.userAgent.toString().toLowerCase().indexOf("trident/6") > -1, isIE11: navigator.userAgent.toString().toLowerCase().indexOf("trident/7") > -1, isEdge: navigator.userAgent.toString().toLowerCase().indexOf("edge") > -1, isFF: navigator.userAgent.toString().toLowerCase().indexOf("firefox") > -1, isChrome: navigator.userAgent.toString().toLowerCase().indexOf('chrome') > -1 } }; } (); }