Revision 318,
1.0 KB
checked in by niltonneto, 16 years ago
(diff) |
Commit feito pelo desenvolvedor (rodrigosouza).
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | (function() |
---|
2 | { |
---|
3 | function _clear() |
---|
4 | { |
---|
5 | if ( arguments.length == 1 ) |
---|
6 | _set(arguments[0], '', -1440); |
---|
7 | } |
---|
8 | |
---|
9 | function _get() |
---|
10 | { |
---|
11 | if ( (arguments.length == 1) && (document.cookie.length > 0) ) |
---|
12 | { |
---|
13 | var _start = document.cookie.indexOf(arguments[0] + "="); |
---|
14 | if ( _start != -1 ) |
---|
15 | { |
---|
16 | _start = _start + arguments[0].length + 1; |
---|
17 | var _end = document.cookie.indexOf(';', _start); |
---|
18 | |
---|
19 | if ( _end == -1) |
---|
20 | _end = document.cookie.length; |
---|
21 | |
---|
22 | return unescape(document.cookie.substring(_start, _end)); |
---|
23 | } |
---|
24 | } |
---|
25 | return false; |
---|
26 | } |
---|
27 | |
---|
28 | function _set() |
---|
29 | { |
---|
30 | var _argc = arguments.length; |
---|
31 | if ( _argc > 1 && _argc < 4 ) |
---|
32 | { |
---|
33 | var _value = arguments[0] + '=' + escape(arguments[1]); |
---|
34 | if ( _argc == 3 ) |
---|
35 | { |
---|
36 | var dt = new Date; |
---|
37 | dt.setTime((dt.getTime() - 10800000) + (arguments[2] * 60000)); |
---|
38 | _value += ';expires=' + dt.toGMTString(); |
---|
39 | } |
---|
40 | document.cookie = _value; |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | function Cookies() |
---|
45 | { |
---|
46 | } |
---|
47 | |
---|
48 | Cookies.prototype.clear = _clear; |
---|
49 | Cookies.prototype.get = _get; |
---|
50 | Cookies.prototype.set = _set; |
---|
51 | window.IMCookies = Cookies; |
---|
52 | } |
---|
53 | )(); |
---|
Note: See
TracBrowser
for help on using the repository browser.