Last change
on this file since 162 was
30,
checked in by sebas, 17 years ago
|
nueva importacion del codigo del esqueleto de redcta con los plugins
|
File size:
1.7 KB
|
Line | |
---|
1 | /* |
---|
2 | Copyright (c) 2006 Yahoo! Inc. All rights reserved. |
---|
3 | version 0.9.0 |
---|
4 | */ |
---|
5 | |
---|
6 | /** |
---|
7 | * @class The Spip global namespace |
---|
8 | */ |
---|
9 | var SPIP = function() { |
---|
10 | |
---|
11 | return { |
---|
12 | |
---|
13 | /** |
---|
14 | * Spip presentation platform utils namespace |
---|
15 | */ |
---|
16 | util: {}, |
---|
17 | |
---|
18 | /** |
---|
19 | * Spip presentation platform widgets namespace |
---|
20 | */ |
---|
21 | widget: {}, |
---|
22 | |
---|
23 | /** |
---|
24 | * Spip presentation platform examples namespace |
---|
25 | */ |
---|
26 | example: {}, |
---|
27 | |
---|
28 | /** |
---|
29 | * Returns the namespace specified and creates it if it doesn't exist |
---|
30 | * |
---|
31 | * SPIP.namespace("property.package"); |
---|
32 | * SPIP.namespace("SPIP.property.package"); |
---|
33 | * |
---|
34 | * Either of the above would create SPIP.property, then |
---|
35 | * SPIP.property.package |
---|
36 | * |
---|
37 | * @param {String} sNameSpace String representation of the desired |
---|
38 | * namespace |
---|
39 | * @return {Object} A reference to the namespace object |
---|
40 | */ |
---|
41 | namespace: function( sNameSpace ) { |
---|
42 | |
---|
43 | if (!sNameSpace || !sNameSpace.length) { |
---|
44 | return null; |
---|
45 | } |
---|
46 | |
---|
47 | var levels = sNameSpace.split("."); |
---|
48 | |
---|
49 | var currentNS = SPIP; |
---|
50 | |
---|
51 | // SPIP is implied, so it is ignored if it is included |
---|
52 | for (var i=(levels[0] == "SPIP") ? 1 : 0; i<levels.length; ++i) { |
---|
53 | currentNS[levels[i]] = currentNS[levels[i]] || {}; |
---|
54 | currentNS = currentNS[levels[i]]; |
---|
55 | } |
---|
56 | |
---|
57 | return currentNS; |
---|
58 | |
---|
59 | } |
---|
60 | }; |
---|
61 | |
---|
62 | } (); |
---|
63 | |
---|
64 | // Spip presentation platform packages. Hard-coding them into the object |
---|
65 | // uses fewer chars than the namespace function does |
---|
66 | // SPIP.namespace("util"); |
---|
67 | // SPIP.namespace("widget"); |
---|
68 | // SPIP.namespace("example"); |
---|
Note: See
TracBrowser
for help on using the repository browser.