JS Tree control scripting code _javascript Tips

Source: Internet
Author: User
/*---------------------------------------------------------------------------*\
| Subject:javascript Framework
| Author:meizz
| Created:2005-02-27
| Version:2006-08-11
|-----------------------------------
| Msn:huangfr@msn.com qq:112889082
| Http://www.meizz.com Copyright (c) Meizz Mit-style license
| The above copyright notice and this permission notice shall is
| Included in all copies or substantial portions of the Software
\*---------------------------------------------------------------------------*/

Window. System = function () {This.sethashcode ();}

System.debug=true; False
system._codebase={};
Try
{
if (window!=parent && parent. System && parent. System._codebase)
System._codebase = parent. System._codebase;
else if ("Undefined"!=typeof opener&&opener. System&&opener. System._codebase)
System._codebase = opener. System._codebase;
else if ("undefined"!=typeof dialogarguments && Dialogarguments.system)
System._codebase = Dialogarguments.system._codebase;
}
catch (ex) {}

system.missing_argument= "MISSING ARGUMENT";
System.argument_parse_error= "The ARGUMENT cannot be parsed";
system.not_supported_xmlhttp= "Your Browser does not support XMLHTTP";
System.file_not_found= "FILE not FOUND";
system.miscoding= "Maybe file encoding is not ANSI or UTF-8";
System.namespace_error= "nonstandard NAMESPACE";

system.hashcounter=0;
System.currentversion= "20060811";
var t=document.getelementsbytagname ("SCRIPT");
T= (System.scriptelement=t[t.length-1]). Src.replace (/\\/g, "/");
System.incorporate=function (d,s) {for (Var i in s) D[i]=s[i];return D;};
System.path= (T.lastindexof ("/") <0) ".": t.substring (0, T.lastindexof ("/"));
System.getuniqueid=function () {return "mz_" + (system.hashcounter++). toString (36);};
System.tohashcode=function (e)
{
if ("Undefined"!=typeof e.hashcode) return e.hashcode;
return E.hashcode=system.getuniqueid ();
};
System.supportsxmlhttp=function ()
{
Return "Object" ==typeof (system._xmlhttp| | (System._xmlhttp=new XMLHttpRequest ());
};
System._getprototype=function (namespace, Argu)
{
if ("Undefined" ==typeof System._prototypes[namespace]) return to new System ();
for (Var a=[], i=0 i<argu.length; i++) a[i]= "argu[" + i + "]";
Return eval ("New (system._prototypes['" +namespace+ "")) ("+a.join (", ") +") ");
};
System.ie=navigator.useragent.indexof ("MSIE") >0 &&!window.opera;
system.ns=navigator.vendor== "Netscape";
System._alert=function (msg) {if (system.debug) alert (msg);
System._parseresponsetext=function (s)
{
if (null==s| |) \ufffd "==s.charat (0)) {System._alert (system.miscoding); return" ";}
if ("\xef" ==s.charat (0)) S=s.substr (3); For Firefox
Return S.replace (/(^|\n) \s*\/\/+\s* (using| Import| Include) \ ((\ "|\ ')")/g, "$1$2");
};

if (window. ActiveXObject && (system.ie | |!window. XMLHttpRequest))
{
Window. XMLHttpRequest = function ()
{
var msxmls=[' MSXML3 ', ' MSXML2 ', ' Microsoft ', ex;
for (Var i=0;i<msxmls.length;i++)
Try{return new ActiveXObject (msxmls[i]+ '. XMLHTTP ')} catch (ex) {}
system._xmlhttp= "MZ"; throw new Error (system.not_supported_xmlhttp);
}
}
System.load = function (namespace, path)
{
Try
{
if (System.supportsxmlhttp ()) {Path=system._mappath (namespace, path);
var x=system._xmlhttp; X.open ("Get", path,false); X.send (NULL);
if (x.readystate==4)
{
if (x.status==0| | /^file\:/i.test (PATH))
Return System._parseresponsetext (X.responsetext);
else if (x.status==200) return System._parseresponsetext (X.responsetext);
else if (x.status==404) system._alert (namespace+ "\ n" +system.file_not_found);
else throw new Error (X.status + ":" + X.statustext);}
else System._alert (system.not_supported_xmlhttp);
}
catch (ex) {System._alert (namespace+ "\ n" +ex.message);} Return "";
};
System._eval = function (namespace, path)
{
Alert ("System._eval (\" +namespace+ "\") =\r\n "+system._codebase[namespace]";
Try{if (Window.execscript) window.execscript (system._codebase[namespace); else
{
var script=document.createelement ("script"); script.type= "Text/javascript";
Script.innerhtml= "eval (system._codebase['" + namespace + "]);";
document.getElementsByTagName ("Head") [0].appendchild (script);
settimeout (function () {script.parentNode.removeChild (script)},99);
}}catch (ex) {System._alert ("Syntax Error on Load" + namespace);}
System._existences[namespace]=system._mappath (namespace, path);
};
System._exist = function (namespace, path)
{
if ("Undefined" ==typeof System._existences[namespace]) return false;
Return System._existences[namespace]==system._mappath (Namespace,path);
};
System._mappath = function (namespace, path)
{
if ("string" ==typeof path && path.length>3) return path.tolowercase ();
var p= (system.path+ "/" +namespace.replace (/\./g, "/") + ". js"). toLowerCase ();
return p + ("undefined" ==typeof path| | Path)? "": "t=" + math.random ());
};

Window. Using = function (namespace, path, rename)
{
if (system._exist (namespace, path)) {
var s=window[namespace.substr (Namespace.lastindexof (".") +1)];
if (S!=system._prototypes[namespace]) S=system._prototypes[namespace];return}
var code=namespace + "."; if (!/(^|\.) [\w\$]+) +$/.test (namespace))
throw new Error (Namespace+system.namespace_error);
For (Var i=code.indexof ("."); i>-1; i=code.indexof (".", i+1)) {
var e= code.substring (0,i), s= (E.indexof (".") ==-1)? "Window[\" "+e+" \ "]": E;
if (e&& "undefined" ==typeof (s)) {
Eval (s+ "=function () {return system._getprototype (\" +e+ "\", Arguments)} ");}
if ("Undefined" ==typeof path && "string" ==typeof System._codebase[namespace])
{
System._eval (namespace, path); Else{if (Code=system.load (Namespace,path)) {
E = "$" + system.getuniqueid () + "__id" + New Date (). GetTime () + "$";
s = "function" +e+ () {\ r \ n "+code+"; \r\nsystem._prototypes[' ";
Code=namespace.substr (Namespace.lastindexof (".") +1);
s + + namespace+ "']=window['" + (rename| | Code) + "']=" +code+ "; \ r \ n}" +e+ "();";
System._codebase[namespace]=s;s= ""; System._eval (namespace, path);
}
};
Window. Import=function (namespace,path,rename) {Using (namespace,path,rename)};
Window. Instance=function (hashcode) {return system._instances[hashcode]};
Window. Include=function (namespace, path)
{
if (system._exist (namespace, path)) return;
var code;if (!/(^|\.) [\w\$]+) +$/.test (namespace))
throw new Error (namespace + system.namespace_error);
if ("Undefined" ==typeof path&& "string" ==typeof (System._codebase[namespace))
{
System._eval (namespace, path); else if (system.supportsxmlhttp ()) {
if (Code=system.load (namespace, path)) {System._codebase[namespace]=code;
System._eval (namespace, path);}} else{
var script=document.createelement ("script"); script.type= "Text/javascript";
Script.src=system._existences[namespace]=system._mappath (Namespace,path);
document.getElementsByTagName ("Head") [0].appendchild (script);
settimeout (function () {script.parentNode.removeChild (script)},99);
}
};

function.read=1; function.write=2; function.read_write=3;
Function.prototype.addproperty=function (Name,initvalue,r_w)
{
var capital=name.charat (0). toUpperCase () +name.substr (1);
r_w=r_w| | Function.read_write; Name= "_" +name; var P=this.prototype;
if ("Undefined"!=typeof initvalue) P[name]=initvalue;
if (r_w&function.read) p["get" + capital]=function () {return this[name];
if (r_w&function.write) p["set" + capital]=function (v) {this[name]=v;};
};
Function.prototype.extends=function (Superclass,classname)
{
var op=this.prototype, I, p=this.prototype=new superclass ();
if (ClassName) p._classname=classname; For (i in op) p[i]=op[i];
if (p.hashcode) Delete System._instances[p.hashcode];return p;
};
system._instances={};
system._prototypes=
{
"System": System,
"System.Object": System,
"System.event": system.event
};
system._existences=
{
"System": System._mappath ("System"),
"System.event": System._mappath ("System.event"),
"System.Object": System._mappath ("System.Object")
};
T=system.extends (Object, "System"); System.Object = System;
T.decontrol=function () {var t;if (t=this.hashcode) Delete system._instances[t]};
T.addeventlisteners=function (type, handle)
{
if ("function"!=typeof handle)
throw new Error (this+ "AddEventListener:" +handle+ "is not a function");
if (!this._listeners) this._listeners={};
var id=system.tohashcode (handle), t=this._listeners;
if ("Object"!=typeof T[type]) t[type]={}; T[type][id]=handle;
};
T.removeeventlistener=function (type, handle)
{
if (!this._listeners) this._listeners={}; var t=this._listeners;
if (!t[type]) return; var id=system.tohashcode (handle);
if (T[type][id]) Delete t[type][id];if (T[type]) Delete T[type];
};
T.dispatchevent=function (EVT)
{
if (!this._listeners) this._listeners={};
var i, T =this._listeners, P =evt.type;
Evt.target=evt.srcelement=this; if (This[p]) this[p] (EVT);
if ("Object" ==typeof T[p]) for (I in T[p)) T[p][i].call (THIS,EVT);
Delete Evt.target; Delete Evt.srcelement;return evt.returnvalue;
};
T.sethashcode=function ()
{
system._instances[(This.hashcode=system.getuniqueid ())]=this;
};
T.gethashcode=function ()
{
if (!this.hashcode) This.sethashcode (); return this.hashcode;
};
T.tostring=function () {return "[object" + (this._classname| |) Object ") +"] ";
System.event=function (type) {this.type=type;};
T=system.event.extends (System, "system.event");
T.returnvalue=true;
T.cancelbubble=false;
T.target=t.srcelement=null;
T.stoppropagation=function () {this.cancelbubble=true;};
T.preventdefault =function () {this.returnvalue=false;};

if (system.ie &&! System.debug) Include ("System.Plugins.IE"); IE UserData
if (Window.opera) Include ("System.Plugins.Opera"); Opera Support
Include ("System.global");

Mztreeview2.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.