1 | /*
|
---|
2 | This file is part of the DITA Open Toolkit project hosted on
|
---|
3 | Sourceforge.net. See the accompanying license.txt file for
|
---|
4 | applicable licenses.
|
---|
5 |
|
---|
6 | Copyright (c) 2006, Yahoo! Inc. All rights reserved.
|
---|
7 | Code licensed under the BSD License:
|
---|
8 | http://developer.yahoo.net/yui/license.txt
|
---|
9 | version: 0.10.0
|
---|
10 | */
|
---|
11 |
|
---|
12 | /* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * The Yahoo global namespace
|
---|
16 | * @constructor
|
---|
17 | */
|
---|
18 | var YAHOO = window.YAHOO || {};
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Returns the namespace specified and creates it if it doesn't exist
|
---|
22 | *
|
---|
23 | * YAHOO.namespace("property.package");
|
---|
24 | * YAHOO.namespace("YAHOO.property.package");
|
---|
25 | *
|
---|
26 | * Either of the above would create YAHOO.property, then
|
---|
27 | * YAHOO.property.package
|
---|
28 | *
|
---|
29 | * @param {String} sNameSpace String representation of the desired
|
---|
30 | * namespace
|
---|
31 | * @return {Object} A reference to the namespace object
|
---|
32 | */
|
---|
33 | YAHOO.namespace = function( sNameSpace ) {
|
---|
34 |
|
---|
35 | if (!sNameSpace || !sNameSpace.length) {
|
---|
36 | return null;
|
---|
37 | }
|
---|
38 |
|
---|
39 | var levels = sNameSpace.split(".");
|
---|
40 |
|
---|
41 | var currentNS = YAHOO;
|
---|
42 |
|
---|
43 | // YAHOO is implied, so it is ignored if it is included
|
---|
44 | for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
|
---|
45 | currentNS[levels[i]] = currentNS[levels[i]] || {};
|
---|
46 | currentNS = currentNS[levels[i]];
|
---|
47 | }
|
---|
48 |
|
---|
49 | return currentNS;
|
---|
50 | };
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Global log method.
|
---|
54 | */
|
---|
55 | YAHOO.log = function(sMsg,sCategory) {
|
---|
56 | if(YAHOO.widget.Logger) {
|
---|
57 | YAHOO.widget.Logger.log(null, sMsg, sCategory);
|
---|
58 | } else {
|
---|
59 | return false;
|
---|
60 | }
|
---|
61 | };
|
---|
62 |
|
---|
63 | YAHOO.namespace("util");
|
---|
64 | YAHOO.namespace("widget");
|
---|
65 | YAHOO.namespace("example");
|
---|