7a1ebb47 by Marty Penner

Adding submodules from original svn externals

1 parent 48c7f5ac
1 /scripts/.DS_Store
...\ No newline at end of file ...\ No newline at end of file
1 [submodule "com/Disabler"]
2 path = com/Disabler
3 url = gitolite:tz-disabler
4 [submodule "com/ChatterBox"]
5 path = com/ChatterBox
6 url = gitolite:chatterbox
7 [submodule "com/Debug"]
8 path = com/Debug
9 url = gitolite:tz-debug
ChatterBox @ 3c6a4b1f
1 Subproject commit 3c6a4b1f0ff2a6517cf6eecfdac812b73a40b61a
Debug @ e261ef9e
1 Subproject commit e261ef9e32d324357e905a38b638f3202f69015f
Disabler @ 1e9d44d8
1 Subproject commit 1e9d44d8588554f033f8db2401bea15ed7913929
1 /**
2 * A Singleton class to create, read and delete cookies
3 * @author Chris Boden
4 * @version 0.3
5 */
6 Cookie = new function() {
7 /**
8 * Create a cookie for current domain
9 * @param {String} name The name of the cookie by reference
10 * @param {String} value The value of the cookie to be stored
11 * @param {Integer} days The Number of days until the cookie expires
12 * @returns null
13 */
14 this.create = function(name, value, days) {
15 var expires = '';
16 if (days) {
17 var date = new Date();
18 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
19 expires = '; expires= ' + date.toGMTString();
20 }
21
22 document.cookie = name + '=' + value + expires + '; path=/';
23 }
24
25 /**
26 * Get the value of a cookie for this domain
27 * @param {String} name The name of the cookie
28 * @returns A string if cookie exists null if not
29 */
30 this.read = function read(name) {
31 var nameEQ = name + '=';
32 var ca = document.cookie.split(';');
33 for(var i = 0; i < ca.length; i++) {
34 var c = ca[i];
35 while (c.charAt(0)==' ') {
36 c = c.substring(1,c.length);
37 }
38
39 if (c.indexOf(nameEQ) == 0) {
40 return c.substring(nameEQ.length,c.length);
41 }
42 }
43
44 return null;
45 }
46
47 /**
48 * Erases a cookie from the domain
49 * @param {String} name Name of the cookie to erase
50 * @returns null
51 */
52 this.erase = function(name) {
53 Cookie.create(name, '', -1);
54 }
55 }
1 A simple class to creat, read and erase cookies