📄 coreui.js
字号:
clearTimeout(m_state.timeoutHide);}
}
function ResetItem(ev)
{m_state.timeoutHide=setTimeout(HideItem,500);if(ev.Package&&ev.Package.isParentMenu())
{m_state.current=ev.Package;m_state.timeoutShow=setTimeout(ShowItem,500);}
else
clearTimeout(m_state.timeoutShow)
}
function HideItem()
{if(m_state&&m_state.last)
m_state.last.hideSubMenu()
}
function HideNow(ev)
{if(m_state.last&&m_state.last==ev.Package)
{clearTimeout(m_state.timeoutHide);clearTimeout(m_state.timeoutShow);}
else
{HideItem();}
m_state.current=ev.Package;}
function ProcessKey()
{if(event.keyCode==27)
{m_this.hide();}
}
Web.UI.registerAllBaseMethods(Web.UI.Menu,this);}
Web.UI.Menu.registerClass("Web.UI.Menu","Web.UI.Dialog");Web.UI.registerEvents(Web.UI.Menu,"onmouseenter","onmouseleave","onclose");Web.UI.Menu.TextItem=function(strText,objContext)
{var objChildMenu=null;var m_elRoot;var m_timeout;var m_ltimeout;var m_this=this;var m_owner=null;this.getContext=function()
{return objContext;}
function display()
{if(objChildMenu)
{m_elRoot.focus();objChildMenu.setPadding(m_elRoot.offsetTop,null);objChildMenu.display(m_owner.getOwner());m_this.fire("onexpand",m_this);}
else
{m_this.fire("onclick",m_this);}
try
{if(window.event&&window.event.type)
window.event.returnValue=false;}
catch(ex)
{}
return false;}
function hide()
{if(objChildMenu)
objChildMenu.hide();}
function fireEnter()
{m_this.fire("onmouseenter",m_this);m_elRoot.className+=" hover";try{m_elRoot.focus();}catch(ex){}
}
function fireLeave()
{var str=m_elRoot.className;m_elRoot.className=m_elRoot.className.removeSpaceDelimitedString("hover");m_this.fire("onmouseleave",m_this)
}
function forceClick()
{display();event.cancelBubble=true;return false;}
this.render=function(p_owner)
{m_owner=p_owner;if(!m_elRoot)
{m_elRoot=document.createElement("A");m_elRoot.className=Web.UI.Menu.TextItem.applyClass(false);var elMargin=document.createElement("span")
elMargin.className="ctxtMargin";elMargin.innerHTML=" ";m_elRoot.appendChild(elMargin);var elContents=document.createElement("span");elContents.className="ctxtContext";m_elRoot.href="#";elContents.innerText=strText;m_elRoot.appendChild(elContents);m_elRoot.attachEvent("onmouseenter",fireEnter);m_elRoot.attachEvent("onmouseleave",fireLeave);if(objChildMenu)
{var elRight=document.createElement("span");elRight.innerHTML=">";elRight.className="ctxtMore";m_elRoot.appendChild(elRight);m_elRoot.attachEvent("oncontextmenu",forceClick);m_elRoot.attachEvent("onkeydown",doChildKey);}
m_elRoot.attachEvent("onclick",display);}
return m_elRoot;}
function doChildKey()
{switch(event.keyCode)
{case 39:
m_elRoot.click();break;}
}
this.isParentMenu=function()
{return(!!objChildMenu);}
this.hideSubMenu=function()
{if(this.isParentMenu())
objChildMenu.hide();}
this.showSubMenu=function()
{display();}
this.addMenu=function(p_objContext)
{objChildMenu=p_objContext;objChildMenu.setDock(Web.UI.Popup.VDock.Top,Web.UI.Popup.HDock.Right);p_objContext.parentMenu=this;}
this.dispose=function()
{if(objChildMenu)
{objChildMenu.dispose();}
if(m_elRoot)
{m_elRoot.detachEvent("onclick",display);m_elRoot.detachEvent("onkeydown",doChildKey);m_elRoot.detachEvent("onmouseenter",fireEnter);m_elRoot.detachEvent("onmouseleave",fireLeave);m_elRoot.detachEvent("oncontextmenu",forceClick);}
clearTimeout(m_timeout);clearTimeout(m_ltimeout);m_owner=m_elRoot=objChildMenu=null;}
}
Web.UI.registerEvents(Web.UI.Menu.TextItem,"onmouseenter","onmouseleave","onexpand","onhover","onclick");Web.UI.Menu.TextItem.registerClass("Web.UI.Menu.TextItem")
Web.UI.Menu.Rule=function()
{var objChildMenu=null;var m_elRoot;var m_timeout;var m_ltimeout;var m_this=this;var m_owner=null;this.render=function(p_owner)
{m_owner=p_owner;if(!m_elRoot)
{m_elRoot=document.createElement("hr");m_elRoot.size="1";m_elRoot.className=Web.UI.Menu.Rule.applyClass(false);m_elRoot.attachEvent("onclick",display);}
return m_elRoot;}
function display()
{m_this.fire("onclick",m_this);}
this.isParentMenu=function()
{return false;}
this.hideSubMenu=function()
{}
this.showSubMenu=function()
{}
this.addMenu=function(p_objContext)
{}
this.dispose=function()
{if(m_elRoot)
m_elRoot.detachEvent("onclick",display);m_owner=m_elRoot=objChildMenu=null;}
}
Web.UI.registerEvents(Web.UI.Menu.Rule,"onmouseenter","onmouseleave","onexpand","onhover","onclick");Web.UI.Menu.Rule.registerClass("Web.UI.Menu.Rule");registerNamespace("Web.UI.Binding");Web.UI.Popup.Tooltip=function(p_elOwner,p_intTimeout,p_contents)
{Web.UI.Popup.Tooltip.initializeBase(this);var m_objTimer=null;var m_this=this;var m_elTip=null;function DisplayTip()
{m_this.display(p_elOwner,true);}
this.hide=function()
{Web.UI.Popup.Tooltip.getBaseMethod(m_this,"hide","Web.UI.Popup").call(this);clearTimeout(m_objTimer);}
function HideTip()
{m_this.hide();}
function CaptureTimer()
{clearTimeout(m_objTimer);m_objTimer=setTimeout(DisplayTip,p_intTimeout);}
this.display=function(p_blnRelocate)
{m_elTip=Web.UI.Popup.Tooltip.getBaseMethod(m_this,"display","Web.UI.Popup").call(this,p_elOwner,p_blnRelocate);m_elTip.className+=" Web_UI_Popup_Tooltip";}
this.setDock(Web.UI.Popup.VDock.Bottom,Web.UI.Popup.HDock.Left);this.setAnchor(Web.UI.Popup.VAnchor.Top,Web.UI.Popup.HAnchor.Left);if(p_contents)
this.setContents(p_contents);if(!p_intTimeout)
p_intTimeout=500;p_elOwner.attachEvent("onmousemove",CaptureTimer);p_elOwner.attachEvent("onmouseout",HideTip);p_elOwner.attachEvent("onmousedown",HideTip);this.initialize();this.dispose=function()
{Web.UI.Popup.Tooltip.getBaseMethod(m_this,"dispose","Web.UI.Popup").call(this);p_elOwner.detachEvent("onmousemove",CaptureTimer);p_elOwner.detachEvent("onmouseout",HideTip);m_elTip=null;clearTimeout(m_objTimer);}
}
Web.UI.Popup.Tooltip.registerClass(null,"Web.UI.Popup");registerNamespace("Web.UI.Binding");Web.UI.Binding.Tooltip=function(p_el,p_args)
{Web.UI.Binding.Tooltip.initializeBase(this,arguments);p_args=this.getParameters(p_args);var m_tooltip;this.initialize=function(p_elOwner)
{Web.UI.Binding.Tooltip.getBaseMethod(m_this,"initialize","Web.Bindings.Base").call(this,p_elOwner)
m_tooltip=new Web.UI.Popup.Tooltip(p_el,p_args.timeout);var blnText=p_args.mode=="text";m_tooltip.setContents(p_args.tip.toString(),blnText);}
this.dispose=function(p_blnDispose)
{Web.UI.Binding.Tooltip.getBaseMethod(m_this,"dispose","Web.Bindings.Base").call(this,p_blnDispoase)
m_tooltip.dispose();}
}
Web.UI.Binding.Tooltip.registerClass("Web.UI.Binding.Tooltip","Web.Bindings.Base");Web.UI.Binding.Tooltip.Params=Web.Enum.create("tip","mode","timeout");registerNamespace("Web.Accessibility");Web.Accessibility._Wrap=new function()
{function BaseAccessibility()
{if(event.srcElement.tagName=="SELECT")
{return false;}
}
function CleanUp()
{document.detachEvent("onclick",BaseAccessibility);}
document.attachEvent("onclick",BaseAccessibility);Web.Runtime.onunload.attach(CleanUp);}
registerNamespace("Web.UI.Utilities");Web.UI.Utilities.isRightToLeftMarket=function(){return 'rtl'===document.body.currentStyle.direction;}
Web.UI.Utilities.CleanupHelper=function()
{var m_h=[];var m_d=[];var m_n=[];var m_this=this;this.initialize=function(p_elOwner)
{}
this.dispose=function(p_blnDispose)
{detachEvents();disposeProperties(p_blnDispose);if(!p_blnDispose)
detachNodes();m_h=[];m_d=[];m_n=[];}
this.disposeGroup=function(group)
{m_this.removeNodeGroup(group);m_this.detachEventGroup(group);m_this.disposePropertyGroup(group);}
this.attachEvent=function(group,obj,evt,cb)
{var h=
{group:group,obj:obj,evt:evt,cb:cb,
detach:function(){this.obj.detachEvent(evt,cb)},
equals:function(o,e,c){return this.obj==o&&this.evt==e&&this.cb==c}
};obj.attachEvent(evt,cb)
m_h.push(h);}
this.initializeProperty=function(obj,group)
{if(obj.initialize)
obj.initialize();m_d.push({obj:obj,group:group});}
this.registerNode=function(node,group)
{m_n.push({node:node,group:group});}
this.createNode=function(tag,properties,styles,parent,group)
{var el=document.createElement(tag);for(var p in properties)
el[p]=properties[p];for(var p in styles)
el.style[p]=styles[p];if(parent)
parent.appendChild(el);m_this.registerNode(el,group);return el;}
this.removeNodeGroup=function(group)
{for(var i=m_n.length-1;i>=0;i--)
{if(m_n[i].group==group)
{m_n[i].node.removeNode(true);m_n.remove(m_n[i]);}
}
}
this.detachEvent=function(obj,evt,cb)
{for(var i=m_h.length-1;i>=0;i--)
{if(m_h[i].equals(obj,evt,cb))
{m_h[i].detach();m_h.remove(m_h[i]);}
}
}
this.detachEventGroup=function(group)
{for(var i=m_h.length-1;i>=0;i--)
{if(m_h[i].group==group)
{m_h[i].detach();m_h.remove(m_h[i]);}
}
}
this.disposePropertyGroup=function(group)
{if(null==m_d)return;for(var i=m_d.length-1;i>=0;i--)
{if(m_d[i].group==group)
{if(m_d[i].obj.dispose)
m_d[i].obj.dispose();m_d.remove(m_d[i]);}
}
}
function detachEvents()
{if(null==m_h)return;for(var i=m_h.length-1;i>=0;i--)
{m_h[i].detach();m_h[i]=null;}
m_h=[];}
function disposeProperties()
{if(null==m_d)return;for(var i=m_d.length-1;i>=0;i--)
{if(m_d[i].obj.dispose)
m_d[i].obj.dispose();m_d[i]=null;}
m_d=[];}
function detachNodes()
{if(null==m_n)return;for(var i=m_n.length-1;i>=0;i--)
{m_n[i].node.removeNode(true);m_n[i]=null;}
m_n=[];}
}
Web.Animation=
{Initialize:function()
{Web.Animation.Timer=new Web.Animation.Timer();Web.Animation.Easing.Initialize();Web.Runtime.onunload.attach(Web.Animation.Dispose);},
Dispose:function()
{Web.Animation.Timer.stop();},
Timer:function()
{var m_ivls=[null,null];var m_ivld=[30,11];var m_this=this;var m_callbacks=[];this.add=this.attach=function(callback)
{m_callbacks.push(callback);if(1==m_callbacks.length)
m_this.start();}
this.remove=this.detach=function(callback)
{m_callbacks.remove(callback);if(m_callbacks.length==0)
m_this.stop();}
this.getTicks=function(){return(new Date()).valueOf();}
this.start=function(){m_ivls.forEach(setInterval,this);}
this.stop=function(){m_callbacks=[];m_ivls.forEach(clearInterval,this);}
function step()
{var t=m_this.getTicks();for(var i=0;i<m_callbacks.length;i++)
{m_callbacks[i](t);}
}
function setInterval(v,i,a){if(!a[i]){a[i]=window.setInterval(step,m_ivld[i]);}};function clearInterval(v,i,a){window.clearInterval(v);a[i]=null};},
Animator:function(duration,easingFunction,callback)
{var m_this=this;var m_start=null;var m_reverse=false;var m_running=false;this.reverse=function()
{m_this.stop();m_reverse=true;m_this.start();}
this.start=function()
{m_running=true;m_start=Web.Animation.Timer.getTicks();Web.Animation.Timer.attach(increment);}
this.stop=function()
{Web.Animation.Timer.detach(increment);m_running=false;m_reverse=false;}
this.isRunning=function()
{return m_running;}
function increment(t)
{var current=m_this.getCurrent(t);if((m_reverse&¤t==0)||current==duration)
m_this.stop();callback(easingFunction(current/duration));}
function clamp(value)
{if(value<=0)return 0;if(value>=duration)return duration;return value;}
this.getCurrent=function(t)
{return clamp(
(m_reverse?
duration-t-m_start:
t-m_start)
);}
},
Easing:{_this:this,
Initialize:function()
{var exp=10;this.Linear=this.Poly(1);this.QuadraticInOut=this.InOut(this.Poly(2),.5);this.CircularInOut=this.InOut(this.Circle(),.5);this.ExponentialInOut=this.InOut(this.Exponent(2,exp),4/exp);},
Dispose:function()
{},
Reverse:function(fn)
{return function(t){return 1-fn(1-t);};},
InOut:function(fn,amt){amt=amt||.5;var rev=this.Reverse(fn);return function(t){if(t<amt)
return(1-amt)*fn(t/amt);return(1-amt)+(amt*rev((t-amt)/(1-amt)));};},
Poly:function(rank){return function(t){return Math.pow(t,rank);};},
Sine:function(period){period=period||2;return function(t){return 1-Math.cos(t*Math.PI/2)}
},
Circle:function(){return function(t){return-(Math.sqrt(1-t*t)-1);};},
Exponent:function(base,exponent){base=base||2;exponent=exponent||10;var zero=Math.pow(base,-exponent);var one=1-zero;return function(t){return(Math.pow(base,exponent*(t-1))-zero)/one};},
Back:function(s,fn)
{s=s||2;fn=fn||this.ExponentialInOut;return function(t){return fn(t)*((s+1)*t-s);};}
}
}
Web.Animation.Initialize();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -