3 =head1 CXGN.DeveloperSettings
5 Manages the cookie and key/values for developer settings, on the client side
6 This is a singleton object
14 JSAN
.use('CXGN.Cookie');
16 DeveloperSettings
= window
.DeveloperSettings
|| {};
18 var DeveloperSettings
= {
21 DeveloperSettings
.parse(Cookie
.get('developer_settings'));
25 =head2 parse( cookie_string )
27 Given a cookie_string, parses out key/value relationships and sets
28 them to the object (assc. array) DeveloperSettings.data
33 parse: function(cookie_string
) {
34 cookie_string
= decodeURIComponent(cookie_string
);
35 var kvps
= cookie_string
.split(':');
36 for(var j
= 0; j
< kvps
.length
; j
++){
37 var kv
= kvps
[j
].split('=');
40 DeveloperSettings
.data
[k
] = v
;
47 Build and returncookie string from DeveloperSettings.data object (assc. array)
53 var data
= DeveloperSettings
.data
;
54 var cookie_string
= '';
57 if(i
>0) cookie_string
+= ":";
58 cookie_string
+= encodeURIComponent(key
) + "=" + encodeURIComponent(data
[key
])
61 return encodeURIComponent(cookie_string
);
68 Calls build() and sets this to the cookie
74 Cookie
.set('developer_settings', DeveloperSettings
.build(), 1000);
80 Gets the current value for the key in the associative array
85 getValue: function(key
) {
86 return DeveloperSettings
.data
[key
];
90 =head2 setValue(key, value)
92 Given a key and value, sets the associative array
97 setValue: function(key
,value
) {
98 DeveloperSettings
.data
[key
] = value
;
102 DeveloperSettings
._init();