⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsframework.js

📁 学习J2EE的好事例
💻 JS
字号:
/*---------------------------------------------------------------------------*\
|  Subject:    JSClass (JavaScript Class Controller)
|  Author:     meizz
|  Created:    2005-02-27
|  Version:    2006-03-03
|-------------------------------------------------------------
|  MSN: huangfr@msn.com   QQ: 112889082   http://www.meizz.com
|  Email: mz@126.com      CSDN ID:meizz   Copyright (c)  meizz
\*---------------------------------------------------------------------------*/

var System=function(){return new System.getContainer('System')};
System.codebase={};
try
{
  if (window!=parent && parent.System && parent.System.codebase) System.codebase = parent.System.codebase;
  else if (typeof opener!="undefined" && opener.System && opener.System.codebase) System.codebase = opener.System.codebase;
  else if (typeof dialogArguments!="undefined" && dialogArguments.System) System.codebase = dialogArguments.System.codebase;
}
catch(ex){}

System.author="meizz";
System.version="20050227";
System.currentVersion="20060225";
System.window=window; var t=document.getElementsByTagName("SCRIPT");
t=(System.scriptElement=t[t.length-1]).src.replace(/\\/g, "/");
System.path=(t.lastIndexOf("/")<0)?".":t.substring(0, t.lastIndexOf("/"));
System.hashCodePrefix="mz";
System.hashCodeCounter=0;
System.supportsXmlHttp=function()
{
  return !window.opera && 
    typeof(System.xmlHttp||(System.xmlHttp=new XMLHttpRequest()))=="object";
};
System.getContainer=function(namespace)
{
  return typeof(System.container[namespace])=="undefined" ?
    new Object:new System.container[namespace];
};
System.ie = window.navigator.userAgent.indexOf("MSIE")>0 && !window.opera;
System.load = function(namespace, path)
{// alert("System.load('"+ namespace +"')");
  var ex;try{if(System.supportsXmlHttp())
  {
    path=System.buildPath(namespace, path);
    System.xmlHttp.open("GET",path,false);System.xmlHttp.send(null);
    if (System.xmlHttp.readyState==4)
    {
      var jscode = System.xmlHttp.responseText;
      if (jscode==null || jscode.charAt(0)=="\uFFFD"){
      alert("Maybe encoding of "+path+" file isn't ANSI or UTF-8!");return "";}
      if (jscode.charAt(0)=="\xef")jscode=jscode.substr(3); //for firefox
      return jscode.replace(/(^|\n)\/\/+\s*((Using\(|Import\(|Include\()(\"|\')System\.)/g,"$1$2");
    }
  } else alert("Your browser don't support XMLHttp!");}
  catch(ex){alert("Error!\nmaybe "+path+" is inexistent!");return "";}
};

if(typeof XMLHttpRequest=='undefined' && System.ie)
{
  function XMLHttpRequest()
  {
    var msxmls=['MSXML3','MSXML2','Microsoft'], ex;
    for(var i=0;i<msxmls.length;i++)
      try{return new ActiveXObject(msxmls[i]+'.XMLHTTP')} catch(ex){}
      throw new Error("No XML component installed!");
  }
}

System.eval = function(namespace, path)
{
  //alert("System.eval(\""+ namespace +"\") = \r\n"+ System.codebase[namespace]);
  if(window.execScript) window.execScript(System.codebase[namespace]); else
  {
    var script=document.createElement("SCRIPT"); script.type="text/javascript";
    script.innerHTML="eval(System.codebase['"+ namespace +"']);";
    var id = script.id = System.hashCodePrefix+System.hashCodeCounter++;
    document.getElementsByTagName("HEAD")[0].appendChild(script);
    setTimeout("t=document.getElementById('"+id+"');t.parentNode.removeChild(t)",1);
  } System.classLoaded[namespace]=System.buildPath(namespace, path);
};
System.classLoadedControl = function(namespace, path)
{
  if(typeof System.classLoaded[namespace]=="undefined") return false;
  return System.classLoaded[namespace]==System.buildPath(namespace,path);
};
System.buildPath = function(namespace, path)
{
  if(typeof path=="string" && path.length>0) return path.toLowerCase(); var p =
  (System.path+"/"+namespace.substr(7).replace(/\./g,"/")+".js").toLowerCase();
  if(typeof path=="undefined") return p; return p +"?temp="+ Math.random();
};

window.Using = function(namespace, path)
{
  if(namespace.indexOf("System.")!=0) throw namespace+" isn't standard namespace!";
  if(System.classLoadedControl(namespace, path)) return; var code=namespace +".";
  for(var i=code.indexOf("."); i>-1; i=code.indexOf(".", i+1)){
  var e = code.substring(0, i); if(e&&typeof eval(e)=="undefined")
  eval(e + "=function(){return new System.getContainer('"+ e +"')}");}
  if(typeof path=="undefined" && typeof System.codebase[namespace]=="string")
  {
    System.eval(namespace, path);}else{if (code=System.load(namespace, path)){
    e = "$"+System.hashCodePrefix+"__id"+ new Date().getTime() +"$";
    var s="function "+e+"(){\r\n"+code+";\r\nSystem.container['";
    code=namespace.substr(namespace.lastIndexOf(".")+1);
    s += namespace +"']=window['"+ code +"']="+ code +";\r\n}"+e+"();";
    System.codebase[namespace]=s;s="";System.eval(namespace, path);}
  }
};
window.Import = function(namespace, path){Using(namespace, path)}
window.Instance = function(className){return System.instances[className]}
window.Include = function(namespace, path)
{
  if(namespace.indexOf("System.")!=0) throw namespace +" isn't standard namespace!";
  if(System.classLoadedControl(namespace, path)) return; var code;
  if(typeof path=="undefined" && typeof System.codebase[namespace]=="string")
  {
    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.language="javascript";
    script.src=System.classLoaded[namespace]=System.buildPath(namespace,path);
    var id=script.id=System.hashCodePrefix+System.hashCodeCounter++;
    document.getElementsByTagName("HEAD")[0].appendChild(script);
    setTimeout("t=document.getElementById('"+id+"');t.parentNode.removeChild(t)",1);
  }
};

Function.prototype.Extends=function(SuperClass,ClassName)
{
  var p=this.prototype=new SuperClass();
  if(ClassName)p.className=ClassName;
  return p;
};
System.Object = function(){};
System.container={"System":System.Object,"System.Object":System.Object};
System.instances={};
System.classLoaded={};
System.classLoaded["System"]=System.buildPath("System");
System.classLoaded["System.Object"]=System.buildPath("System.Object");
System.Object.Extends(Object, "System.Object").getHashCode=function()
{
  if(!this.hashCode)this.hashCode=System.hashCodePrefix+System.hashCodeCounter++;
  System.instances[this.hashCode]=this;
  return this.hashCode;
};
System.Object.equals=function(class1, class2)
{
  return typeof(class1.hashCode)!="undefined"&&
         typeof(class2.hashCode)!="undefined"&&
    class1.hashCode==class2.hashCode;
};
System.Object.prototype.toString = function()
{
  return "[object "+ (this.className || "Object") +"]";
};

//if(System.ie) Include("System.Plugins.IE");
Include("System.Global");

//for(t in System.codebase) alert( t +" = "+ System.codebase[t]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -