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

📄 atlasruntime.js

📁 《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含的源代码.非常经典的一本asp.net2.0的书籍
💻 JS
📖 第 1 页 / 共 4 页
字号:
//-----------------------------------------------------------------------// Copyright (C) Microsoft Corporation. All rights reserved.//-----------------------------------------------------------------------// AtlasRuntime.js// Atlas Runtime Framework.Function.abstractMethod =function(){throw 'Abstract method should be implemented';}Function.createCallback =function(method,context){return function(){method(context);}}Function.createCallbackWithArguments =function(method,context){return function(){var args =[];for (var i =2;i <arguments.length;i++){args.add(arguments[i]);}args.add(context);method.apply(null,args);}}Function.createDelegate =function(instance,method){return function(){method.apply(instance,arguments);}}Function.emptyMethod =function(){}Function.prototype.getBaseMethod =function(instance,methodName){var baseMethod =null;var baseType =this.getBaseType();if (baseType){var directBaseType =baseType;if (instance._baseMethods){while (baseType){var methodKey =baseType.getName()+'.'+methodName;var method =instance._baseMethods[methodKey];if (method){return method;}baseType =baseType._baseType;}}if (!baseMethod){return directBaseType.prototype[methodName];}}return null;}Function.prototype.getBaseType =function(){return this._baseType;}Function.prototype.getName =function(){return this._typeName;}Function.parse =function(functionName){var fn =null;try {eval('fn = '+functionName);if (typeof(fn)!='function'){fn =null;}}catch (ex){}return fn;}Function.prototype._processBaseType =function(){if (this._basePrototypePending){var baseType =this._baseType;baseType._processBaseType();for (var memberName in baseType.prototype){var memberValue =baseType.prototype[memberName];if (!this.prototype[memberName]){this.prototype[memberName]=memberValue;}}delete this._basePrototypePending;}}Function.prototype.callBaseMethod =function(instance,methodName,baseArguments){var baseMethod =this.getBaseMethod(instance,methodName);if (baseMethod){if (!baseArguments){return baseMethod.apply(instance);}else {return baseMethod.apply(instance,baseArguments);}}return null;}Function.prototype.implementsInterface =function(interfaceType){var interfaces =this._interfaces;if (interfaces){if (interfaces.contains(interfaceType)){return true;}}var baseType =this._baseType;while (baseType){interfaces =baseType._interfaces;if (interfaces){if (interfaces.contains(interfaceType)){return true;}}baseType =baseType._baseType;}return false;}Function.prototype.inheritsFrom =function(parentType){var baseType =this._baseType;while (baseType){if (baseType ==parentType){return true;}baseType =baseType._baseType;}return false;}Function.prototype.initializeBase =function(instance,baseArguments){this._processBaseType();if (this._interfaces){for (var i =0;i <this._interfaces.length;i++){this._interfaces[i].call(instance);}}if (this._baseType){if (!baseArguments){this._baseType.apply(instance);}else {this._baseType.apply(instance,baseArguments);}}return instance;}Function.prototype.isImplementedBy =function(instance){if (!instance)return false;var instanceType =Object.getType(instance);return instanceType.implementsInterface(this);}Function.prototype.isInstanceOfType =function(instance){if (typeof(instance)=='undefined'||instance ==null){return false;}if (instance instanceof this){return true;}var instanceType =Object.getType(instance);if (instanceType ==this){return true;}return instanceType.inheritsFrom(this);}Function.prototype.registerBaseMethod =function(instance,methodName){if (!instance._baseMethods){instance._baseMethods ={};}var methodKey =this.getName()+'.'+methodName;instance._baseMethods[methodKey]=instance[methodName];}Function.createInstance =function(type){if (typeof(type)!='function'){type =Function.parse(type);}return new type();}Function.registerClass =function(typeName,baseType,interfaceType){var type =Function.parse(typeName);if (window.__safari){eval(typeName +'.prototype.constructor = '+typeName +';');}type._typeName =typeName;if (baseType){type._baseType =baseType;type._basePrototypePending =true;}if (interfaceType){type._interfaces =[];for (var i =2;i <arguments.length;i++){interfaceType =arguments[i];type._interfaces.add(interfaceType);}}return type;}Function.registerAbstractClass =function(typeName,baseType){var type =Type.registerClass.apply(null,arguments);type._abstract =true;return type;}Function.registerSealedClass =function(typeName,baseType){var type =Type.registerClass.apply(null,arguments);type._sealed =true;return type;}Function.registerInterface =function(typeName){var type =Function.parse(typeName);type._typeName =typeName;type._interface =true;type._abstract =true;type._sealed =true;return type;}Function.registerNamespace =function(namespacePath){var rootObject =window;var namespaceParts =namespacePath.split('.');for (var i =0;i <namespaceParts.length;i++){var currentPart =namespaceParts[i];if (!rootObject[currentPart]){rootObject[currentPart]=new Object();}rootObject =rootObject[currentPart];}}Function._typeName ='Function';window.Type =Function;Object.getType =function(instance){return instance.constructor;}Object._typeName ='Object';Boolean.parse =function(value){if (typeof(value)=='string'){return (value.toLowerCase()=='true');}return value ?true :false;}Number.parse =function(value){if (!value ||(value.length ==0)){return 0;}return parseFloat(value);}Number._typeName ='Number';String.prototype.endsWith =function(suffix){return (this.substr(this.length -suffix.length)==suffix);}String.prototype.startsWith =function(prefix){return (this.substr(0,prefix.length)==prefix);}String.prototype.trimLeft =function(){return this.replace(/^\s*/,"");}String.prototype.trimRight =function(){return this.replace(/\s*$/,"");}String.prototype.trim =function(){return this.trimRight().trimLeft();}String.format =function(format){for (var i =1;i <arguments.length;i++){format =format.replace("{"+(i -1)+"}",arguments[i]);}return format;}String._typeName ='String';Array.prototype.add =function(item){this.push(item);}Array.prototype.addRange =function(items){var length =items.length;if (length !=0){for (var index =0;index <length;index++){this.push(items[index]);}}}Array.prototype.clear =function(){if (this.length >0){this.splice(0,this.length);}}Array.prototype.clone =function(){var clonedArray =[];var length =this.length;for (var index =0;index <length;index++){clonedArray[index]=this[index];}return clonedArray;}Array.prototype.contains =function(item){var index =this.indexOf(item);return (index >=0);}Array.prototype.dequeue =function(){return this.shift();}Array.prototype.indexOf =function(item){var length =this.length;if (length !=0){for (var index =0;index <length;index++){if (this[index]==item){return index;}}}return -1;}Array.prototype.insert =function(index,item){this.splice(index,0,item);}Array.prototype.queue =function(item){this.push(item);}Array.prototype.remove =function(item){var index =this.indexOf(item);if (index >=0){this.splice(index,1);}}Array.prototype.removeAt =function(index){this.splice(index,1);}Array._typeName ='Array';Array.parse =function(value){return eval('('+value +')');}RegExp.parse =function(value){if (value.startsWith('/')){var endSlashIndex =value.lastIndexOf('/');if (endSlashIndex >1){var expression =value.substring(1,endSlashIndex);var flags =value.substr(endSlashIndex +1);return new RegExp(expression,flags);}}return null;}RegExp._typeName ='RegExp';Date._typeName ='Date';Date.prototype.serialize =function(){var stringBuilder =new Web.StringBuilder();stringBuilder.append('new Date(');stringBuilder.append(Date.UTC(this.getUTCFullYear(),this.getUTCMonth(),this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds(),this.getUTCMilliseconds()));stringBuilder.append(')');return stringBuilder.toString();}Type.registerNamespace('Web');Web._Debug =function(){this.assert =function(condition,message,displayCaller){if (!condition){message ='Assertion Failed: '+message +(displayCaller ?'\r\nat '+this.assert.caller :'');if (confirm(message +'\r\n\r\nBreak into debugger?')){this.fail(message);}}}this.clearTrace =function(){var traceElement =document.getElementById('__atlas_trace');if (traceElement){var children =traceElement.childNodes;for(var i =children.length -2;i >0;i--){traceElement.removeChild(children[i]);}document.getElementById('__atlas_trace').style.display ='none';}}this.dump =function(object,name,recursive,indentationPadding,loopArray){name =name ?name :'';indentationPadding =indentationPadding ?indentationPadding :'';if (object ==null){this.trace(indentationPadding +name +': null');return;}switch(typeof(object)){case 'undefined':this.trace(indentationPadding +name +': Undefined');break;case 'number':case 'string':case 'boolean':this.trace(indentationPadding +name +': '+object);break;default:if (!loopArray){loopArray =[];}else if (loopArray.contains(object)){this.trace(indentationPadding +name +': ...');return;}loopArray.add(object);var type =Object.getType(object);if (type !=null){var typeName =type.getName();this.trace(indentationPadding +name +(typeof(typeName)=='string'?' {'+typeName +'}':''));if ((indentationPadding =='')||recursive){indentationPadding +='+';var i,length,properties,p,v;if (Web.IArray.isImplementedBy(object)){length =object.get_length();for (i =0;i <length;i++){this.dump(object.getItem(i),'['+i +']',recursive,indentationPadding,loopArray);}}if (Web.ITypeDescriptorProvider.isImplementedBy(object)){var td =Web.TypeDescriptor.getTypeDescriptor(object);properties =td._getProperties();for (p in properties){var propertyInfo =properties[p];if (propertyInfo.name){v =Web.TypeDescriptor.getProperty(object,propertyInfo.name);this.dump(v,p,recursive,indentationPadding,loopArray);}}}else {for (p in object){v =object[p];if (!Function.isInstanceOfType(v)&&!Web.Event.isInstanceOfType(v)){this.dump(v,p,recursive,indentationPadding,loopArray);}}}}}else {var tagName =object.tagName;var attributes =object.attributes;if (tagName &&attributes){this.trace(indentationPadding +name +' {'+tagName +'}');indentationPadding +='+';length =attributes.length;for (var i =0;i <length;i++){var val =attributes[i].nodeValue;if (val){this.dump(val,attributes[i].nodeName,recursive,indentationPadding,loopArray);}}}else {this.trace('Unknown object');}}loopArray.remove(object);}}this.fail =function(message){Debug.breakIntoDebugger(message);}this.trace =function(text){Debug.writeln(text);var traceElement =document.getElementById('__atlas_trace');if (!traceElement){traceElement =document.createElement('FIELDSET');traceElement.id ='__atlas_trace';traceElement.style.backgroundColor ='white';traceElement.style.color ='black';traceElement.style.textAlign ='left';traceElement.style.font ='normal normal normal 1em/1.1em verdana,sans-serif';var legend =document.createElement('LEGEND');var legendText =document.createTextNode('Debugging Trace');legend.appendChild(legendText);traceElement.appendChild(legend);var clearButton =document.createElement('INPUT');clearButton.type ='button';clearButton.value ='Clear Trace';clearButton.onclick =debug.clearTrace;traceElement.appendChild(clearButton);document.body.appendChild(traceElement);}var traceLine =document.createElement('DIV');traceLine.innerHTML =text;traceElement.insertBefore(traceLine,traceElement.childNodes[traceElement.childNodes.length -1]);traceElement.style.display ='block';}}window.debug =new Web._Debug();Web.Enum =new function(){function getValues(){if (!this._values){var values ={};for (var f in this){if (typeof(this[f])!='function'){values[f]=this[f];}}this._values =values;}return this._values;}function valueFromString(s){for (var f in this){if (f ==s){return this[f];}}throw 'Invalid Enumeration Value';}function valueToString(value){for (var i in this){if (this[i]==value){return i;}}

⌨️ 快捷键说明

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