📄 ssfx.core.js
字号:
Type.createNamespace('ScriptFX');ScriptFX.CollectionChangedAction=function(){};ScriptFX.CollectionChangedAction.prototype = {add:0,remove:1,reset:2}ScriptFX.CollectionChangedAction.createEnum('ScriptFX.CollectionChangedAction',false);ScriptFX.$create__Core$0=function(eventType,sender,eventArgs,eventCookie){var $o={};$o.$1=eventType;$o.$0=sender;$o.$2=eventArgs;$o.$3=eventCookie;return $o;}ScriptFX.IEventManager=function(){};ScriptFX.IEventManager.createInterface('ScriptFX.IEventManager');ScriptFX.ISupportInitialize=function(){};ScriptFX.ISupportInitialize.createInterface('ScriptFX.ISupportInitialize');ScriptFX.INotifyDisposing=function(){};ScriptFX.INotifyDisposing.createInterface('ScriptFX.INotifyDisposing');ScriptFX.HostName=function(){};ScriptFX.HostName.prototype = {other:0,IE:1,mozilla:2,safari:3,opera:4}ScriptFX.HostName.createEnum('ScriptFX.HostName',false);ScriptFX.INotifyCollectionChanged=function(){};ScriptFX.INotifyCollectionChanged.createInterface('ScriptFX.INotifyCollectionChanged');ScriptFX.INotifyPropertyChanged=function(){};ScriptFX.INotifyPropertyChanged.createInterface('ScriptFX.INotifyPropertyChanged');ScriptFX.ITask=function(){};ScriptFX.ITask.createInterface('ScriptFX.ITask');ScriptFX.IObjectWithOwner=function(){};ScriptFX.IObjectWithOwner.createInterface('ScriptFX.IObjectWithOwner');ScriptFX.Application=function(){this.$9=[];this.$A=100;ScriptHost.add_load(Delegate.create(this,this.$18));ScriptHost.add_unload(Delegate.create(this,this.$19));this.$12=Delegate.create(this,this.$1C);window.attachEvent('onbeforeunload',this.$12);this.$13=Delegate.create(this,this.$1B);window.attachEvent('onerror',this.$13);var $0=document.documentElement;var $1=$0.className;if($1.startsWith('$')){var $2=this.get_host();$1=$1.replace('$browser',Enum.toString(ScriptFX.HostName,$2.get_name()));$1=$1.replace('$majorver',$2.get_majorVersion().toString());$1=$1.replace('$minorver',$2.get_minorVersion().toString());$0.className=$1;}}ScriptFX.Application.prototype={$0:null,$1:0,$2:null,$3:false,$4:false,$5:false,$6:null,$7:null,$8:null,$9:null,$A:0,$B:0,$C:null,$D:0,$E:null,$F:null,$10:null,$11:null,$12:null,$13:null,$14:null,$15:null,get_domain:function(){return window.document.domain;},set_domain:function(value){window.document.domain=value;return value;},get_$16:function(){if(!this.$8){this.$8=new ScriptFX.EventList();}return this.$8;},get_history:function(){return this.$7;},get_host:function(){if(!this.$0){this.$0=new ScriptFX.HostInfo();}return this.$0;},get_idleFrequency:function(){return this.$A;},set_idleFrequency:function(value){this.$A=value;return value;},get_isFirstLoad:function(){return this.$5;},get_isIE:function(){if(!this.$1){this.$1=(this.get_host().get_name()===1)?1:-1;}return (this.$1===1)?true:false;},get_sessionState:function(){return this.$6;},add_error:function(value){this.get_$16().addHandler('error',value);},remove_error:function(value){this.get_$16().removeHandler('error',value);},add_idle:function(value){this.get_$16().addHandler('idle',value);if(!this.$B){if(!this.$14){this.$14=Delegate.create(this,this.$17);}this.$B=window.setTimeout(this.$14,this.$A);}},remove_idle:function(value){var $0=this.get_$16().removeHandler('idle',value);if((!$0)&&(this.$B)){window.clearTimeout(this.$B);this.$B=0;}},add_load:function(value){if(this.$3){value.invoke(this,EventArgs.Empty);}else{this.get_$16().addHandler('load',value);}},remove_load:function(value){this.get_$16().removeHandler('load',value);},add_unload:function(value){this.get_$16().addHandler('unload',value);},remove_unload:function(value){this.get_$16().removeHandler('unload',value);},add_unloading:function(value){this.get_$16().addHandler('unloading',value);},remove_unloading:function(value){this.get_$16().removeHandler('unloading',value);},addTask:function(task){if(!this.$C){this.$C=[];}this.$C.enqueue(task);if(!this.$D){if(!this.$15){this.$15=Delegate.create(this,this.$1A);}this.$D=window.setTimeout(this.$15,0);}},enableHistory:function(){if(this.$7){return;}this.$7=ScriptFX.HistoryManager.$8();},getService:function(serviceType){if((serviceType===IServiceContainer)||(serviceType===ScriptFX.IEventManager)){return this;}if(this.$11){var $0=serviceType.get_fullName().replace('.','$');return this.$11[$0];}return null;},$17:function(){this.$B=0;var $0=this.get_$16().getHandler('idle');if($0){$0.invoke(this,EventArgs.Empty);this.$B=window.setTimeout(this.$14,this.$A);}},$18:function($p0,$p1){var $0=$('__session');if($0){var $2=$0.value;if(String.isNullOrEmpty($2)){this.$5=true;this.$6={};}else{this.$6=ScriptFX.JSON.deserialize($2);if(isUndefined(this.$6['__appLoaded'])){this.$5=true;}}this.$6['__appLoaded']=true;}else{this.$5=true;}if(this.$2){for(var $3=0;$3<this.$2.length;$3+=2){this.$2[$3].main(this.$2[$3+1]);}this.$2=null;}this.$3=true;var $1=this.get_$16().getHandler('load');if($1){$1.invoke(this,EventArgs.Empty);}if(this.$7){this.$7.$A();}},$19:function($p0,$p1){if(!this.$4){this.$4=true;if(this.$D){window.clearTimeout(this.$D);}if(this.$B){window.clearTimeout(this.$B);}var $0=this.get_$16().getHandler('unload');if($0){$0.invoke(this,EventArgs.Empty);}if(this.$C){while(this.$C.length){var $1=this.$C.dequeue();if(Type.canCast($1,IDisposable)){($1).dispose();}}}if(this.$9.length){var $enum1=this.$9.getEnumerator();while($enum1.moveNext()){var $2=$enum1.get_current();$2.dispose();}this.$9.clear();}if(this.$7){this.$7.dispose();this.$7=null;}window.detachEvent('onbeforeunload',this.$12);window.detachEvent('onerror',this.$13);this.$12=null;this.$13=null;this.$15=null;this.$14=null;}},$1A:function(){this.$D=0;if(this.$C.length){var $0=this.$C.dequeue();if(!$0.execute()){this.$C.enqueue($0);}else{if(Type.canCast($0,IDisposable)){($0).dispose();}}if(this.$C.length){this.$D=window.setTimeout(this.$15,0);}}},$1B:function(){var $0=this.get_$16().getHandler('error');if($0){var $1=new ScriptFX.CancelEventArgs();$1.set_canceled(true);$0.invoke(this,$1);if($1.get_canceled()){window.event.returnValue=false;}}},$1C:function(){var $0=this.get_$16().getHandler('unloading');if($0){var $1=new ScriptFX.ApplicationUnloadingEventArgs();$0.invoke(this,$1);}if(this.$6){var $2=$('__session');$2.value=ScriptFX.JSON.serialize(this.$6);}},raiseEvent:function(eventType,sender,e){if(this.$E){var $0=this.$E[eventType];if($0){$0.invoke(sender,e);}}},registerDisposableObject:function(disposableObject){if(!this.$4){this.$9.add(disposableObject);}},registerEvent:function(eventType,sender,e){if(this.$E){var $1=this.$E[eventType];if($1){$1.invoke(sender,e);}}if(!this.$10){this.$10=[];}if(!this.$F){this.$F={};this.$F[eventType]=1;}else{var $2=this.$F[eventType];if(isUndefined($2)){this.$F[eventType]=1;}else{this.$F[eventType]=1+$2;}}var $0=ScriptFX.$create__Core$0(eventType,sender,e,this.$10.length);this.$10.add($0);return $0.$3;},registerEventHandler:function(eventType,handler){var $0=null;if(!this.$E){this.$E={};}else{$0=this.$E[eventType];}this.$E[eventType]=Delegate.combine($0,handler);if(!isNullOrUndefined(this.$F[eventType])){var $enum1=this.$10.getEnumerator();while($enum1.moveNext()){var $1=$enum1.get_current();if(!$1){continue;}if($1.$1===eventType){handler.invoke($1.$0,$1.$2);}}}},registerService:function(serviceType,service){if(!this.$11){this.$11={};}var $0=serviceType.get_fullName().replace('.','$');this.$11[$0]=service;},run:function(scriptletType,args){if(this.$3){scriptletType.main(args);}else{if(!this.$2){this.$2=[];}this.$2.add(scriptletType);this.$2.add(args);}},unregisterDisposableObject:function(disposableObject){if(!this.$4){this.$9.remove(disposableObject);}},unregisterEvent:function(eventCookie){var $0=this.$10[eventCookie];var $1=this.$F[$0.$1];if($1===1){delete this.$F[$0.$1];}else{this.$F[$0.$1]=$1-1;}this.$10[eventCookie]=null;},unregisterEventHandler:function(eventType,handler){if(this.$E){var $0=this.$E[eventType];if($0){$0=Delegate.remove($0,handler);if(!$0){delete this.$E[eventType];}else{this.$E[eventType]=$0;}}}},unregisterService:function(serviceType){if(this.$11){var $0=serviceType.get_fullName().replace('.','$');delete this.$11[$0];}}}ScriptFX.CancelEventArgs=function(){ScriptFX.CancelEventArgs.constructBase(this);}ScriptFX.CancelEventArgs.prototype={$1_0:false,get_canceled:function(){return this.$1_0;},set_canceled:function(value){this.$1_0=value;return value;}}ScriptFX.CollectionChangedEventArgs=function(action,item){ScriptFX.CollectionChangedEventArgs.constructBase(this);this.$1_0=action;this.$1_1=item;}ScriptFX.CollectionChangedEventArgs.prototype={$1_0:0,$1_1:null,get_action:function(){return this.$1_0;},get_item:function(){return this.$1_1;}}ScriptFX.ApplicationUnloadingEventArgs=function(){ScriptFX.ApplicationUnloadingEventArgs.constructBase(this);}ScriptFX.ApplicationUnloadingEventArgs.prototype={setUnloadPrompt:function(prompt){window.event.returnValue = prompt;}}ScriptFX.HistoryManager=function(enabled,iframe){this.$0=enabled;this.$1=iframe;}ScriptFX.HistoryManager.$8=function(){var $0=ScriptFX.Application.current.get_host().get_name();if(($0!==1)&&($0!==2)){return new ScriptFX.HistoryManager(false,null);}var $1=null;if($0===1){$1=$('_historyFrame');}return new ScriptFX.HistoryManager(true,$1);}ScriptFX.HistoryManager.prototype={$0:false,$1:null,$2:null,$3:null,$4:false,$5:false,$6:null,get_isEnabled:function(){return this.$0;},add_navigated:function(value){this.$7=Delegate.combine(this.$7,value);},remove_navigated:function(value){this.$7=Delegate.remove(this.$7,value);},$7:null,addEntry:function(entryName){if(!this.$0){return;}this.$4=true;if(this.$1){this.$5=true;this.$1.src=this.$2+entryName;}else{this.$E(entryName);}},dispose:function(){if(this.$1){this.$1.detachEvent('onload',this.$3);this.$1=null;}},$9:function(){var $0=window.location.hash;if(($0.length)&&($0.charAt(0)==='#')){$0=$0.substr(1);}return $0;},goBack:function(){window.history.back();},goForward:function(){window.history.forward();},$A:function(){if(!this.$0){return;}ScriptFX.Application.current.add_idle(Delegate.create(this,this.$B));if(this.$1){this.$2=this.$1.src+'?';this.$3=Delegate.create(this,this.$C);this.$1.attachEvent('onload',this.$3);}this.$6=this.$9();this.$D(this.$6);},$B:function($p0,$p1){var $0=this.$9();if($0!==this.$6){if(this.$4){return;}this.$6=$0;this.$D($0);}else{this.$4=false;}},$C:function(){var $0=this.$1.contentWindow.location.search;if(($0.length)&&($0.charAt(0)==='?')){$0=$0.substr(1);}this.$E($0);if(this.$5){this.$5=false;return;}this.$D($0);},$D:function($p0){if(this.$7){this.$7.invoke(this,new ScriptFX.HistoryEventArgs($p0));}},$E:function($p0){this.$6=$p0;window.location.hash=$p0;}}ScriptFX.HistoryEventArgs=function(entryName){ScriptFX.HistoryEventArgs.constructBase(this);this.$1_0=entryName;}ScriptFX.HistoryEventArgs.prototype={$1_0:null,get_entryName:function(){return this.$1_0;}}ScriptFX.HostInfo=function(){var $0=window.navigator.userAgent.toLowerCase();var $1=null;var $2;if(($2=$0.indexOf('opera'))>=0){this.$0=4;$1=$0.substr($2+6);}else if(($2=$0.indexOf('msie'))>=0){this.$0=1;$1=$0.substr($2+5);}else if(($2=$0.indexOf('safari'))>=0){this.$0=3;$1=$0.substr($2+7);}else if(($2=$0.indexOf('firefox'))>=0){this.$0=2;$1=$0.substr($2+8);}else if($0.indexOf('gecko')>=0){this.$0=2;$1=window.navigator.appVersion;}if($1){this.$1=parseFloat($1);this.$2=parseInt(this.$1);if(($2=$1.indexOf('.'))>=0){this.$3=parseInt($1.substr($2+1));}}}ScriptFX.HostInfo.prototype={$0:0,$1:0,$2:0,$3:0,get_majorVersion:function(){return this.$2;},get_minorVersion:function(){return this.$3;},get_name:function(){return this.$0;},get_version:function(){return this.$1;}}ScriptFX.EventList=function(){}ScriptFX.EventList.prototype={$0:null,addHandler:function(key,handler){if(!this.$0){this.$0={};}this.$0[key]=Delegate.combine(this.$0[key],handler);},getHandler:function(key){if(this.$0){return this.$0[key];}return null;},removeHandler:function(key,handler){if(this.$0){var $0=this.$0[key];if($0){var $1=Delegate.remove($0,handler);this.$0[key]=$1;return ($1);}}return false;}}ScriptFX.JSON=function(){}ScriptFX.JSON.deserialize=function(s){if(String.isNullOrEmpty(s)){return null;}if(!ScriptFX.JSON.$0){ScriptFX.JSON.$0=new RegExp('(\'|\")\\\\@(-?[0-9]+)@(\'|\")','gm');}s=s.replace(ScriptFX.JSON.$0,'new Date($2)');return eval('('+s+')');}ScriptFX.JSON.serialize=function(o){if(isNullOrUndefined(o)){return String.Empty;}var $0=new StringBuilder();ScriptFX.JSON.$1($0,o);return $0.toString();}ScriptFX.JSON.$1=function($p0,$p1){if(isNullOrUndefined($p1)){$p0.append('null');return;}var $0=typeof($p1);switch($0){case 'boolean':$p0.append($p1.toString());return;case 'number':$p0.append((isFinite($p1))?$p1.toString():'null');return;case 'string':$p0.append(($p1).quote());return;case 'object':if(Array.isInstance($p1)){$p0.append('[');var $1=$p1;var $2=$1.length;var $3=true;for(var $4=0;$4<$2;$4++){if($3){$3=false;}else{$p0.append(',');}ScriptFX.JSON.$1($p0,$1[$4]);}$p0.append(']');}else if(Date.isInstance($p1)){var $5=$p1;var $6=Date.UTC($5.getUTCFullYear(),$5.getUTCMonth(),$5.getUTCDate(),$5.getUTCHours(),$5.getUTCMinutes(),$5.getUTCSeconds(),$5.getUTCMilliseconds());$p0.append('\"\\@');$p0.append($6.toString());$p0.append('@\"');}else if(RegExp.isInstance($p1)){$p0.append($p1.toString());}else{$p0.append('{');var $7=true;var $dict1=$p1;for(var $key2 in $dict1){var $8={key:$key2,value:$dict1[$key2]};if(($8.key).startsWith('$')){continue;}if($7){$7=false;}else{$p0.append(',');}$p0.append($8.key);$p0.append(':');ScriptFX.JSON.$1($p0,$8.value);}$p0.append('}');}return;default:$p0.append('null');return;}}ScriptFX.PropertyChangedEventArgs=function(propertyName){ScriptFX.PropertyChangedEventArgs.constructBase(this);this.$1_0=propertyName;}ScriptFX.PropertyChangedEventArgs.prototype={$1_0:null,get_propertyName:function(){return this.$1_0;}}ScriptFX.ObservableCollection=function(owner,disposableItems){this.$0=owner;this.$1=[];this.$2=disposableItems;}ScriptFX.ObservableCollection.prototype={$0:null,$1:null,$2:false,$3:null,add_collectionChanged:function(value){this.$3=Delegate.combine(this.$3,value);},remove_collectionChanged:function(value){this.$3=Delegate.remove(this.$3,value);},add:function(item){(item).setOwner(this.$0);this.$1.add(item);if(this.$3){this.$3.invoke(this,new ScriptFX.CollectionChangedEventArgs(0,item));}},clear:function(){if(this.$1.length){var $enum1=this.$1.getEnumerator();while($enum1.moveNext()){var $0=$enum1.get_current();$0.setOwner(null);}this.$1.clear();if(this.$3){this.$3.invoke(this,new ScriptFX.CollectionChangedEventArgs(2,null));}}},contains:function(item){return this.$1.contains(item);},dispose:function(){if(this.$2){var $enum1=this.$1.getEnumerator();while($enum1.moveNext()){var $0=$enum1.get_current();$0.dispose();}}this.$1=null;this.$0=null;this.$3=null;},getEnumerator:function(){return this.$1.getEnumerator();},getItem:function(index){return this.$1[index];},getItems:function(){return this.$1;},getLength:function(){return this.$1.length;},remove:function(item){if(this.$1.contains(item)){(item).setOwner(null);this.$1.remove(item);if(this.$3){this.$3.invoke(this,new ScriptFX.CollectionChangedEventArgs(1,item));}}}}Type.createNamespace('ScriptFX.Net');ScriptFX.Net.HTTPStatusCode=function(){};ScriptFX.Net.HTTPStatusCode.prototype = {canContinue:100,switchingProtocols:101,OK:200,created:201,partialContent:206,accepted:202,nonAuthoritativeInformation:203,noContent:204,resetContent:205,ambiguous:300,moved:301,redirect:302,redirectMethod:303,notModified:304,useProxy:305,temporaryRedirect:307,badRequest:400,methodNotAllowed:400,unauthorized:401,paymentRequired:402,forbidden:403,notFound:404,notAcceptable:406,proxyAuthenticationRequired:407,requestTimeout:408,conflict:409,gone:410,lengthRequired:411,preconditionFailed:412,requestEntityTooLarge:413,requestUriTooLong:414,unsupportedMediaType:415,requestedRangeNotSatisfiable:416,expectationFailed:417,internalServerError:500,notImplemented:501,badGateway:502,serviceUnavailable:503,gatewayTimeout:504,httpVersionNotSupported:505}ScriptFX.Net.HTTPStatusCode.createEnum('ScriptFX.Net.HTTPStatusCode',false);ScriptFX.Net.HTTPRequestState=function(){};ScriptFX.Net.HTTPRequestState.prototype = {inactive:0,inProgress:1,completed:2,aborted:3,timedOut:4}ScriptFX.Net.HTTPRequestState.createEnum('ScriptFX.Net.HTTPRequestState',false);ScriptFX.Net.HTTPVerb=function(){};ScriptFX.Net.HTTPVerb.prototype = {GET:0,POST:1,PUT:2,DELETE:3}ScriptFX.Net.HTTPVerb.createEnum('ScriptFX.Net.HTTPVerb',false);ScriptFX.Net.IHTTPResponse=function(){};ScriptFX.Net.IHTTPResponse.createInterface('ScriptFX.Net.IHTTPResponse');ScriptFX.Net.HTTPRequest=function(){}ScriptFX.Net.HTTPRequest.createRequest=function(uri,verb){var $0=new ScriptFX.Net.HTTPRequest();if(!uri.startsWith('{')){$0.$0=uri;}else{var $1=ScriptFX.JSON.deserialize(uri);$0.$0=$1['__uri'];if($1['__nullParams']){$0.$6=$1['__transportType'];}else{$0.$6=Type.getType($1['__transportType']);delete $1.__uri;delete $1.__transportType;$0.$7=$1;}}$0.$1=verb;return $0;}ScriptFX.Net.HTTPRequest.createURI=function(uri,parameters){var $0=new StringBuilder(uri);if(uri.indexOf('?')<0){$0.append('?');}var $1=0;var $dict1=parameters;for(var $key2 in $dict1){var $2={key:$key2,value:$dict1[$key2]};if($1){$0.append('&');}$0.append($2.key);$0.append('=');$0.append(encodeURIComponent($2.value.toString()));$1++;}return $0.toString();}ScriptFX.Net.HTTPRequest.prototype={$0:null,$1:0,$2:null,$3:null,$4:null,$5:null,$6:null,$7:null,$8:0,$9:null,$A:null,$B:0,$C:null,$D:null,$E:null,get_content:function(){return this.$2;},set_content:function(value){this.$2=value;return value;},get_hasCredentials:function(){return (!String.isNullOrEmpty(this.$4));},get_hasHeaders:function(){return (this.$3);},get_headers:function(){if(!this.$3){this.$3={};}return this.$3;},get_password:function(){return this.$5;},get_response:function(){return this.$D;},get_state:function(){return this.$B;},get_timeout:function(){return this.$8;},set_timeout:function(value){this.$8=value;return value;},get_timeStamp:function(){return this.$E;},get_$F:function(){return this.$C;},get_$10:function(){return this.$7;},get_transportType:function(){return this.$6;},get_URI:function(){return this.$0;},get_userName:function(){return this.$4;},get_verb:function(){return this.$1;},abort:function(){if(this.$B===1){ScriptFX.Net.HTTPRequestManager.$5(this,false);}},dispose:function(){if(this.$C){this.abort();}},invoke:function(callback,context){this.$9=callback;this.$A=context;ScriptFX.Application.current.registerDisposableObject(this);ScriptFX.Net.HTTPRequestManager.$6(this);},$11:function(){ScriptFX.Application.current.unregisterDisposableObject(this);if(this.$C){this.$C.dispose();this.$C=null;}if(this.$9){this.$9.invoke(this,this.$A);this.$9=null;this.$A=null;}},$12:function(){this.$B=3;this.$11();},$13:function($p0){this.$C=$p0;this.$B=1;this.$E=new Date();},$14:function($p0){this.$D=$p0;this.$B=2;this.$11();},$15:function(){this.$B=4;this.$11();},setContentAsForm:function(data){this.get_headers()['Content-Type']='application/x-www-form-urlencoded';var $0=new StringBuilder();var $1=true;var $dict1=data;for(var $key2 in $dict1){var $2={key:$key2,value:$dict1[$key2]};if(!$1){$0.append('&');}$0.append($2.key);$0.append('=');$0.append(encodeURIComponent($2.value.toString()));$1=false;}this.set_content($0.toString());},setContentAsJSON:function(data){this.get_headers()['Content-Type']='text/json';this.set_content(ScriptFX.JSON.serialize(data));},setCredentials:function(userName,password){this.$4=userName;this.$5=password;}}ScriptFX.Net.HTTPRequestManager=function(){}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -