>  기사  >  웹 프론트엔드  >  js 트리 제어 스크립트 code_javascript 기술

js 트리 제어 스크립트 code_javascript 기술

WBOY
WBOY원래의
2016-05-16 19:02:23877검색

/*------------------------------------------------ ------------*
|  제목: 자바스크립트 프레임워크
|  작성자:  meizz
|  생성일: 2005-02-27
|  버전: 2006-08-11
|----------------------
|  MSN:huangfr@msn.com  QQ:112889082
|  http://www.meizz.com  저작권(c) meizz   MIT 스타일 라이선스
|  위의 저작권 고지와 본 허가 고지는 다음과 같습니다.
|  소프트웨어의 모든 사본 또는 상당 부분에 포함되어 있습니다.
*-------------------------------------- ------------------------*/

window.System = function(){this.setHashCode();}

System.debug=true; //거짓
System._codebase={};
시도해 보세요
{
  if (window!=parent && parent.System && parent.System._codebase)
    System._codebase = parent.System._codebase;
  else if ("정의되지 않음"!=opener&&opener.System&&opener.System._codebase 유형)
    System._codebase = opener.System._codebase;
  else if ("정의되지 않음"!=typeof dialogArguments && dialogArguments.System)
    System._codebase = dialogArguments.System._codebase;
}
catch(ex){}

System.MISSING_ARGUMENT="인수 누락";
System.ARGUMENT_PARSE_ERROR="인수를 구문 분석할 수 없습니다.";
System.NOT_SUPPORTED_XMLHTTP="귀하의 브라우저는 XMLHttp를 지원하지 않습니다.";
System.FILE_NOT_FOUND="파일을 찾을 수 없음";
System.MISCODING="파일 인코딩이 ANSI 또는 UTF-8이 아닐 수도 있습니다.";
System.NAMESPACE_ERROR=" 비표준 네임스페이스";

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("/")System.getUniqueId=function(){return "mz_" (System.hashCounter ).toString(36);};
System.toHashCode=function(e)
{
  if("undefine"!=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("undefine"==typeof System._prototypes[namespace])return new System();
  for(var a=[], i=0; i  return eval("new (System._prototypes['" 네임스페이스 "'])(" a.join(",") ")");
};
System.ie=navigator.userAgent.indexOf("MSIE")>0 && !window.opera;
System.ns=navigator.vendor=="넷스케이프";
System._alert=function(msg){if(System.debug)alert(msg);};
System._parseResponseText=함수
{
    if (null==s||"uFFFD"==s.charAt(0)){System._alert(System.MISCODING);return " ";}
    if ("xef"==s.charAt(0))s=s.substr(3); //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      새 ActiveXObject(msxmls[i] '를 반환해 보세요. XMLHTTP')} catch(예){}
    System._xmlHttp="mz"; throw new Error(System.NOT_SUPPORTED_XMLHTTP)
  }
}
System.load = function(네임스페이스, 경로)
{
  시도
  {
    if(System.supportsXmlHttp()){path=System._mapPath(네임스페이스, 경로);
    var x=System._xmlHttp; x.open("GET",경로,false); x.send(널);
    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(네임스페이스 "n" System.FILE_NOT_FOUND);
      else new Error(x.status  ": "  x.statusText);}
    } else System._alert(System.NOT_SUPPORTED_XMLHTTP);
  }
  catch(ex){System._alert(namespace "n" ex.message);}return "";
};
System._eval = 함수(네임스페이스, 경로)
{
  //alert("System._eval("" 네임스페이스 "")=rn" System._codebase[네임스페이스]);
  시도{if(window.execScript)window.execScript(System._codebase[네임스페이스]);else
  {
    var script=document.createElement("SCRIPT");script.type="text/ 자바스크립트";
    script.innerHTML="eval(System._codebase['"  네임스페이스  "']);";
    document.getElementsByTagName("HEAD")[0].appendChild(script);
    setTimeout(function(){script.parentNode.removeChild(script)},99);
  }}catch(ex){System._alert("로드 시 구문 오류"  네임스페이스);}
  System._existences[namespace]=System._mapPath(네임스페이스, 경로);
};
System._exist = 함수(네임스페이스, 경로)
{
  if("undefine"==typeof System._existences[네임스페이스]) return false;
  반환 System._existences[네임스페이스]==System._mapPath(네임스페이스,경로);
};
System._mapPath = 함수(네임스페이스, 경로)
{
  if("string"==typeof path && path.length>3)return path.toLowerCase();
  var p=(System.path "/" 네임스페이스.replace(/./g,"/") ".js").toLowerCase();
  return p  (("undefine"==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[네임스페이스])s=System._prototypes[네임스페이스];return}
  var code=네임스페이스  "."; if(!/((^|.)[w$] ) $/.test(namespace))
  새 오류 발생(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) ? "창["" e ""]":e;
  if(e&&"undefine"==typeof(s)){
  eval(s "=function(){return System._getPrototype("" e "", arguments)}");}}
  if("정의되지 않음"==경로 유형 &&"string"==System._codebase[네임스페이스] 유형)
  {
    System._eval(네임스페이스, 경로);}else{if(code=System.load (네임스페이스, 경로)){
    e = "$"  System.getUniqueId()  "__id"  new Date().getTime()  "$";
    s = "함수" e "(){rn" 코드 ";rnSystem._prototypes['";
    code=namespace.substr(namespace.lastIndexOf(".") 1);
    s  = 네임스페이스 "']=window['" (rename||code) "']=" code ";rn}" e "();";
    System._codebase[네임스페이스]=s;s="";System._eval(네임스페이스, 경로);}
  }
};
window.Import=function(namespace,path,rename){Using(namespace,path,rename)};
window.Instance=function(hashCode){return System._instances[hashCode]};
window.Include=function(네임스페이스, 경로)
{
  if(System._exist(네임스페이스, 경로)) return;
  var code;if(!/((^|.)[w$] ) $/.test(namespace))
  throw new Error(namespace   System.NAMESPACE_ERROR);
  if("정의되지 않음"==typeof path&&"string"==typeof(System._codebase[네임스페이스]))
  {
    System._eval(네임스페이스, 경로);}else if(System.supportsXmlHttp()){
    if(code=System.load(네임스페이스, 경로)){System._codebase[네임스페이스]=code;
    System._eval(네임스페이스, 경로);}}else{
    var script=document.createElement("SCRIPT");script.type="text/javascript";
    script.src=System._existences[네임스페이스]=System._mapPath(네임스페이스,경로);
    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||함수.READ_WRITE; 이름="_" 이름; var p=this.prototype;
  if("undefine"!=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(클래스명)p._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.Object = 시스템;
t.decontrol=function(){var t;if(t=this.hashCode)delete System._instances[t]};
t.addEventListeners=function(type, handle)
{
  if("function"!=typeof handle)
    새 오류 발생(이 "addEventListener:" 핸들 "은 함수가 아닙니다") ;
  if(!this._listeners) this._listeners={};
  var id=System.toHashCode(handle), t=this._listeners; 
  if("object"!=typeof t[type]) t[type]={}; t[유형][id]=핸들;
};
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[유형][id])delete t[유형][id];if(t[유형])delete t[유형];
};
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);
  evt.target 삭제; 삭제 evt.srcElement;return evt.returnValue;
};
t.setHashCode=function()
{
  System._instances[(this.hashCode=System.getUniqueId())]=this;
};
t.getHashCode=function()
{
  if(!this.hashCode)this.setHashCode(); 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 지원
Include("System.Global");

js 트리 제어 스크립트 code_javascript 기술mztreeview2.rar

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.