📄 jsframework.js
字号:
/*---------------------------------------------------------------------------*\
| Subject: Javascript Framework
| Author: meizz
| Created: 2005-02-27
| Version: 2006-05-03
|-------------------------------------------------------------
| MSN: huangfr@msn.com QQ: 112889082 http://www.meizz.com
| Email: mz@126.com CSDN ID:meizz Copyright (c) meizz
\*---------------------------------------------------------------------------*/
//http://msdn.microsoft.com/library/default.asp?url=/workshop/webcontrols/reference/webforms_entry.asp
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.hashCodeCounter=0;
System.version="20050227";
System.currentVersion="20060504";
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.getUniqueId=function(){return "Mz"+(System.hashCodeCounter++).toString(36);};
System.supportsXmlHttp=function(){
return typeof(System.xmlHttp||(System.xmlHttp=new XMLHttpRequest()))=="object";
};
System.getContainer=function(namespace)
{
return "undefined"==typeof(System.container[namespace]) ?
new Object:new System.container[namespace];
};
System.ie = window.navigator.userAgent.indexOf("MSIE")>0 && !window.opera;
System.alert=function(msg){}//alert(msg);
System.parseResponseText=function(text)
{
if (null==text || "\uFFFD"==text.charAt(0)){
System.alert("Maybe encoding of "+path+" file isn't ANSI or UTF-8!");return "";}
if ("\xef"==text.charAt(0))text=text.substr(3); //for firefox
return text.replace(/(^|\n)\/\/+\s*((Using\(|Import\(|Include\()(\"|\')System\.)/g,"$1$2");
};
System.load = function(namespace, path)
{
var ex;try
{
if(System.supportsXmlHttp()){path=System.mapPath(namespace, path);
System.xmlHttp.open("GET",path,false);System.xmlHttp.send(null);
if (System.xmlHttp.readyState==4)
{
if(System.xmlHttp.status==200)
return System.parseResponseText(System.xmlHttp.responseText);
}
} else System.alert("Your browser don't support XMLHttp!");}
catch(ex){System.alert("Error!\nmaybe "+path+" is inexistent!");return "";}
};
if(window.ActiveXObject && !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){}
throw new Error("No XML component installed!");
}
}
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 +"']);";
var id = script.id = System.getUniqueId();
document.getElementsByTagName("HEAD")[0].appendChild(script);
setTimeout("t=document.getElementById('"+id+"');t.parentNode.removeChild(t)",10);
}}catch(ex){}//{System.alert("Syntax error on load "+ namespace +"!");}
System.existences[namespace]=System.mapPath(namespace, path);
};
System.exist = function(namespace, path)
{
if(typeof System.existences[namespace]=="undefined") 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.substr(7).replace(/\./g,"/")+".js").toLowerCase();
if("undefined"==typeof(path)) 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.exist(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.getUniqueId() +"__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.exist(namespace, path)) return; var code;
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.language="javascript";
script.src=System.existences[namespace]=System.mapPath(namespace,path);
var id=script.id=System.getUniqueId();
document.getElementsByTagName("HEAD")[0].appendChild(script);
setTimeout("t=document.getElementById('"+id+"');t.parentNode.removeChild(t)",10);
}
};
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];
return p;
};
System.base=function(){System.instances[(this.index=this.hashCode=System.getUniqueId())]=this;}
System.Object = function()
{
var _eventListeners={};
this.addEventListeners=function(type, listener)
{
var id=System.getUniqueId(); _eventListeners[type]?
_eventListeners[type][id]=listener:_eventListeners[type]={id:listener};
}
this.dispatchEvent=function(type)
{
if(this[type])this[type](); if("object"==typeof(_eventListeners[type])){
for(var i in _eventListeners[type])_eventListeners[type][i].call(this);}
}
this.getHashCode=function()
{
if(!this.hashCode)this.index=this.hashCode=System.getUniqueId();
System.instances[this.hashCode]=this; return this.hashCode;
}
this.toString=function(){return "[object "+(this.className||"Object")+"]";}
};
System.instances={};
System.container={"System":System.Object,"System.Object":System.Object};
System.existences={"System":System.mapPath("System"), "System.Object":System.mapPath("System.Object")};
System.Object.equals=function(class1, class2)
{
return typeof(class1.hashCode)!="undefined"&&
typeof(class2.hashCode)!="undefined"&&
class1.hashCode==class2.hashCode;
};
if(window.opera) Include("System.Plugins.Opera"); //Opera support
//if(System.ie) Include("System.Plugins.IE"); //IE UserData
Include("System.Global");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -