?? core.lib.js
字號:
Function.prototype.Bind=function(obj){var method=this;temp=function(){return method.apply(obj,arguments);};return temp;};Function.prototype.Extends=function(Class){if(!Class||!Class.constructor)return;var re=/^function\s+(\S+)\s*\(/;var c=re.exec(Class.constructor.toString());var _Class;if(Class=c&&c[1]&&(_Class=eval(c[1])).prototype){if(!_Class.__super__)_Class.__super__={};c=re.exec(this.toString());if(_Class.__super__[c[1]])return;_Class.__super__[c[1]]=this;this.apply(Class);for(var item in this.prototype){if(!Class[item]){Class[item]=this.prototype[item];}}}};Function.prototype.Rebuild=function(args,addon){var r=';var r_'+Math.floor(r=Math.random())+'='+r+';';var f=(f=this.toString()).substring(f.indexOf('{')+1,f.lastIndexOf('}'));var args=args.length>0?"'"+args.join("','")+"',":'';return eval('new Function ('+args+'addon + ";" + f + r)');};?
function oAjax(){this.req=null;this.url='';this.content='';this.type='text';this.encode='';this.asyn=true;this.action='get';this.error=false;}
oAjax.prototype.init=function(){if(window.XMLHttpRequest){this.req=new XMLHttpRequest();}
else if(window.ActiveXObject){try{this.req=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{this.req=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){this.req=false;}}}
var self=this;if(this.req){this.req.onreadystatechange=function(){self.listener()};}};oAjax.prototype.listener=function(){if(this.req.readyState==4){if(this.req.status==200){try{this.callback(Browser.IsIE&&this.encode=='gb2312'?oAjax.gb2utf8(this.req.responseBody):(this.type=='text'?this.req.responseText:this.req.responseXML));}
catch(e){this.halt('[callback] '+e.name+':'+e.message);}}
else{this.halt('[callback error] '+this.req.status);}}};oAjax.prototype.send=function(url){this.init();url=this.url=url||this.url||'';this.content=!!this.content?this.content:'';this.encode=this.encode?this.encode.toLowerCase():'';this.asyn=this.asyn==undefined?true:!!this.asyn;this.action=(this.action==undefined||this.action=='get')?'Get':'Post';this.error=this.error==undefined?false:!!this.error;if(!url&&this.error){alert('Ajax請求URL不能為空。');return;}
try{this.req.open(this.action,url,this.asyn);}
catch(e){this.halt('[open] '+e.name+':'+e.message);return;}
try{this.req.setRequestHeader('Connection','close');this.req.setRequestHeader('Accept-Encoding','gzip, deflate');this.req.setRequestHeader('Content-Type','application/x-www-form-urlencoded'+(this.encode?';charset='+this.encode:''));if(this.req.overrideMimeType&&this.encode){this.req.overrideMimeType('text/xml'+(this.encode?';charset='+this.encode:''));}
this.req.send(this.content);}
catch(e){this.halt('[open] '+e.name+':'+e.message+'\n** 檢查是否為跨域訪問。');}};oAjax.prototype.callback=function(content){};oAjax.prototype.abort=function(){this.req.abort();};oAjax.prototype.halt=function(description){this.error&&alert(description);};oAjax.gb2utf8=function(data){var glbEncode=[];gb2utf8_data=data;execScript("gb2utf8_data = MidB(gb2utf8_data, 1)","VBScript");var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2");t=t.split("@");var i=0,j=t.length,k;while(++i<j){k=t[i].substring(0,4);if(!glbEncode[k]){gb2utf8_char=eval("0x"+k);execScript("gb2utf8_char = Chr(gb2utf8_char)","VBScript");glbEncode[k]=escape(gb2utf8_char).substring(1,6);}
t[i]=glbEncode[k]+t[i].substring(4);}
gb2utf8_data=gb2utf8_char=null;return unescape(t.join("%"));}
?
$Defined('Url');var Url={l:location};Url.Get=function(){var $_=arguments;if($_.length==1){($_=($_[0]in this.QS())?this.QS()[$_[0]]:'');}
else if($_.length>1){for(var i=0;i<$_.length;i++){$_[i]=$_[i]in this.QS()?this.QS()[$_[i]]:'';}}
else{$_='';}
return $_;}
Url.Set=function(name,value){this.QueryString[name]=value;};Url.Retrieve=function(){var _url='';for(var item in this.QueryString){var cur=this.QueryString[item];if(_url!='')_url+='&';if(typeof(cur)=='object'){for(var i=0,len=cur.length;i<len;i++){if(_url!='')_url+='&';_url+=item+'='+encodeURIComponent(cur[i]);}}
else{_url+=item+'='+encodeURIComponent(cur);}}
return _url;}
Url.QS=function(){if(typeof this.QueryString=='undefined'){this.QueryString={};var query=this.l.search;query=query.substr(1);query=query.split('&');for(var i=0,len=query.length;i<len;i++){var item=query[i].split('=');var name=item[0];var value=decodeURIComponent(item[1]||'');if(typeof this.QueryString[name]=='undefined'){this.QueryString[name]=value;}
else if(typeof(this.QueryString[name])=='object'){this.QueryString[name].push(value);}
else{var _value=this.QueryString[name];this.QueryString[name]=[_value,value];}}}
return this.QueryString;}
Url.Reload=function(url){var href=this.ClearAnchor(this.l.href);var arr=/^http(?:s)?:\/\/[^\/]+\:(\d+)\//i.exec(this.l.href);var _url='://'+this.l.host+(arr&&arr[1]?':'+arr[1]:'')+url;var sameUrl=0;(this.ClearAnchor('http'+_url)==href&&(sameUrl=1))||(this.ClearAnchor('https'+_url)==href&&(sameUrl=2))
_url=sameUrl!=0&&((sameUrl==1?'http':'https')+_url);if(sameUrl){var anchor=this.GetAnchor(_url);anchor&&this.GotoAnchor(anchor);this.l.reload(true);}
else{this.l.href=url;}};Url.ClearAnchor=function(url){var index;url=url||this.l.href;if((index=url.indexOf('#'))>-1){url=url.substring(0,index);}
return url;};Url.GetAnchor=function(url){url=url||this.l.href;var index=url.lastIndexOf('#');if(index==-1)return'';return url.substr(index+1);};Url.GotoAnchor=function(name){if(name=='')return;this.l.hash=name;};Url.Add=function(url,name,value){if(!value)return url;if(url.indexOf('?')>-1)
url+='&';else
url+='?';url+=name+'='+encodeURIComponent(value);return url;};Url.QS();?
$Defined('PopUp');var PopUp={};PopUp.Index=1;PopUp.Panel=function(item,w,h,p){var leaf=oNode.IsNode(item)&&item.parentNode;var panel=leaf?item:oNode.CreateNode('div');panel.tabIndex="-1";panel.style.position='absolute';panel.style.left='-1000px';panel.style.top='-1000px';panel.style.zIndex=2;panel.Center=function(){if(p){if(leaf){panel.$Parent=panel.parentNode;panel.style.display='block';w=panel.offsetWidth;h=panel.offsetHeight;}
w=w||panel.offsetWidth;h=h||panel.offsetHeight;panel.$P=p;panel.style.left=((Global.GetClientWidth()||Global.GetDocWidth())-w)/2+'px';panel.style.top=Global.GetScrollTop()+((Global.GetClientHeight()||Global.GetDocHeight())-h)/2+'px';function move(){if(w!=panel.offsetWidth)w=panel.offsetWidth;if(h!=panel.offsetHeight)h=panel.offsetHeight;panel.style.left=((Global.GetClientWidth()||Global.GetDocWidth())-w)/2+'px';panel.style.top=Global.GetScrollTop()+((Global.GetClientHeight()||Global.GetDocHeight())-h)/2+'px';if(panel.$D){panel.$D.Show();}
if(panel.$M){panel.$M.style.left=panel.style.left;panel.$M.style.top=panel.style.top;}}
panel.$Move=move;Events.AttachEvent(window,'resize',move);}};panel.Center();if(typeof item!='string'){if(!leaf)oNode.AddNode(item,panel);}
else{panel.innerHTML=item;}
return panel;};PopUp.AddPopUp=function(node,modal,target){oNode.AddNode(node,target);if(modal)var D=node.$D=CSS.AddBack(node,true);return node.$D;};PopUp.AddMask=function(node){if(!Browser.IsIE56)return;var M=node.$M=oNode.CreateNode('iframe');oNode.InsertBefore(M,node);M.frameBorder=0;M.scrolling='no';with(M.style){position='absolute';left=node.style.left;top=node.style.top;width=node.offsetWidth+'px';height=node.offsetHeight+'px';opacity=0;filter='alpha(opacity=0)';}};PopUp.RemovePopUp=function(node,target){target=target||document.body;if(node.parentNode!=target)return false;oNode.RemoveNode(node,target);if(node.$D)oNode.RemoveNode(node.$D,node.$D.parentNode);if(node.$M)oNode.RemoveNode(node.$M,node.parentNode);if(node.$BG)oNode.RemoveNode(node.$BG);if(node.$P)Events.RemoveEvent(window,'resize',node.$Move);};PopUp.RestorePopUp=function(node){node.style.left='-1000px';node.style.top='-1000px';PopUp.RemovePopUp(node,node.parentNode);node.$Parent&&oNode.AddNode(node,node.$Parent);};PopUp.SetXY=function(node,x,y){node.style.left=typeof x=='string'?x:x+'px';node.style.top=typeof y=='string'?y:y+'px';if(node.$M){node.$M.style.left=node.style.left;node.$M.style.top=node.style.top;}};PopUp.ResetXY=function(node){if(node.$M){node.$M.style.left=node.style.left;node.$M.style.top=node.style.top;}}
PopUp.SetSize=function(node,w,h){this.SetSizeW(node,w);this.SetSizeH(node,h);};PopUp.SetSizeW=function(node,w){w=typeof w=='string'?w:w+'px';node.style.width=w;this.ResetSize(node);};PopUp.SetSizeH=function(node,h){h=typeof h=='string'?h:h+'px';node.style.height=h;this.ResetSize(node);};PopUp.ResetSize=function(node){if(node.$M){node.$M.style.width=node.offsetWidth+'px';node.$M.style.height=node.offsetHeight+'px';}};PopUp.SetVisible=function(node,visible){visible=visible?'visible':'hidden';node.style.visibility=visible;if(node.$D)node.$D.style.visibility=visible;if(node.$M)node.$M.style.visibility=visible;if(node.$BG)node.$BG.style.visibility=visible;};PopUp.SetDisplay=function(node,display){display=display?'block':'none';node.style.display=display;if(node.$D)node.$D.style.display=display;if(node.$M)node.$M.style.display=display;if(node.$BG)node.$BG.style.display=display;};PopUp.HideModal=function(node){if(node.$D)CSS.SetAlpha(node.$D,0);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -