?? core.lib.js
字號:
?$Defined('Global');var Global={PATH:'/'};Global.GetObject=function($_){var d=document;return(d.all&&d.all($_))||(d.getElementById&&d.getElementById($_))||null;}
Global.GetDocWidth=function(d){d=d||document;return Math.max(this.GetClientWidth(d),d.body.offsetWidth);};Global.GetDocHeight=function(d){d=d||document;return Math.max(this.GetClientHeight(d),d.body.offsetHeight);};Global.GetScrollLeft=function(d){d=d||document;return(d.documentElement?d.documentElement.scrollLeft:d.body.scrollLeft);};Global.GetScrollTop=function(d){d=d||document;return(d.documentElement?d.documentElement.scrollTop:d.body.scrollTop);};Global.GetClientWidth=function(d){d=d||document;return(window.innerWidth||d.documentElement&&d.documentElement.clientWidth||d.body.clientWidth);};Global.GetClientHeight=function(d){d=d||document;return(window.innerHeight||d.documentElement&&d.documentElement.clientHeight||d.body.clientHeight);};Global.GetOffsetTop=function(el,p){var _t=el.offsetTop;while(el=el.offsetParent){if(el==p)break;_t+=el.offsetTop;}
return _t;};Global.GetOffsetLeft=function(el,p){var _l=el.offsetLeft;while(el=el.offsetParent){if(el==p)break;_l+=el.offsetLeft;}
return _l;};Global.Random=function(){return(new Date().getTime()+'_'+Math.floor(Math.random()*10000000));};Global.IsLocal=function(){return location.href.indexOf('file:///')==0;};Array.prototype.push||(Array.prototype.push=function(arg){this[this.length]=arg;});function ToArray(obj,index){return Array.prototype.slice.apply(obj).slice(index||0);}
function TypeOf(obj){if(typeof obj=='undefined')return'undefined';var type=obj.constructor.toString();var arr=/function\s+(.+)\s*\(/i.exec(type);return(arr&&arr[1]?arr[1].toLowerCase():'string');};function $(){var $_=arguments;if($_.length==1){$_=typeof $_[0]=='string'?Global.GetObject($_[0]):$_[0];}
else if($_.length>1){for(var i=0;i<$_.length;i++){$_[i]=typeof $_[i]=='string'?Global.GetObject($_[i]):$_[i];}}
else{$_=null;}
return $_;}
function $E(e,win){win=win||window;return win.event||e||null;}
function $EO(e,win){return e&&(e.target||e.srcElement);}
function $Defined(cls){if(typeof eval(cls)!='undefined')
alert('變量'+cls+' 重定義。');}
function $USE(lib){document.write('<script type="text/javascript" src="'+Global.PATH+lib+'"><'+'/'+'script>');}
window.onerror=function(){};?
String.prototype.Contains=function(str){return(this.indexOf(str)>-1);};String.prototype.Trim=function(){return this.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g,'');};String.prototype.LTrim=function(){return this.replace(/^[ \t\n\r]*/g,'');};String.prototype.RTrim=function(){return this.replace(/[ \t\n\r]*$/g,'');};String.prototype.HtmlToStr=function(){return this.replace(/&/g,'&').replace(/>/g,'>').replace(/</g,'<');};String.Space=function(num,htmlEntity){var meta=htmlEntity?' ':'\x20';var str='';for(var i=0;i<num;i++)str+=meta;return str;};?
$Defined('Browser');var Browser={s:navigator.userAgent.toLowerCase()};(function(b){b.IsIE=b.s.Contains('msie');b.IsIE5=b.s.Contains('msie 5');b.IsIE6=b.s.Contains('msie 6');b.IsIE7=b.s.Contains('msie 7');b.IsIE56=!b.IsIE7&&(b.IsIE6||b.IsIE5);b.IsGecko=b.s.Contains('gecko');b.IsSafari=b.s.Contains('safari');b.IsOpera=b.s.Contains('opera');b.IsMac=b.s.Contains('macintosh');b.IsIELike=(b.IsIE||b.IsOpera);b.IsGeckoLike=(b.IsGecko||b.IsSafari);})(Browser);?
$Defined('CSS');var CSS={LEFT:'left',RIGHT:'right',BOTH:'both'};CSS.GetRe=function(c){return new RegExp('^\\s*'+c+'\\s+|\\s+'+c+'\\s*$|\\s+'+c+'\\s+|^\\s*'+c+'\\s*$','');};CSS.AddClass=function(el){if(!oNode.IsNode(el))return;var list=arguments;for(var i=1,len=list.length;i<len;i++){var c=list[i];if(typeof c!='string'||c=='')continue;var re=this.GetRe(c);if(!re.test(el.className)){el.className+=((el.className?'\x20':'')+c).replace(/\s{2,}/g,'\x20');}}};CSS.RemoveClass=function(el){if(!oNode.IsNode(el))return;var list=arguments;for(var i=1,len=list.length;i<len;i++){var c=list[i];if(typeof c!='string'||c=='')continue;var re=this.GetRe(c);if(re.test(el.className)){el.className=el.className.replace(re,'\x20').replace(/^\s{2,}$/,'\x20');}}};CSS.ReplaceClass=function(el,replaced,replacing){this.RemoveClass(el,replaced);this.AddClass(el,replacing);};CSS.HasClass=function(el,c){if(!oNode.IsNode(el))return false;if(typeof c!='string'||c=='')return false;return this.GetRe(c).test(el.className);};CSS.SetAlpha=function(el,opacity){if(Browser.IsIE){try{el.filters[0].Opacity=opacity;}
catch(e){el.style.filter='alpha(Opacity='+opacity+')';}}
else{el.style.MozOpacity=opacity/100;el.style.opacity=opacity/100;}};CSS.GetAlpha=function(el){if(Browser.IsIE){try{return el.filters[0].Opacity;}
catch(e){return 100;}}
else{return el.style.opacity*100;}};CSS.SetDisplay=function(el,display,unset){el.style.display=!!display?(unset?'block':''):'none';};CSS.SetVisible=function(el,visible){el.style.visibility=!!visible?'visible':'hidden';};CSS.SetFloat=function(el,dir){el.style.styleFloat=dir;el.style.cssFloat=dir;};CSS.AddClear=function(el,clear){var node=oNode.CreateNode('div');oNode.AddNode(node,el);node.style.overflow='hidden';node.style.clear=clear;return node;};CSS.SelectOn=function(doc){doc=doc||document;doc.body.style.MozUserSelect='';doc.body.style.KhtmlUserSelect='';doc.onselectstart=null;};CSS.SelectOff=function(doc){doc=doc||document;doc.body.style.MozUserSelect='none';doc.body.style.KhtmlUserSelect='none';doc.onselectstart=function(){return false};};CSS.AddBack=function(el,insertBefore){var BG=oNode.CreateNode('div');if(el)el.$BG=BG;el&&insertBefore?oNode.InsertBefore(BG,el):oNode.AddNode(BG);with(BG.style){position='absolute';zIndex=1;left='0px';top='0px';background='transparent url('+BBSMAX.SpaceImage+') repeat 0 0';}
BG.Show=function(){this.style.width=Global.GetDocWidth()-(Browser.IsGecko&&!Browser.IsSafari?18:0)+'px';this.style.height=Math.max(Global.GetDocHeight(),Global.GetClientHeight())+'px';CSS.SetVisible(this,true);};BG.Hide=function(){CSS.SetVisible(this,false);with(this.style){width='1px';height='1px';}};BG.Show();return BG;};CSS.AddStyle=function(cssText){var s=oNode.CreateNode('style');s.type='text/css';if(s.styleSheet){s.styleSheet.cssText=cssText;}
else{oNode.AddNode(cssText,s);}
oNode.AddNode(s,document.getElementsByTagName('head')[0]);return s;};?
$Defined('oNode');var oNode={};oNode.IsNode=function(el){if(el&&typeof el=='object'&&el.nodeType==1)
return true;return false;};oNode.IsTextNode=function(el){if(el&&typeof el=='object'&&el.nodeType==3)
return true;return false;};oNode.CreateNode=function(tag){return document.createElement(tag);};oNode.CreateTextNode=function(str){return document.createTextNode(str);};oNode.AddNode=function(node,target){target=target||document.body;if(this.IsNode(node)||this.IsTextNode(node)){if(node.parentNode&&this.IsNode(node.parentNode))return false;target.appendChild(node);}
else{this.AddNode(this.CreateTextNode(node.toString()),target);}
return true;};oNode.RemoveNode=function(node,target){if(!node||!node.parentNode||(node.parentNode&&node.parentNode.nodeType!=1))return;return node.parentNode.removeChild(node);};oNode.InsertBefore=function(node,target){target.parentNode.insertBefore(node,target);};oNode.CreateIframe=function(name){var el;try{el=this.CreateNode('<iframe name="'+name+'">');}
catch(e){el=this.CreateNode('iframe');el.name=name;}
el.id=name;return el;};oNode.CreateForm=function(name,method,enctype){var el;try{el=this.CreateNode('<form name="'+name+'"'+(enctype?'enctype="'+enctype+'"':'')+(method?' method="'+method+'"':'')+'>');}
catch(e){el=this.CreateNode('form');method&&(el.method=method);enctype&&(el.enctype=enctype);el.name=name;}
return el;};oNode.CreateInput=function(name){var el;try{el=this.CreateNode('<input name="'+name+'">');}
catch(e){el=this.CreateNode('input');el.name=name;}
return el;};?
$Defined('Cookie');var Cookie={cookies:{}};Cookie.Get=function(){var cookie=document.cookie;if(!cookie)return;cookie=cookie.replace(/\s+/g,'');cookie=cookie.split(';');for(var i=0;i<cookie.length;i++){if(cookie[i].indexOf('=')==-1)return;var _cookie=cookie[i].split('=');this.cookies[_cookie[0]]=unescape(_cookie[1]);}};Cookie.Set=function(name,value,expiration){if(!expiration)
expiration=new Date(new Date().getTime()+25*365*24*60*60*1000);document.cookie=name+'='+escape(value)+'; expires='+expiration.toGMTString();};Cookie.Del=function(name){Cookie.Set(name,'',new Date(new Date().getTime()-1));};Cookie.Get();?
$Defined('Events');var Events={};Events.AttachEvent=function(obj,eventName,func,useCapture,_window){obj=$(obj);if(!obj)return;useCapture=useCapture?true:false;eventName=eventName.toLowerCase();if(obj.addEventListener){obj.addEventListener(eventName,func,useCapture);}
else{var E=this;this._AttachEvent(obj,eventName,func);obj['on'+eventName]=function(e){E._FireEvent(obj,eventName,e,_window);};}};Events.RemoveEvent=function(obj,eventName,func,useCapture){obj=$(obj);if(!obj)return;useCapture=useCapture?true:false;eventName=eventName.toLowerCase();if(obj.removeEventListener){obj.removeEventListener(eventName,func,useCapture);}
else{if(obj.events&&obj.events[eventName]){var evts=obj.events[eventName];for(var i=0,len=evts.length;i<len;i++){if(evts[i]&&func&&evts[i]===func){evts.splice(i,1);break;}}}}};Events._AttachEvent=function(obj,eventName,func){eventName=eventName.toLowerCase();if(!obj.events)obj.events={};if(!obj.events[eventName])obj.events[eventName]=[];var evts=obj.events[eventName];evts[evts.length]=func;};Events._FireEvent=function(obj,eventName,e,_window){e=_window?_window.event:$E(e);eventName=eventName.toLowerCase();if(!obj||!obj.events||!obj.events[eventName])return;var evts=obj.events[eventName];for(var i=0,len=evts.length;i<len;i++)
evts[i]&&evts[i].call(obj,e,obj);};Events.CancelBubble=function(e){if(!e)return;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();};Events.CancelEvent=function(e){if(!e)return;e.returnValue=false;if(e.preventDefault)e.preventDefault();};Events.CancelAll=function(e){this.CancelBubble(e);this.CancelEvent(e);};Events.Button=function(e){if(e.button!=undefined)return e.button;else if(e.which!=undefined)return e.which;};?
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -