/ / -------------------------------------------------------------------------------------------- -------------
// Author: Tonton
// email:
Tonton@yeah.net
// Date: 2004-07-28
// Warning: free to use for everyone, Don't Stand on Ceremony
/ / -------------------------------------------------------------------------------------------- -------------
IF (TypeOf __ $ __ js__io__cookie__class __ $ __ == "undefined") {
VAR __ $ __ js__io__cookie__class __ $ __ = "js.io.cookie";
Function cookie (name, value) {
_OverLoad:
THIS.TOSTRING = function () {Return this.Value;
THIS.VALUEOF = Function () {Return this.Value;
_PUBIC:
THIS.NAME = Name;
THIS.VALUE = VALUE;
}
Function cookies (cookiepath, cookiedomain, cookiesecure) {
_Private:
Var _path;
Var_domain;
Var_Secure;
Var_tail;
_OverLoad:
THIS.TOSTRING = function () {return "cookiesclass";
THIS.VALUEOF = Function () {Return Document.cookie;
_PUBIC:
THIS.GETPATH = Function () {Return THIS._PATH;}
THIS.GETDOMAIN = Function () {Return this._domain;}
THIS.GETSecure = function () {returnid hHIS_SECURE;}
THIS.ITEMS = NULL;
THIS.RESET = Function (Path, Domain, Secure) {
IF (PATH! = null) this._path = path;
Else path = this._path;
IF (domain! = null) ._domain = domain;
Else Domain = this._domain;
IF (Secure! = null) ._secure = secure;
Else Secure = this._secure;
Var s = ""
IF (PATH) S = "PATH =" PATH ";";
IF (domain) s = "Domain =" Domain ";"
IF (Secure) s = "Secure;";
THIS._TAIL = S;
this.getall ()
}
THIS.GET = Function (cookiename) {
IF (cookiename) {
IF (this.Items.length == 0) this.getall ();
For (var i = 0; i IF (this.Items [i] .name == cookiename) Return this.Items [i]; } } THIS.GETALL = Function () { VAR C = Document.cookie; THIS.Items = new array (); IF (c == null) Return NULL; C = C.Split (";"); VAR J = -1; FOR (var i = 0; i VAR T = C [i] .indexof ("="); IF (t> -1) { VAR n = unescape (c [i] .substring (0, t)); THIS.Items [ J] = New cookie (N, UNESCAPE (C [i] .substring (t 1))); } } Return this.Items; } THIS.SET = Function (Name, Value, Expire) { IF (! && value) RETURN FALSE; IF (! (! ("(expire instanceof date) { IF (TypeOf Expire == "Number") { VAR D = New Date (); D.SetTime (D.getTime () PARSEINT (Expire) * 1000); Expire = D; } else { Expire = NULL; } } Var s = unescape (name) "=" unscape (value) ";" IF (expire) s = "expires =" expire.togmtstring () ";"; Document.cookie = s this._tail; Return True; } this.remove = function (name) { VAR D = New Date (); D.SetTime (D.getTime () - 1000); Document.cookie = unescape (name) "= ''; expires =" D.togmtstring () ";"; } _initial: THIS.RESET (CookiePath, Cookiedomain, Cookiesecure); } } // End of __ $ __ js__io__cookie__class __ $ __