📄 atlas.js
字号:
function valueToString(value){for (var i in this){if (this[i]==value){return i;}}throw 'Invalid Enumeration Value';}this.create =function(){var enumeration ={};enumeration.getValues =getValues;enumeration.parse =valueFromString;enumeration.toString =valueToString;for (var i =0;i <arguments.length;i++){enumeration[arguments[i]]=i;}return enumeration;}}Web.Flags =new function(){function valueFromString(s){var parts =s.split('|');var value =0;for (var i =parts.length -1;i >=0;i--){var part =parts[i].trim();var found =false;for (var f in this){if (f ==part){value |=this[f];found =true;break;}}if (found ==false){throw 'Invalid Enumeration Value';}}return value;}function valueToString(value){var sb =new Web.StringBuilder();for (var i in this){if ((this[i]&value)!=0){if (sb.isEmpty()==false){sb.append(' | ');}sb.append(i);}}return sb.toString();}this.create =function(){var flags =new Object();flags.parse =valueFromString;flags.toString =valueToString;for (var i =0;i <arguments.length;i +=2){var name =arguments[i];var value =arguments[i +1];flags[name]=value;}return flags;}}Web.Attributes =new function(){this.defineAttribute =function(attributeName){this[attributeName]=attributeName;}}Web.IArray =function(){this.get_length =Function.abstractMethod;this.getItem =Function.abstractMethod;}Type.registerInterface("Web.IArray");Array.prototype.get_length =function(){return this.length;}Array.prototype.getItem =function(index){return this[index];}Array._interfaces =[];Array._interfaces.add(Web.IArray);Web.IDisposable =function(){this.dispose =Function.abstractMethod;}Type.registerInterface('Web.IDisposable');Web.StringBuilder =function(initialText){var _parts =new Array();if ((typeof(initialText)=='string')&&(initialText.length !=0)){_parts.add(initialText);}this.append =function(text){if ((text ==null)||(typeof(text)=='undefined')){return;}if ((typeof(text)=='string')&&(text.length ==0)){return;}_parts.add(text);}this.appendLine =function(text){this.append(text);_parts.add('\r\n');}this.clear =function(){_parts.clear();}this.isEmpty =function(){return (_parts.length ==0);}this.toString =function(delimiter){delimiter =delimiter ||'';return _parts.join(delimiter);}}Type.registerSealedClass('Web.StringBuilder');Web.Attributes.defineAttribute('Element');Web.TypeDescriptor =function(){var _properties ={};var _events ={};var _methods ={};var _attributes ={};this._getAttributes =function(){return _attributes;}this._getEvents =function(){return _events;}this._getMethods =function(){return _methods;}this._getProperties =function(){return _properties;}}Web.TypeDescriptor.prototype.addAttribute =function(attributeName,attributeValue){this._getAttributes()[attributeName]=attributeValue;}Web.TypeDescriptor.prototype.addEvent =function(eventName,supportsActions){this._getEvents()[eventName]={name:eventName,actions:supportsActions };}Web.TypeDescriptor.prototype.addMethod =function(methodName,associatedParameters){this._getMethods()[methodName]={name:methodName,parameters:associatedParameters };}Web.TypeDescriptor.prototype.addProperty =function(propertyName,propertyType,readOnly){if (!readOnly){readOnly =false;}var associatedAttributes;if (arguments.length >3){associatedAttributes ={};for (var i =3;i <arguments.length;i +=2){var attribute =arguments[i];var value =arguments[i +1];associatedAttributes[attribute]=value;}}this._getProperties()[propertyName]={name:propertyName,type:propertyType,isReadOnly:readOnly,attributes:associatedAttributes };}Web.TypeDescriptor.addType =function(tagPrefix,tagName,type){if (!Web.TypeDescriptor._registeredTags){Web.TypeDescriptor._registeredTags ={};}var tagTable =Web.TypeDescriptor._registeredTags[tagPrefix];if (!tagTable){tagTable ={};Web.TypeDescriptor._registeredTags[tagPrefix]=tagTable;}tagTable[tagName]=type;}Web.TypeDescriptor.createParameter =function(parameterName,parameterType){return {name:parameterName,type:parameterType };}Web.TypeDescriptor.getType =function(tagPrefix,tagName){if (Web.TypeDescriptor._registeredTags){var tagNameTable =Web.TypeDescriptor._registeredTags[tagPrefix];if (tagNameTable){return tagNameTable[tagName];}}return null;}Web.TypeDescriptor.getTypeDescriptor =function(instance){var type =Object.getType(instance);var td =type._descriptor;if (!td){td =instance.getDescriptor();type._descriptor =td;}return td;}Web.TypeDescriptor.initializeInstance =function(instance,node,markupContext){var td =Web.TypeDescriptor.getTypeDescriptor(instance);if (!td){return null;}var supportsBatchedUpdates =false;if (Web.ISupportBatchedUpdates.isImplementedBy(instance)){supportsBatchedUpdates =true;instance.beginUpdate();}var i,a;var attr,attrName;var propertyInfo,propertyName,propertyType,propertyValue;var eventInfo,eventValue;var setter,getter;var properties =td._getProperties();var events =td._getEvents();var attributes =node.attributes;if (attributes){for (a =attributes.length -1;a >=0;a--){attr =attributes[a];attrName =attr.nodeName;propertyInfo =properties[attrName];if (propertyInfo){propertyType =propertyInfo.type;propertyValue =attr.nodeValue;var delayedSet =false;if (propertyType ==Object){var elementsOnly =(propertyInfo.attributes &&propertyInfo.attributes[Web.Attributes.Element]);if (!elementsOnly){markupContext.addReference(instance,propertyInfo,propertyValue);delayedSet =true;}else {propertyValue =markupContext.findObject(propertyValue,elementsOnly);}}if (!delayedSet){propertyName =propertyInfo.name;setter =instance['set_'+propertyName];if (propertyType !=Object){if (propertyType ==Array){propertyValue =Array.parse('['+propertyValue +']');}else if (propertyType !=String){propertyValue =propertyType.parse(propertyValue);}}setter.call(instance,propertyValue);}}else {eventInfo =events[attrName];if (eventInfo){var handler =Function.parse(attr.nodeValue);if (handler){eventValue =instance[eventInfo.name];eventValue.add(handler);}}}}}var childNodes =node.childNodes;if (childNodes &&(childNodes.length !=0)){for (i =childNodes.length -1;i >=0;i--){var childNode =childNodes[i];var nodeName =childNode.baseName;propertyInfo =properties[nodeName];if (propertyInfo){propertyName =propertyInfo.name;propertyType =propertyInfo.type;if (propertyInfo.isReadOnly){getter =instance['get_'+propertyName];var nestedObject =getter.call(instance);if (propertyType ==Array){if (childNode.childNodes.length !=0){var items =Web.TypeDescriptor.processMarkupNodes(childNode.childNodes,markupContext);for (var itemIndex =0;itemIndex <items.length;itemIndex++){nestedObject.add(items[itemIndex]);}}}else if (propertyType ==Object){attributes =childNode.attributes;for (a =attributes.length -1;a >=0;a--){attr =attributes[a];nestedObject[attr.nodeName]=attr.nodeValue;}}else {Web.TypeDescriptor.initializeInstance(nestedObject,childNode,markupContext);}}else {propertyValue =null;if (propertyType ==String){propertyValue =childNode.text;}else if (childNode.childNodes.length !=0){var valueNode;for (var childNodeIndex =0;childNodeIndex <childNode.childNodes.length;childNodeIndex++){if (childNode.childNodes[childNodeIndex].nodeType !=1){continue;}valueNode =childNode.childNodes[childNodeIndex];break;}if (valueNode){propertyValue =Web.TypeDescriptor.processMarkupNode(valueNode,markupContext);}}if (propertyValue){setter =instance['set_'+propertyName];setter.call(instance,propertyValue);}}}else {eventInfo =events[nodeName];if (eventInfo &&eventInfo.actions){var actions =Web.TypeDescriptor.processMarkupNodes(childNode.childNodes,markupContext);if (actions.length){eventValue =instance[eventInfo.name];for (var e =0;e <actions.length;e++){eventValue.addAction(actions[e]);}}}}}}if (supportsBatchedUpdates){markupContext.addEndUpdate(instance);}return instance;}Web.TypeDescriptor.processMarkupNode =function(node,markupContext){var parsedObject =null;var tagPrefix =node.prefix;if (!tagPrefix ||(tagPrefix.length ==0)){tagPrefix ='script';}var tagName =node.baseName;var tagType =Web.TypeDescriptor.getType(tagPrefix,tagName);if (tagType){var parseMethod =tagType.parseFromMarkup;if (!parseMethod){var baseType =tagType.getBaseType();while (baseType){parseMethod =baseType.parseFromMarkup;if (parseMethod){break;}baseType =baseType.getBaseType();}tagType.parseFromMarkup =parseMethod;}if (parseMethod){parsedObject =parseMethod.call(null,tagType,node,markupContext);}}return parsedObject;}Web.TypeDescriptor.processMarkupNodes =function(nodes,markupContext){var objects =[];for (var i =0;i <nodes.length;i++){var objectNode =nodes[i];if (objectNode.nodeType !=1){continue;}var processedObject =this.processMarkupNode(objectNode,markupContext);if (processedObject){objects.add(processedObject);}}return objects;}Web.TypeDescriptor.unload =function(){if (Web.TypeDescriptor._registeredTags){Web.TypeDescriptor._registeredTags =null;}}Web.TypeDescriptor.getAttribute =function(instance,attributeName){var td =Web.TypeDescriptor.getTypeDescriptor(instance);if (!td){return null;}return td._getAttributes()[attributeName];}Web.TypeDescriptor.getProperty =function(instance,propertyName,key){if (Web.ICustomTypeDescriptor.isImplementedBy(instance)){return instance.getProperty(propertyName,key);}if ((propertyName ==null)||(propertyName.length ==0)){return instance;}var td =Web.TypeDescriptor.getTypeDescriptor(instance);if (!td){return null;}var propertyInfo =td._getProperties()[propertyName];if (!propertyInfo){return null;}var getter =instance['get_'+propertyInfo.name];var object =getter.call(instance);if ((propertyInfo.type ==Object)&&propertyInfo.isReadOnly &&key){object =object[key];}return object;}Web.TypeDescriptor.setProperty =function(instance,propertyName,value,key){if (Web.ICustomTypeDescriptor.isImplementedBy(instance)){instance.setProperty(propertyName,value,key);return;}var td =Web.TypeDescriptor.getTypeDescriptor(instance);if (td){var propertyInfo =td._getProperties()[propertyName];if (propertyInfo){if (!propertyInfo.isReadOnly){if ((propertyInfo.type !=String)&&(typeof(value)=='string')&&propertyInfo.type.parse){value =propertyInfo.type.parse(value);}var setter =instance['set_'+propertyInfo.name];setter.call(instance,value);}else if ((propertyInfo.type ==Object)&&key){var getter =instance['get_'+propertyInfo.name];var object =getter.call(instance);object[key]=value;}}}}Web.TypeDescriptor.invokeMethod =function(instance,methodName,parameters){if (Web.ICustomTypeDescriptor.isImplementedBy(instance)){return instance.invokeMethod(methodName,parameters);}var td =Web.TypeDescriptor.getTypeDescriptor(instance);if (td){var methodInfo =td._getMethods()[methodName];if (methodInfo){var method =instance[methodInfo.name];if (!methodInfo.parameters ||!methodInfo.parameters.length){return method.call(instance);}else {if (!parameters){return null;}var arguments =[];for (var i =0;i <methodInfo.parameters.length;i++){var parameterInfo =methodInfo.parameters[i];var value =parameters[parameterInfo.name];if (value &&(parameterInfo.type !=String)&&(typeof(value)=='string')){value =parameterInfo.type.parse(value);}arguments[i]=value;}return method.apply(instance,arguments);}}}return null;}Web.TypeDescriptor.getPropertyType =function(instance,propertyName,key){if (Web.ICustomTypeDescriptor.isImplementedBy(instance)){return Object;}if (key){return Object;}var td =Web.TypeDescriptor.getTypeDescriptor(instance);if (!td){return null;}var propertyInfo =td._getProperties()[propertyName];if (!propertyInfo){return null;}return propertyInfo.type;}Web.TypeDescriptor.MarkupContext =function(document,global,parentContext,dataContext){var _document =document;var _global =global;var _parentContext =parentContext;var _dataContext =dataContext;var _dataContextHidden;var _objects ={};var _pendingReferences =[];var _pendingEndUpdates =[];this.get_dataContext =function(){if (_dataContextHidden){return null;}return _dataContext;}this.get_document =function(){return _document;}this.get_isGlobal =function(){return _global;}this.addObject =function(id,object){_objects[id]=object;}this.addEndUpdate =function(instance){_pendingEndUpdates.add(instance);}this.addReference =function(instance,propertyInfo,reference){_pendingReferences.add({o:instance,p:propertyInfo,r:reference });}this.complete =function(){_document =null;_dataContext =null;var i;for (i =0;i <_pendingReferences.length;i++){var pendingReference =_pendingReferences[i];var instance =pendingReference.o;var propertyInfo =pendingReference.p;var propertyValue =pendingReference.r;var object =this.findObject(propertyValue,false);if (object){var setter =instance['set_'+propertyInfo.name];setter.call(instance,object);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -