1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/iknown-libq.js

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Q.min.js 89 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
lovelylife Отправлено 08.12.2017 19:38 1026788
function createAjaxTrans(){var e=null;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=null}}return e||"undefined"==typeof XMLHttpRequest||(e=new XMLHttpRequest),e}function ajaxQueue(e,t){function n(e){return function(){var n=arguments.callee;if(0!=e.tasks.length){var i=e.tasks[0];newAjax(i,t,function(t){var i=e.tasks.shift();Q.printf("[ajax]completed("+(t?"ok":"failed")+") one and remove item -> "+i.command),(t||i.continueError)&&n.call()})}}}this.tasks=this.tasks||[];var i=0==this.tasks.length;this.tasks.push(e),i?n(this)():console.log("push a task only")}function newAjax(e,t,n){var i=e||{},o=i.command.toString();o=-1==o.indexOf("?")?o+"?&rnd="+Q.rnd(16):o+"&rnd="+Q.rnd(16);var a=i.method||"POST";a=a.toString().toUpperCase(),"GET"==a||"POST"==a||(a="GET");var s=createAjaxTrans(),r=!0;i.async&&(r=!!i.async),s.open(a,o,r),i.withCredentials&&(s.withCredentials=!!i.withCredentials),s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){4==s.readyState&&(200==s.status?(i.oncomplete&&i.oncomplete(s),n&&n(!0)):(i.onerror&&i.onerror(s),n&&n(!1)))};var d=null;i.data&&"function"==typeof t&&(d=t(i.data)),s.send(d)}function fireMouseEvent(e,t){if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent(t,!0,!1),e.dispatchEvent(n)}else document.createEventObject&&e.fireEvent("on"+t)}function $IsNull(e){return null==e}function $IsStyle(e,t){return Q.hasClass(e,t)}function register_hook(e){__GLOBALS.desktop.hook.append(e)}function unregister_hook(e){__GLOBALS.desktop.hook.erase(e)}function invoke_hook(e,t){__GLOBALS.desktop.hook.each(function(n){n(e,t)})}function $IsDesktopWindow(e){return __GLOBALS.desktop==e}function $IsWindow(e){return!$IsNull(e)&&e.nodeType==Q.ELEMENT_NODE&&e.getAttribute("__QWindow__")}function $IsMaxWindow(e){return $IsStyle(e,CONST.STYLE_MAX)&&CONST.SIZE_MAX==$GetWindowStatus(e)}function $BindWindowMessage(e,t,n){return function(){return e!=$GetDesktopWindow()?e.wnd_proc(e,t,n):!1}}function $MaskWindow(e,t){var n=$GetMask(e);n&&n.style&&(n.style.display=t?"":"none")}function $CreateMaskLayer(e,t){e.layer_mask=document.createElement("DIV"),e.layer_mask.body_style=document.body.currentStyle.overflow,e.layer_mask.className="q-window-mask",t&&Q.addClass(e.layer_mask,t),e.appendChild(e.layer_mask),e.layer_mask.style.display="none",e.layer_mask.onmousedown=Q.bind_handler(e,function(e){return e=e||window.event,$BindWindowMessage(this,MESSAGE.ACTIVATE)(),e.cancelBubble=!0,!1}),e.layer_mask.onselectstart=function(){return!1}}function $ShowWindow(e,t){t?(e.style.display="",$BindWindowMessage(e,MESSAGE.ACTIVATE)()):(e.style.display="none",$MaskWindow(e,!1))}function $ActivateWindow(e,t){if($IsWindow(e)){var n=0;isNaN(t)||(n=t);var i=$GetContainerWindow(e);$SetActiveChild(i,e);var o=$GetTopZIndexWindow(i),a=$GetWindowZIndex(o)+1;$SetWindowZIndex(e,n?n:a),$SetWindowActive(o,!1),$SetWindowActive(e,!0)}}function $SetWindowActive(e,t){for(var n=e;n;)n.on_activate&&n.on_activate(t),t?Q.removeClass(n,CONST.inactive_title):Q.addClass(n,CONST.inactive_title),n=$GetActiveChild(n)}function $MaxizeWindow(e){if($GetWindowStatus(e)!=CONST.SIZE_MAX){var t,n,i=$GetContainerWindow(e);if(i==document.body){var o=Q.workspace();t=o.width,n=o.height}else{if(!$IsWindow(i))return;t=Math.max($GetClient(i).clientWidth,$GetClient(i).scrollWidth),n=Math.max($GetClient(i).clientHeight,$GetClient(i).scrollHeight)}$ChangeCtrlButton(e,CONST.SIZE_MAX,"q-normal"),$SetWindowPosition(e,0,0,t,n),$SetWindowStatus(e,CONST.SIZE_MAX)}}function $RestoreWindow(e){$ChangeCtrlButton(e,CONST.SIZE_MAX,"q-max"),$MoveTo(e,e.rleft,e.rtop),$ResizeTo(e,e.rwidth,e.rheight),$SetWindowStatus(e,CONST.SIZE_NORMAL)}function $MinimizeWindow(e){$GetWindowStatus(e)!=CONST.SIZE_MAX&&(e.minizing?($ResizeTo(e,e.nWidth,e.minizie_height),e.minizing=!1):(e.minizie_height=e.nHeight,$ResizeTo(e,e.nWidth,$GetTitle(e).offsetHeight),e.minizing=!0))}function $FitWindow(e){var t=$GetClient(e),n=t.style.overflow;t.style.overflow="visible";var i=t.scrollHeight;$IsStyle(e,CONST.no_title)||(i+=$GetTitle(e).offsetHeight),$IsStyle(e,CONST.with_bottom)&&(i+=$GetBottomBar(e).offsetHeight),$ResizeTo(e,t.scrollWidth,i),t.style.overflow=n}function $SetWindowPosition(e,t,n,i,o){$MoveTo(e,t,n),$ResizeTo(e,i,o)}function $SetWindowTitle(e,t){e.title_text=t,e.hTitle.hTitleContent.innerText=t}function $SetActiveChild(e,t){e.active_child=t}function $SetWindowZIndex(e,t){e!==$GetDesktopWindow()&&(e.style.zIndex=t)}function $RemoveWindowStyle(e,t){Q.removeClass(e,t)}function $SetWindowStatus(e,t){e.status_type=t}function $MoveTo(e,t,n){e.rtop=e.nTop,e.rleft=e.nLeft,e.nTop=n,e.nLeft=t,e.style.top=e.nTop+"px",e.style.left=e.nLeft+"px"}function $ResizeTo(e,t,n){e.rwidth=e.nWidth,e.rheight=e.nHeight,t=Math.max(parseInt(t,10)-0,__GLOBALS.MIN_WIDTH),n=Math.max(parseInt(n,10),__GLOBALS.MIN_HEIGHT),e.nWidth=t,e.nHeight=n,e.style.width=t+"px",e.style.height=n+"px","function"==typeof e.on_size&&e.on_size(t,n)}function $GetWindowClientHeight(){var e=0;return"number"==typeof window.innerHeight?e=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?e=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(e=document.body.clientHeight),e}function $CenterWindow(e){var t=Q.scrollInfo(),n=t.l+(document.body.clientWidth-e.nWidth)/2,i=t.t+($GetWindowClientHeight()-e.nHeight)/2;$MoveTo(e,n,i)}function $SetWindowProc(e,t){if("function"==typeof t){var n=e.wnd_proc;return e.wnd_proc=t,n}return null}function $GetDesktopContainer(){return __GLOBALS.desktop}function $GetDesktopWindow(){return __GLOBALS.desktop}function $GetMask(e){return e.layer_mask}function $GetActiveChild(e){return e.active_child}function $GetContainerWindow(e){return e.container_wnd}function $GetParentWindow(e){return e.parent_wnd}function $GetWnds(e){return e.wnds}function $GetMinCtrlButton(e){return e.hTitle.hMin}function $GetMaxCtrlButton(e){return e.hTitle.hMax}function $GetTitleText(e){return e.title_text}function $GetTitleContent(e){return e.hTitleContent}function $GetTitle(e){return e.hTitle}function $GetBottomBar(e){return e.hBottomBar}function $GetWindowStatus(e){return e.status_type}function $GetWindowStyle(e){return e.className}function $GetClient(e){return e.hClientArea}function $GetWindowZIndex(e){return e&&e.style&&e.style.zIndex?parseInt(e.style.zIndex,10):__GLOBALS.Z_INDEX}function $GetTopZIndexWindow(){var e;e=arguments.length>0&&$IsWindow(arguments[0])?arguments[0]:$GetDesktopWindow();var t=$GetWnds(e),n=null;return t.each(function(e){return n?(top_zindex=$GetWindowZIndex(n),wnd_zindex=$GetWindowZIndex(e),wnd_zindex>top_zindex&&(n=e)):n=e,!0}),n}function $DefaultWindowProc(e,t){switch(t){case MESSAGE.CREATE:break;case MESSAGE.MIN:$MinimizeWindow(e);break;case MESSAGE.MAX:$GetWindowStatus(e)!=CONST.SIZE_MAX?$MaxizeWindow(e):$RestoreWindow(e);break;case MESSAGE.CLOSE:var n=!0;e.on_close&&(n=e.on_close()),n===!1?$ShowWindow(e,!1):$DestroyWindow(e);break;case MESSAGE.ACTIVATE:for(var i=$GetTopZIndexWindow($GetDesktopWindow()),o=$GetWindowZIndex(i),a=e;a&&a.modal_prev;)a=a.modal_prev;for(;a&&a.modal_next;)a=a.modal_next,++o;for($ActivateWindow(a,++o),a!=e&&$BindWindowMessage(a,MESSAGE.ACTIVATE)();a&&a.modal_prev;)a=a.modal_prev,$SetWindowZIndex(a,--o);break;case MESSAGE.MOVE:}return invoke_hook(e,t),!1}function $CreateCtrlButton(e){var t=document.createElement("button");return t.innerHTML="&nbsp;",t.className=e,t.hideFocus=!0,t}function $ChangeCtrlButton(e,t,n){var i;t==CONST.SIZE_MIN?i=$GetMinCtrlButton(e):t==CONST.SIZE_MAX&&(i=$GetMaxCtrlButton(e)),i.className=n}function $CreateWindowTitlebar(e){var t=document.createElement("DIV");t.className="q-title",t.onselectstart=function(){return!1},t.onclick=function(t,n){return function(){$IsStyle(n,CONST.fixed)||(t.clickonce?($BindWindowMessage(e,MESSAGE.MAX)(),t.clickonce=!1):t.clickonce=!0,setTimeout(function(){t.clickonce=!1},300))}}(t,e),t.hIcon=document.createElement("div"),t.hIcon.className="q-icon",t.appendChild(t.hIcon),t.hTitleContent=document.createElement("DIV"),t.hTitleContent.className="q-title-content",t.appendChild(t.hTitleContent),t.hMin=$CreateCtrlButton("q-min"),t.hMax=$CreateCtrlButton("q-max"),t.hClose=$CreateCtrlButton("q-close"),t.hPadding=$CreateCtrlButton("q-padding"),t.hMin.onclick=$BindWindowMessage(e,MESSAGE.MIN),t.hMax.onclick=$BindWindowMessage(e,MESSAGE.MAX),t.hClose.onclick=$BindWindowMessage(e,MESSAGE.CLOSE),t.appendChild(t.hPadding),t.appendChild(t.hClose),t.appendChild(t.hMax),t.appendChild(t.hMin),e.hTitle=t,e.appendChild(t)}function $CreateWindow(e,t,n,i,o,a,s,r){n=void 0!=n?(n+"").replace(/\|+/g," "):"";var d=null,l=null;$IsWindow(e)||(e=$GetDesktopWindow()),d=$GetDesktopWindow(),l=$GetDesktopWindow();var c=document.createElement("DIV");return c.setAttribute("__QWindow__",!0),c.parent_wnd=e,c.container_wnd=l,c.modal_next=null,c.model_prev=null,c.wnds=new Q.List,c.active_child=null,c.title_text=t||"untitled",c.status_type=CONST.SIZE_NORMAL,c.wnd_proc=$DefaultWindowProc,c.app=r||__GLOBALS.explorer,c.app.add_window(c),c.className="q-window",c.style.display="none",c.style.zIndex=__GLOBALS.Z_INDEX,isNaN(o)&&(o=0),isNaN(i)&&(i=0),isNaN(a)&&(a=300),isNaN(s)&&(s=300),c.rtop=c.nTop=o,c.rleft=c.nLeft=i,c.rwidth=c.nWidth=a,c.rheight=c.nHeight=s,c.style.top=o+"px",c.style.left=i+"px",c.style.width=a+"px",c.style.height=s+"px",$GetWnds(l).append(c),$MakeResizable(c),Q.addEvent(c,"mousedown",$BindWindowMessage(c,MESSAGE.ACTIVATE)),$CreateWindowTitlebar(c),$SetWindowTitle(c,c.title_text),c.hClientArea=document.createElement("DIV"),c.hClientArea.className="q-window-client",c.appendChild(c.hClientArea),c.hBottomBar=document.createElement("DIV"),c.hBottomBar.className="q-bottom-bar",c.appendChild(c.hBottomBar),$CreateMaskLayer(c),Q.addClass(c,n),$BindWindowMessage(c,MESSAGE.CREATE)(),d.appendChild(c),Q.drag({id:c,objects:[c.hTitle,c.hTitle.hTitleCtrlBar,c.hTitle.hTitleContent],onmove_begin:Q.bind_handler(c,function(e,t){$GetWindowStatus(this)!=CONST.SIZE_MAX&&c.on_move_begin&&c.on_move_begin(e,t)}),onmove:Q.bind_handler(c,function(e,t){$GetWindowStatus(this)!=CONST.SIZE_MAX&&$MoveTo(this,e,t)}),onmove_end:Q.bind_handler(c,function(e,t){$GetWindowStatus(this)!=CONST.SIZE_MAX&&c.on_move_end&&c.on_move_end(e,t)})}),c}function $DestroyWindow(e){var t=$GetWnds(e);t.each(function(e){return $BindWindowMessage(e,MESSAGE.CLOSE)(),!0});var n=$GetContainerWindow(e),i=$GetWnds(n);i.each(function(t){return $GetParentWindow(t)==e&&$BindWindowMessage(t,MESSAGE.CLOSE)(),!0}),i.erase(e),e.setAttribute("__QWindow",null),e.parentNode&&e.parentNode.removeChild(e),e=0;var o=$GetTopZIndexWindow(n);$IsNull(o)?$SetActiveChild(n,null):$IsWindow(o)?$BindWindowMessage(o,MESSAGE.ACTIVATE)():$BindWindowMessage(n,MESSAGE.ACTIVATE)()}function $MakeResizable(e){function t(t){t=t||window.event;var n=$GetWindowStatus(e);Q.printf("mousedown out"+n),n!=CONST.SIZE_MAX&&t.button==Q.LBUTTON&&e.style.cursor&&(Q.printf("mousedown in"+n),$SetWindowStatus(e,CONST.SIZE_RESIZING),e.setCapture?e.setCapture():window.captureEvents&&window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP))}function n(t){t=t||window.event;var n=$GetWindowStatus(e);n!=CONST.SIZE_MAX&&n==CONST.SIZE_RESIZING&&t.button==Q.LBUTTON&&(Q.printf("mouseup in "+n),$SetWindowStatus(e,CONST.SIZE_NORMAL),e.releaseCapture?e.releaseCapture():window.releaseEvents&&window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP))}function i(t){t=t||window.event;var n=t.srcElement||t.target,i=$GetWindowStatus(e);if(!(i&CONST.SIZE_MAX||$IsStyle(e,CONST.fixed)||i==CONST.SIZE_MIN))if(i==CONST.SIZE_RESIZING){var f=t.screenX-d,p=t.screenY-l;c.indexOf("w")>-1?o+=f:c.indexOf("e")>-1&&(s+=f),c.indexOf("n")>-1?a+=p:c.indexOf("s")>-1&&(r+=p);var m=e.style;s-o>__GLOBALS.MIN_WIDTH&&(m.left=o+"px",m.width=s-o+"px"),r-a>__GLOBALS.MIN_HEIGHT&&(m.top=a+"px",m.height=r-a+"px"),$ResizeTo(e,m.offsetWidth,m.offsetHeight),d+=f,l+=p}else if(n==e){var _=void 0==t.offsetX?t.layerX:t.offsetX,v=void 0==t.offsetY?t.layerY:t.offsetY,g=e.currentStyle;w=parseInt(g.width,10),h=parseInt(g.height,10);var y=parseInt(g.left,10),E=parseInt(g.top,10);c=u>v?"n":h-v<u?"s":"",c+=u>_?"w":w-_<u?"e":"",c?(e.style.cursor=c+"-resize",o=y,a=E,s=o+w,r=a+h,d=t.screenX,l=t.screenY):e.style.cursor&&(e.style.cursor="")}else e.style.cursor=""}var o,a,s,r,d,l,c,u=11;Q.addEvent(document,"mousedown",t),Q.addEvent(document,"mouseup",n),Q.addEvent(document,"mousemove",i)}function qid(e,t){function n(e){for(var i=null,o=0;o<e.childNodes.length;o++){var a=e.childNodes[o];if(a.nodeType===Q.ELEMENT_NODE){if(a.getAttribute("q:id")==t){i=a;break}if(i=n(a))break}}return i}return n(e)}function find_item(e,t){if(!e)return null;for(var n=e.childNodes,i=0;i<n.length;i++){var o=n[i];if(t(o))return o;var a=find_item(o,t);if(a)return a}return null}function get_app(e){return g_simple_os?g_simple_os.apps[e]:null}function treeNode(e,t,n,i,o,a){this.parent=t,this.idx=e,this.level=n,this.isLastChild=a,this.isopen=i,this.lastChild=TREEITEM_NULL,this.firstChild=TREEITEM_NULL,this.text=o,this.hwnd=null,this.subarea=null,this.textNode=null,this.expand=null}function _cancelBubble(t){e=t?t:window.event,document.all?e.cancelBubble=!0:e.stopPropagation()}function loadcalendar(){s="",s+='<div id="calendar" style="display:none; position:absolute; z-index:9;" onclick="_cancelBubble(event)">',document.all&&(s+='<iframe width="200" height="160" src="about:blank" style="position: absolute;z-index:-1;"></iframe>'),s+='<div style="width: 200px;"><table class="tableborder" cellspacing="0" cellpadding="0" width="100%" style="text-align: center">',s+='<tr align="center" class="header"><td class="header"><a href="#" onclick="refreshcalendar(yy, mm-1);return false" title="上一月">&lt;&lt;</a></td><td colspan="5" style="text-align: center" class="header"><a href="#" onclick="showdiv(\'year\');_cancelBubble(event);return false" title="点击选择年份" id="year"></a>&nbsp;/ &nbsp;<a id="month" title="点击选择月份" href="#" onclick="showdiv(\'month\');_cancelBubble(event);return false"></a></td><td class="header"><A href="#" onclick="refreshcalendar(yy, mm+1);return false" title="下一月">&gt;&gt;</A></td></tr>',s+='<tr class="category"><td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td></tr>';for(var e=0;6>e;e++){s+='<tr class="altbg2">';for(var t=1;7>=t;t++)s+="<td id=d"+(7*e+t)+' height="19">0</td>';s+="</tr>"}s+='<tr id="hourminute"><td colspan="7" align="center"><input type="text" size="1" value="" id="hour" onKeyUp=\'this.value=this.value > 23 ? 23 : zerofill(this.value);controlid.value=controlid.value.replace(/\\d+(:\\d+)/ig, this.value+"$1")\'> 点 <input type="text" size="1" value="" id="minute" onKeyUp=\'this.value=this.value > 59 ? 59 : zerofill(this.value);controlid.value=controlid.value.replace(/(\\d+:)\\d+/ig, "$1"+this.value)\'> 分</td></tr>',s+="</table></div></div>",s+='<div id="calendar_year" onclick="_cancelBubble(event)"><div class="col">';for(var n=1930;2019>=n;n++)s+=1930!=n&&n%10==0?'</div><div class="col">':"",s+='<a href="#" onclick="refreshcalendar('+n+", mm);Q.$('calendar_year').style.display='none';return false\"><span"+(today.getFullYear()==n?' class="today"':"")+' id="calendar_year_'+n+'">'+n+"</span></a><br />";s+="</div></div>",s+='<div id="calendar_month" onclick="_cancelBubble(event)">';for(var n=1;12>=n;n++)s+='<a href="#" onclick="refreshcalendar(yy, '+(n-1)+");Q.$('calendar_month').style.display='none';return false\"><span"+(today.getMonth()+1==n?' class="today"':"")+' id="calendar_month_'+n+'">'+n+(10>n?"&nbsp;":"")+" 月</span></a><br />";s+="</div>";var i=document.createElement("div");i.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(i),Q.addEvent(document,"click",function(){Q.$("calendar").style.display="none",Q.$("calendar_year").style.display="none",Q.$("calendar_month").style.display="none"}),Q.$("calendar").onclick=function(e){_cancelBubble(e),Q.$("calendar_year").style.display="none",Q.$("calendar_month").style.display="none"}}function parsedate(e){/(\d+)\-(\d+)\-(\d+)\s*(\d*):?(\d*)/.exec(e);var t=RegExp.$1&&RegExp.$1>1899&&RegExp.$1<2101?parseFloat(RegExp.$1):today.getFullYear(),n=RegExp.$2&&RegExp.$2>0&&RegExp.$2<13?parseFloat(RegExp.$2):today.getMonth()+1,i=RegExp.$3&&RegExp.$3>0&&RegExp.$3<32?parseFloat(RegExp.$3):today.getDate(),o=RegExp.$4&&RegExp.$4>-1&&RegExp.$4<24?parseFloat(RegExp.$4):0,a=RegExp.$5&&RegExp.$5>-1&&RegExp.$5<60?parseFloat(RegExp.$5):0;return/(\d+)\-(\d+)\-(\d+)\s*(\d*):?(\d*)/.exec("0000-00-00 00:00"),new Date(t,n-1,i,o,a)}function settime(e){Q.$("calendar").style.display="none",controlid.value=yy+"-"+zerofill(mm+1)+"-"+zerofill(e)+(addtime?" "+zerofill(Q.$("hour").value)+":"+zerofill(Q.$("minute").value):"")}function showcalendar(e,t,n,i,o){controlid=t,addtime=n,startdate=i?parsedate(i):!1,enddate=o?parsedate(o):!1,currday=controlid.value?parsedate(controlid.value):today,hh=currday.getHours(),ii=currday.getMinutes();var a=Q.absPosition(Q.$(controlid));Q.$("calendar").style.display="block",Q.$("calendar").style.left=a.left+a.width+1+"px",Q.$("calendar").style.top=a.top+2+"px",_cancelBubble(e),refreshcalendar(currday.getFullYear(),currday.getMonth()),0!=lastcheckedyear&&(Q.$("calendar_year_"+lastcheckedyear).className="default",Q.$("calendar_year_"+today.getFullYear()).className="today"),0!=lastcheckedmonth&&(Q.$("calendar_month_"+lastcheckedmonth).className="default",Q.$("calendar_month_"+(today.getMonth()+1)).className="today"),Q.$("calendar_year_"+currday.getFullYear()).className="checked",Q.$("calendar_month_"+(currday.getMonth()+1)).className="checked",Q.$("hourminute").style.display=addtime?"":"none",lastcheckedyear=currday.getFullYear(),lastcheckedmonth=currday.getMonth()+1}function refreshcalendar(e,t){var n=new Date(e,t,1),i=n.getDay(),o=n.getDate(),a=null;yy=n.getFullYear(),mm=n.getMonth(),Q.$("year").innerHTML=yy,Q.$("month").innerHTML=mm+1>9?mm+1:"0"+(mm+1);for(var s=1;i>=s;s++)a=Q.$("d"+s),a.innerHTML="&nbsp;",a.className="";for(;n.getMonth()==mm;)a=Q.$("d"+(o+i)),a.innerHTML='<a href="###" onclick="settime('+o+');return false">'+o+"</a>",a.className=n.getTime()<today.getTime()||enddate&&n.getTime()>enddate.getTime()||startdate&&n.getTime()<startdate.getTime()?"expire":"default",n.getFullYear()==today.getFullYear()&&n.getMonth()==today.getMonth()&&n.getDate()==today.getDate()&&(a.className="today",a.firstChild.title="今天"),n.getFullYear()==currday.getFullYear()&&n.getMonth()==currday.getMonth()&&n.getDate()==currday.getDate()&&(a.className="checked"),n.setDate(++o);for(;42>=o+i;)a=Q.$("d"+(o+i)),a.innerHTML="&nbsp;",o++;addtime&&(Q.$("hour").value=zerofill(hh),Q.$("minute").value=zerofill(ii))}function showdiv(e){var t=Q.absPosition(Q.$(e));Q.$("calendar_"+e).style.left=t.left+"px",Q.$("calendar_"+e).style.top=t.top+16+"px",Q.$("calendar_"+e).style.display="block"}function zerofill(e){var e=parseFloat(e.toString().replace(/(^[\s0]+)|(\s+$)/g,""));return e=isNaN(e)?0:e,(10>e?"0":"")+e.toString()}function XMLDocument(e){var t=null;try{if(window.ActiveXObject)t=new ActiveXObject("Microsoft.XMLDOM");else{if(!document.implementation||!document.implementation.createDocument)throw new Error("浏览器不支持.");t=document.implementation.createDocument("","",null)}if(t.async=!1,e&&!t.load(e))throw new Error("加载xml文件出错!")}catch(n){try{var i=new window.XMLHttpRequest;e&&(i.open("GET",e,!1),i.send(null),t=i.responseXML.documentElement.ownerDocument)}catch(n){alert(n),t=null}}return t}function _cancelBubble(t){e=t?t:window.event,document.all?e.cancelBubble=!0:e.stopPropagation()}function loadcalendar(){s="",s+='<div id="calendar" style="display:none; position:absolute; z-index:9;" onclick="_cancelBubble(event)">',document.all&&(s+='<iframe width="200" height="160" src="about:blank" style="position: absolute;z-index:-1;"></iframe>'),s+='<div style="width: 200px;"><table class="tableborder" cellspacing="0" cellpadding="0" width="100%" style="text-align: center">',s+='<tr align="center" class="header"><td class="header"><a href="#" onclick="refreshcalendar(yy, mm-1);return false" title="上一月">&lt;&lt;</a></td><td colspan="5" style="text-align: center" class="header"><a href="#" onclick="showdiv(\'year\');_cancelBubble(event);return false" title="点击选择年份" id="year"></a>&nbsp;/ &nbsp;<a id="month" title="点击选择月份" href="#" onclick="showdiv(\'month\');_cancelBubble(event);return false"></a></td><td class="header"><A href="#" onclick="refreshcalendar(yy, mm+1);return false" title="下一月">&gt;&gt;</A></td></tr>',s+='<tr class="category"><td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td></tr>';for(var e=0;6>e;e++){s+='<tr class="altbg2">';for(var t=1;7>=t;t++)s+="<td id=d"+(7*e+t)+' height="19">0</td>';s+="</tr>"}s+='<tr id="hourminute"><td colspan="7" align="center"><input type="text" size="1" value="" id="hour" onKeyUp=\'this.value=this.value > 23 ? 23 : zerofill(this.value);controlid.value=controlid.value.replace(/\\d+(:\\d+)/ig, this.value+"$1")\'> 点 <input type="text" size="1" value="" id="minute" onKeyUp=\'this.value=this.value > 59 ? 59 : zerofill(this.value);controlid.value=controlid.value.replace(/(\\d+:)\\d+/ig, "$1"+this.value)\'> 分</td></tr>',s+="</table></div></div>",s+='<div id="calendar_year" onclick="_cancelBubble(event)"><div class="col">';for(var n=1930;2019>=n;n++)s+=1930!=n&&n%10==0?'</div><div class="col">':"",s+='<a href="#" onclick="refreshcalendar('+n+", mm);Q.$('calendar_year').style.display='none';return false\"><span"+(today.getFullYear()==n?' class="today"':"")+' id="calendar_year_'+n+'">'+n+"</span></a><br />";s+="</div></div>",s+='<div id="calendar_month" onclick="_cancelBubble(event)">';for(var n=1;12>=n;n++)s+='<a href="#" onclick="refreshcalendar(yy, '+(n-1)+");Q.$('calendar_month').style.display='none';return false\"><span"+(today.getMonth()+1==n?' class="today"':"")+' id="calendar_month_'+n+'">'+n+(10>n?"&nbsp;":"")+" 月</span></a><br />";s+="</div>";var i=document.createElement("div");i.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(i),Q.addEvent(document,"click",function(){Q.$("calendar").style.display="none",Q.$("calendar_year").style.display="none",Q.$("calendar_month").style.display="none"}),Q.$("calendar").onclick=function(e){_cancelBubble(e),Q.$("calendar_year").style.display="none",Q.$("calendar_month").style.display="none"}}function parsedate(e){/(\d+)\-(\d+)\-(\d+)\s*(\d*):?(\d*)/.exec(e);var t=RegExp.$1&&RegExp.$1>1899&&RegExp.$1<2101?parseFloat(RegExp.$1):today.getFullYear(),n=RegExp.$2&&RegExp.$2>0&&RegExp.$2<13?parseFloat(RegExp.$2):today.getMonth()+1,i=RegExp.$3&&RegExp.$3>0&&RegExp.$3<32?parseFloat(RegExp.$3):today.getDate(),o=RegExp.$4&&RegExp.$4>-1&&RegExp.$4<24?parseFloat(RegExp.$4):0,a=RegExp.$5&&RegExp.$5>-1&&RegExp.$5<60?parseFloat(RegExp.$5):0;return/(\d+)\-(\d+)\-(\d+)\s*(\d*):?(\d*)/.exec("0000-00-00 00:00"),new Date(t,n-1,i,o,a)}function settime(e){Q.$("calendar").style.display="none",controlid.value=yy+"-"+zerofill(mm+1)+"-"+zerofill(e)+(addtime?" "+zerofill(Q.$("hour").value)+":"+zerofill(Q.$("minute").value):"")}function showcalendar(e,t,n,i,o){controlid=t,addtime=n,startdate=i?parsedate(i):!1,enddate=o?parsedate(o):!1,currday=controlid.value?parsedate(controlid.value):today,hh=currday.getHours(),ii=currday.getMinutes();var a=Q.absPosition(Q.$(controlid));Q.$("calendar").style.display="block",Q.$("calendar").style.left=a.left+a.width+1+"px",Q.$("calendar").style.top=a.top+2+"px",_cancelBubble(e),refreshcalendar(currday.getFullYear(),currday.getMonth()),0!=lastcheckedyear&&(Q.$("calendar_year_"+lastcheckedyear).className="default",Q.$("calendar_year_"+today.getFullYear()).className="today"),0!=lastcheckedmonth&&(Q.$("calendar_month_"+lastcheckedmonth).className="default",Q.$("calendar_month_"+(today.getMonth()+1)).className="today"),Q.$("calendar_year_"+currday.getFullYear()).className="checked",Q.$("calendar_month_"+(currday.getMonth()+1)).className="checked",Q.$("hourminute").style.display=addtime?"":"none",lastcheckedyear=currday.getFullYear(),lastcheckedmonth=currday.getMonth()+1}function refreshcalendar(e,t){var n=new Date(e,t,1),i=n.getDay(),o=n.getDate(),a=null;yy=n.getFullYear(),mm=n.getMonth(),Q.$("year").innerHTML=yy,Q.$("month").innerHTML=mm+1>9?mm+1:"0"+(mm+1);for(var s=1;i>=s;s++)a=Q.$("d"+s),a.innerHTML="&nbsp;",a.className="";for(;n.getMonth()==mm;)a=Q.$("d"+(o+i)),a.innerHTML='<a href="###" onclick="settime('+o+');return false">'+o+"</a>",a.className=n.getTime()<today.getTime()||enddate&&n.getTime()>enddate.getTime()||startdate&&n.getTime()<startdate.getTime()?"expire":"default",n.getFullYear()==today.getFullYear()&&n.getMonth()==today.getMonth()&&n.getDate()==today.getDate()&&(a.className="today",a.firstChild.title="今天"),n.getFullYear()==currday.getFullYear()&&n.getMonth()==currday.getMonth()&&n.getDate()==currday.getDate()&&(a.className="checked"),n.setDate(++o);for(;42>=o+i;)a=Q.$("d"+(o+i)),a.innerHTML="&nbsp;",o++;addtime&&(Q.$("hour").value=zerofill(hh),Q.$("minute").value=zerofill(ii))}function showdiv(e){var t=Q.absPosition(Q.$(e));Q.$("calendar_"+e).style.left=t.left+"px",Q.$("calendar_"+e).style.top=t.top+16+"px",Q.$("calendar_"+e).style.display="block"}function zerofill(e){var e=parseFloat(e.toString().replace(/(^[\s0]+)|(\s+$)/g,""));return e=isNaN(e)?0:e,(10>e?"0":"")+e.toString()}!function(){if(window.undefined=window.undefined,window.Q)return void alert("conflict name for Q");var e=null,t={},n={},i=[];String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")},String.prototype.trim_left=function(){return this.replace(/(^\s*)/g,"")},String.prototype.trim_right=function(){return this.replace(/(\s*$)/g,"")},Object.create||(Object.create=function(e,t){function n(){}if("undefined"!=typeof t)throw"The multiple-argument version of Object.create is not provided";return n.prototype=e,new n});var o=function(){};o.prototype.extend=function(e){var t=this.prototype,n=function(){this.__init__.apply(this,arguments)};n.prototype=Object.create(t);for(var i in e)n.prototype[i]=e[i];return n.prototype.constructor=n,n.extend=t.extend,n},o.extend=function(e){return this.prototype.extend.call(this,e)},window.Q=o,o.ELEMENT_NODE=1,o.ELEMENT_TEXTNODE=3,o.LBUTTON=1,o.RBUTTON=2,o.MBUTTON=4,o.setDebug=function(t){e=t},o.printf=function(t){e&&e.nodeType===o.ELEMENT_NODE?(e.innerHTML+="<br/>"+t,e.scrollTop=e.scrollHeight):window.console&&window.console.log(t)},o.$=function(e){if("string"!=typeof e)return e;if(e&&e.nodeType===o.ELEMENT_NODE)return e;var n=t[e];return n&&null!==n.parentElement||(n=document.getElementById(e),n&&(t[e]=n)),n},o.bind_handler=function(e,t){return function(){return t.apply(e,arguments)}},o.addEvent=function(e,t,n,i){var a=o.$(e);a.addEventListener?a.addEventListener(t,n,!!i):a.attachEvent?a.attachEvent("on"+t,n):oTarget["on"+t]=n},o.removeEvent=function(e,t,n){obj=o.$(e),obj.removeEventListener?obj.removeEventListener(t,n,!1):obj.detachEvent?obj.detachEvent("on"+t,n):obj["on"+t]=null},o.fireEvent=function(e,t){if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent(t,!0,!1),e.dispatchEvent(n)}else document.createEventObject&&e.fireEvent("on"+t)},o.addClass=function(e,t){for(var n=(e.className+" "+t).trim().split(/\s+/),i="",o={},a=0;a<n.length;a++)o[n[a]]=0;for(var s in o)i+=s+" ";return e.className=i.trim(),e},o.removeClass=function(e,t){for(var n=(e.className+"").split(/\s+/),i=(t+"").split(/\s+/),o=[],a=0;a<n.length;a++){for(var s=!1,r=0;r<i.length;r++)n[a]==i[r]&&(s=!0);s||o.push(n[a])}return e.className=o.join(" "),e},o.hasClass=function(e,t){for(var n=(e.className+" ").split(/\s+/),i=0;i<n.length;i++)if(n[i]==t)return!0;return!1},o.dblclick=function(e,t){e=o.$(e),o.addEvent(e,"click",function(e){return function(){return e.__clickonce__?(e.__clickonce__=!1,clearTimeout(e.t),t&&t(e)):(e.__clickonce__=!0,e.t=setTimeout(function(t){return function(){t.__clickonce__=!1,click&&click(e)}}(e),200)),!1}}(e))},o.locale_text=function(e,t){return t},o.set_locale_text=function(e){"function"==typeof e&&(o.locale_text=e)},o.absPosition=function(e){for(var t=e.offsetWidth,n=e.offsetHeight,i=e.offsetTop,o=e.offsetLeft;e=e.offsetParent;)i+=e.offsetTop,o+=e.offsetLeft;return{width:t,height:n,left:o,top:i}},o.absPositionEx=function(e){if(!e.getBoundingClientRect)return o.absPosition(e);var t=e.getBoundingClientRect(),n=t.left+document.documentElement.scrollLeft,i=t.top+document.documentElement.scrollTop,a=t.width,s=t.height;return{width:a,height:s,left:n,top:i}},o.scrollInfo=function(){var e,t,n,i;return document.documentElement&&(document.documentElement.scrollTop||document.documentElement.scrollLeft)?(e=document.documentElement.scrollTop,t=document.documentElement.scrollLeft,n=document.documentElement.scrollWidth,i=document.documentElement.scrollHeight):document.body&&(e=document.body.scrollTop,t=document.body.scrollLeft,n=document.body.scrollWidth,i=document.body.scrollHeight),{t:e,l:t,w:n,h:i}},o.workspace=function(){var e=document.body.clientHeight;document.documentElement.clientHeight&&(e=document.documentElement.clientHeight);var t=document.body.clientWidth;return document.documentElement.clientWidth&&(t=document.documentElement.clientWidth),{width:t,height:e}},o.copy=function(e){var t={};for(var n in e)t[n]=e[n];return t},o.query=function(e){return n[e]},o.delayDOMReady=function(){for(;i.length>0;)i.shift()()},o.ready=function(e,t){var n=!t;n?i.push(e):i.unshift(e)},o.loadModule=function(e,t){var n=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.src=e+"?"+(new Date).getTime(),i.done=!1,i.onload=i.onreadystatechange=function(){this.done||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(this.done=!0,t(!0),this.onload=this.onreadystatechange=null,n.removeChild(this))},i.onerror=function(){this.onload=this.onreadystatechange=null,n.removeChild(this),t(!1)},n.appendChild(i)},o.agent=function(){return navigator.userAgent.toLowerCase()},o.isW3C=function(){return document.getElementById?!0:!1},o.isIE=function(){var e=o.agent();return-1!=e.indexOf("msie")&&-1==e.indexOf("opera")&&-1==e.indexOf("omniweb")},o.isOpera=function(){return-1!=o.agent().indexOf("opera")},o.isNS6=function(){return o.isW3C()&&"Netscape"==navigator.appName},o.isNS6()&&(HTMLElement.prototype.__defineGetter__("innerText",function(){return this.textContent}),HTMLElement.prototype.__defineSetter__("innerText",function(e){this.textContent=e}),HTMLElement.prototype.__defineGetter__("currentStyle",function(){return this.ownerDocument.defaultView.getComputedStyle(this,null)}),o.LBUTTON=0,o.MBUTTON=1);for(var a=location.search.slice(1).split("&"),s=0;s<a.length;s++){var r=a[s].indexOf("=");if(r>=0){var d=a[s].substring(0,r),l=a[s].substring(r+1);n[d]=l}}var c=setInterval(function(e,t){return function(){"complete"==document.readyState&&(e.loaded=!0,o.delayDOMReady(),clearInterval(t))}}(o,c),100);o.addEvent(window,"load",function(){o.loaded||(o.loaded=!0,o.delayDOMReady())})}(),Q.List=Q.extend({head:null,length:0,__init__:function(){},Node:function(e){this.next=null,this.prev=null,this.data=e},begin:function(){return this.head},end:function(){return null},size:function(){return this.length},item:function(){return this.current.data},each:function(e){if("function"==typeof e)for(var t=this.begin();t!=this.end()&&e(t.data);t=t.next);},append:function(e){var t=new this.Node(e);if(this.head){for(var n=this.head;n.next;)n=n.next;n.next=t,t.prev=n}else this.head=t;this.length++},erase:function(e){var t=this.find(e);t&&(t!=this.head?(t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev)):(this.head=t.next,t.next&&(t.next.prev=null)),delete t,this.length--)},clear:function(){for(var e=this.begin();e!=this.end();e=e.next)this.removeNode(e)},find:function(e){for(var t=this.begin();t!=this.end();t=t.next)if(t.data==e)return t;return null}}),Q.HashMap=Q.extend({base:null,length:0,index:0,__init__:function(){this.base=new Object},each:function(e){if("function"==typeof e)for(var t in this.base)if(0==e(this.base[t],t))break},item:function(e){return this.base[e];
},add:function(e,t){this.base[e]=t,this.length++},remove:function(e){this.has(e)&&(delete this.base[e],this.length--)},clear:function(){var e=this;this.each(function(t,n){e.remove(n)}),this.length=0},push:function(e){this.base[this.index]=e,this.length++,this.index++},pop:function(){var e=this.base[this.dataIndex];return delete this.base[this.dataIndex],this.length--,e},find:function(e){var t=null;return this.each(function(n,i){return n==e?(t=i,0):void 0}),t},has:function(e){return!("undefined"==typeof this.base[e])}});var Tween={Linear:function(e,t,n,i){return n*e/i+t},Quad:{easeIn:function(e,t,n,i){return n*(e/=i)*e+t},easeOut:function(e,t,n,i){return-n*(e/=i)*(e-2)+t},easeInOut:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}},Cubic:{easeIn:function(e,t,n,i){return n*(e/=i)*e*e+t},easeOut:function(e,t,n,i){return n*((e=e/i-1)*e*e+1)+t},easeInOut:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}},Quart:{easeIn:function(e,t,n,i){return n*(e/=i)*e*e*e+t},easeOut:function(e,t,n,i){return-n*((e=e/i-1)*e*e*e-1)+t},easeInOut:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t}},Quint:{easeIn:function(e,t,n,i){return n*(e/=i)*e*e*e*e+t},easeOut:function(e,t,n,i){return n*((e=e/i-1)*e*e*e*e+1)+t},easeInOut:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t}},Sine:{easeIn:function(e,t,n,i){return-n*Math.cos(e/i*(Math.PI/2))+n+t},easeOut:function(e,t,n,i){return n*Math.sin(e/i*(Math.PI/2))+t},easeInOut:function(e,t,n,i){return-n/2*(Math.cos(Math.PI*e/i)-1)+t}},Expo:{easeIn:function(e,t,n,i){return 0==e?t:n*Math.pow(2,10*(e/i-1))+t},easeOut:function(e,t,n,i){return e==i?t+n:n*(-Math.pow(2,-10*e/i)+1)+t},easeInOut:function(e,t,n,i){return 0==e?t:e==i?t+n:(e/=i/2)<1?n/2*Math.pow(2,10*(e-1))+t:n/2*(-Math.pow(2,-10*--e)+2)+t}},Circ:{easeIn:function(e,t,n,i){return-n*(Math.sqrt(1-(e/=i)*e)-1)+t},easeOut:function(e,t,n,i){return n*Math.sqrt(1-(e=e/i-1)*e)+t},easeInOut:function(e,t,n,i){return(e/=i/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:n/2*(Math.sqrt(1-(e-=2)*e)+1)+t}},Elastic:{easeIn:function(e,t,n,i,o,a){if(0==e)return t;if(1==(e/=i))return t+n;if(a||(a=.3*i),!o||o<Math.abs(n)){o=n;var s=a/4}else var s=a/(2*Math.PI)*Math.asin(n/o);return-(o*Math.pow(2,10*(e-=1))*Math.sin(2*(e*i-s)*Math.PI/a))+t},easeOut:function(e,t,n,i,o,a){if(0==e)return t;if(1==(e/=i))return t+n;if(a||(a=.3*i),!o||o<Math.abs(n)){o=n;var s=a/4}else var s=a/(2*Math.PI)*Math.asin(n/o);return o*Math.pow(2,-10*e)*Math.sin(2*(e*i-s)*Math.PI/a)+n+t},easeInOut:function(e,t,n,i,o,a){if(0==e)return t;if(2==(e/=i/2))return t+n;if(a||(a=.3*i*1.5),!o||o<Math.abs(n)){o=n;var s=a/4}else var s=a/(2*Math.PI)*Math.asin(n/o);return 1>e?-.5*o*Math.pow(2,10*(e-=1))*Math.sin(2*(e*i-s)*Math.PI/a)+t:o*Math.pow(2,-10*(e-=1))*Math.sin(2*(e*i-s)*Math.PI/a)*.5+n+t}},Back:{easeIn:function(e,t,n,i,o){return void 0==o&&(o=1.70158),n*(e/=i)*e*((o+1)*e-o)+t},easeOut:function(e,t,n,i,o){return void 0==o&&(o=1.70158),n*((e=e/i-1)*e*((o+1)*e+o)+1)+t},easeInOut:function(e,t,n,i,o){return void 0==o&&(o=1.70158),(e/=i/2)<1?n/2*e*e*(((o*=1.525)+1)*e-o)+t:n/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+t}},Bounce:{easeIn:function(e,t,n,i){return n-Tween.Bounce.easeOut(i-e,0,n,i)+t},easeOut:function(e,t,n,i){return(e/=i)<1/2.75?7.5625*n*e*e+t:2/2.75>e?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:2.5/2.75>e?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOut:function(e,t,n,i){return i/2>e?.5*Tween.Bounce.easeIn(2*e,0,n,i)+t:.5*Tween.Bounce.easeOut(2*e-i,0,n,i)+.5*n+t}}};Q.Animate=Q.extend({func:null,bind:null,timer:null,begin:0,duration:0,max:0,__init__:function(e){var t=this;return t.func="Linear"!=e.tween&&Tween[e.tween]?Tween[e.tween][e.ease]?Tween[e.tween][e.ease]:Tween[e.tween].easeIn:Tween.Linear,t.bind=e.bind,t.duration=e.duration,t.max=e.max,t.begin=e.begin,this},play:function(){function e(){o>n?(n++,t.bind(Math.ceil(t.func(n,0,i,o))),t._timer=setTimeout(e,10)):t.bind(i)}var t=this,n=t.begin,i=t.max,o=t.duration;clearTimeout(t._timer),e()}}),this.JSON||(JSON={}),function(){function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,i,o,a,s,r=gap,d=t[e];switch(d&&"object"==typeof d&&"function"==typeof d.toJSON&&(d=d.toJSON(e)),"function"==typeof rep&&(d=rep.call(t,e,d)),typeof d){case"string":return quote(d);case"number":return isFinite(d)?String(d):"null";case"boolean":case"null":return String(d);case"object":if(!d)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(d)){for(a=d.length,n=0;a>n;n+=1)s[n]=str(n,d)||"null";return o=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+r+"]":"["+s.join(",")+"]",gap=r,o}if(rep&&"object"==typeof rep)for(a=rep.length,n=0;a>n;n+=1)i=rep[n],"string"==typeof i&&(o=str(i,d),o&&s.push(quote(i)+(gap?": ":":")+o));else for(i in d)Object.hasOwnProperty.call(d,i)&&(o=str(i,d),o&&s.push(quote(i)+(gap?": ":":")+o));return o=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+r+"}":"{"+s.join(",")+"}",gap=r,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,n){var i;if(gap="",indent="","number"==typeof n)for(i=0;n>i;i+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,i,o=e[t];if(o&&"object"==typeof o)for(n in o)Object.hasOwnProperty.call(o,n)&&(i=walk(o,n),void 0!==i?o[n]=i:delete o[n]);return reviver.call(e,t,o)}var j;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),Q.rnd=function(e){for(var t="",n="abcdef1234567890".split(""),i=0;e>i;i++)t+=""+n[Math.round(Math.random()*(n.length-1))];return t},Q.json2str=function(e){return JSON.stringify(e,function(e,t){return t})},Q.json_decode=function(e){return JSON.parse(e)},Q.json_encode=function(e){return JSON.stringify(e)},Q.ajaxc=function(e){function t(e){return"postdata="+encodeURIComponent(encodeURIComponent(Q.json2str(e)))}var n=!!e.queue;n?ajaxQueue(e,t):newAjax(e,t)},Q.ajax=function(e){function t(e){var t=null;for(var n in e)t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n])+"&";return t}var n=!!e.queue;n?ajaxQueue(e,t):newAjax(e,t)},function(e){var t,n=e.extend({capture_wnd:null,is_drag:!1,x:0,y:0,begin_left:0,begin_top:0,mousedown_Hanlder:null,mouseup_handler:null,mousemove_handler:null,is_moved:!1,timer:null,__init__:function(){var t=this;t.mousedown_hanlder=function(e){t._mousedown(e)},t.mouseup_handler=function(e){t._mouseup(e)},t.mousemove_handler=function(e){t._mousemove(e)},e.addEvent(document,"mousedown",t.mousedown_hanlder),e.addEvent(document,"mouseup",t.mouseup_handler)},attach_object:function(t){var n=t||{},i=e.$(n.id),n=n||{};i.setAttribute("q-drag-object",!0),i.q_drag_objects=new e.List,i.q_onmove_begin=n.onmove_begin||function(){},i.q_onmove_end=n.onmove_end||function(){},i.q_onmove=n.onmove||function(e,t){var n=this;n.style.left=e+"px",n.style.top=t+"px"},n.self&&this.add_drag_handler(i,i);for(var o=n.objects||[],a=0;a<o.length;a++)this.add_drag_handler(i,e.$(o[a]))},deattach_object:function(t){var n=e.$(t);n.removeAttribute("q-drag-object")},add_drag_handler:function(e,t){e.q_drag_objects.append(t)},remove_drag_handler:function(e,t){e.q_drag_objects.erase(t)},is_drag_handler:function(e,t){return this.is_dragable(e)&&e.q_drag_objects.find(t)},is_dragable:function(t){var n=e.$(t);return n&&n.getAttribute&&!!n.getAttribute("q-drag-object")},zoom:function(e){return this.capture_wnd&&this.capture_wnd.style.zoom?e/(1*this.capture_wnd.style.zoom):e},_mousedown:function(t){if(t=t||window.event,t.button!=e.RBUTTON){for(var n=drag_handle=e.isNS6()?t.target:t.srcElement;n&&!this.is_dragable(n)&&n!=document.body;)n=n.parentNode;return n&&this.is_drag_handler(n,drag_handle)?(this.capture_wnd=n,this.is_drag=!0,this.x=t.clientX,this.y=t.clientY,this.begin_left=n.offsetLeft,this.begin_top=n.offsetTop,this.capture_wnd.q_onmove_begin&&this.capture_wnd.q_onmove_begin(this.begin_left+this.zoom(this.x),this.begin_top+this.zoom(this.y)),this.timer=setTimeout(e.bind_handler(this,function(){e.addEvent(document,"mousemove",this.mousemove_handler)}),10),!1):void 0}},_mousemove:function(e){if(this.is_moved=!0,e=e||window.event,this.is_drag){var t=e.clientX-this.x,n=e.clientY-this.y;return this.capture_wnd.q_onmove(this.begin_left+this.zoom(t),this.begin_top+this.zoom(n)),!1}},_mouseup:function(){clearTimeout(this.timer),this.is_drag&&(this.is_drag=!1,e.removeEvent(document,"mousemove",this.mousemove_handler),this.capture_wnd.q_onmove_end&&this.capture_wnd.q_onmove_end(this.zoom(this.x),this.zoom(this.y))),this.is_moved=!1}});e.drag=function(e){t||(t=new n),t.attach_object(e)},e.dragno=function(e){t&&t.deattach_object(e)}}(window.Q);var MENU_SEPERATOR="seperator",MENU_ITEM="item",MENU_ITEM_CHECKBOX="checkbox",MENU_ITEM_RADIO="radio";Q.MenuItem=Q.extend({hwnd:null,parentMenu:null,topMenu:null,titlewnd:null,subwnd:null,iconwnd:null,activeItem:null,type:-2,isAjust:!1,clickHidden:!0,items:null,data:null,isChecked:!0,style:null,__init__:function(e){e=e||{};var t=this;t.items=[],t.parentMenu=e.parentMenu,t.data=e.data,this.style=e.style,this.type=e.type||MENU_ITEM,t.hwnd=document.createElement("LI"),t.titlewnd=document.createElement("DIV"),t.hwnd.appendChild(t.titlewnd),e.type==MENU_SEPERATOR?(t.hwnd.className="q-item-seperator",t.titlewnd.className="q-line"):(t.hwnd.className="q-item",t.titlewnd.className="q-item-title",t.iconwnd=document.createElement("button"),t.iconwnd.className="q-item-icon",t.iconwnd.innerHTML="&nbsp;",t.titlewnd.appendChild(t.iconwnd),t.titlewnd.appendChild(document.createTextNode(e.text+"    ")),e.icon&&(t.iconwnd.style.background=e.icon),t.hwnd.onmouseover=function(e){if(e=e||event,t.parentMenu){var n=t.parentMenu.activeItem;n&&n.hidePopup()}t.parentMenu.activeItem=t,t.showPopup()},t.hwnd.onmouseout=function(e){e=e||event,Q.hasClass(t.hwnd,"q-active")||t.hidePopup()},t.hwnd.onmousedown=function(){return function(){Q.printf("menu onmousedown")}}(this,e),t.hwnd.onmouseup=function(e,t){return function(n){if(Q.printf("menu onmouseup"),n=n||window.event,!e.subwnd){var i=function(){};"function"==typeof t&&(i=t);var o=i(e);return void 0!==o&&o===!1?!1:(e.topMenu&&e.topMenu.hide(),!0)}}}(this,e.callback)),t.hwnd.oncontextmenu=function(){return!1},t.hwnd.onselectstart=function(){return!1}},addSubMenuItem:function(e){this.type!=MENU_SEPERATOR&&this.type!=MENU_ITEM_CHECKBOX&&(this.subwnd||(this.subwnd=document.createElement("DIV"),document.body.appendChild(this.subwnd),this.subwnd.className="q-contextmenu",this.style&&Q.addClass(this.subwnd,this.style),Q.addClass(this.hwnd,"q-more"),this.subwnd.onmousedown=function(e){e=e||event},this.subwnd.oncontextmenu=function(){return!1}),this.subwnd.appendChild(e.hwnd),e.parentMenu=this,e.setTopMenu(this.topMenu),this.items.push(e))},setTopMenu:function(e){this.topMenu=e;for(var t=this.items.length,n=0;t>n;n++)this.items[n].setTopMenu(e)},hidePopup:function(){if(this.subwnd){Q.removeClass(this.hwnd,"q-active"),this.activeItem&&(this.activeItem=null),this.subwnd.style.display="none";for(var e=this.items.length,t=0;e>t;t++)this.items[t].hidePopup()}},showPopup:function(){if(this.subwnd){Q.addClass(this.hwnd,"q-active"),this.subwnd.style.display="";var e=Q.workspace(),t=Q.absPositionEx(this.hwnd),n=0,i=0;t.top+t.height+this.subwnd.offsetHeight>e.height?(i=t.top+t.height-this.subwnd.offsetHeight,0>i&&(i=0)):i=t.top,this.subwnd.offsetWidth+t.left+t.width>e.width?(n=t.left-this.subwnd.offsetWidth,0>n&&(n=0)):n=t.left+t.width;var o=Q.scrollInfo();this.subwnd.style.left=o.l+n+"px",this.subwnd.style.top=o.t+i+"px"}},data:function(){return this.data}}),Q.Menu=Q.extend({hwnd:null,subwnd:null,timer:null,isajust:!1,activeItem:null,items:null,_fHide:null,_fWheel:null,_fOnPopup:null,__init__:function(e){e=e||{};this.items=[],this._fHide=function(e,t){return function(e){e=e||window.event;for(var n=Q.isNS6()?e.target:e.srcElement;n&&!Q.hasClass(n,"q-contextmenu")&&n!=document.body;)n=n.parentNode;return n&&n!=document.body?(e.returnValue=!1,!1):void t()}}(this,Q.bind_handler(this,this.hide)),this._fOnPopup="function"==typeof e.on_popup?e.on_popup:function(){},this.initview(e)},initview:function(e){this.hwnd=document.createElement("DIV"),this.hwnd.className="q-contextmenu",document.body.appendChild(this.hwnd),Q.addClass(this.hwnd,e.style)},addMenuItem:function(e){var t=this;t.hwnd.appendChild(e.hwnd),e.parentMenu=t,e.setTopMenu(t),t.items.push(e)},show:function(e){var t=this,n=Q.scrollInfo(),i=0,o=0;if(e=e||window.event,t.hwnd.style.display="",i=e.clientX+t.hwnd.offsetWidth>document.body.clientWidth?e.clientX+n.l-t.hwnd.offsetWidth-2:e.clientX+n.l,o=e.clientY+t.hwnd.offsetHeight>document.body.clientHeight?e.clientY+n.t-t.hwnd.offsetHeight-2:e.clientY+n.t,t.hwnd.style.left=i+"px",t.hwnd.style.top=o+"px",this._fWheel=document.onmousewheel,document.onmousewheel=function(){return!1},!t.isajust){t.isajust=!0;for(var a=t.hwnd.childNodes,s=a.length,r=0;s>r;r++){var d=a[r];d.style.width=t.hwnd.offsetWidth-2+"px"}}Q.addEvent(window,"blur",t._fHide),Q.addEvent(window,"resize",t._fHide),Q.addEvent(document,"mouseup",t._fHide)},showElement:function(e){var t=this;if(e.nodeType==Q.ELEMENT_NODE){t.hide(),Q.addEvent(document,"mousedown",t._fHide),Q.addEvent(window,"blur",this._fHide),this._fOnPopup(!0),t.hwnd.style.display="";var n=Q.workspace(),i=Q.absPositionEx(e),o=0,a=0;a=i.top+i.height+t.hwnd.offsetHeight>n.height?i.top-t.hwnd.offsetHeight:i.top+i.height,0>a&&(a=i.top+i.height),o=t.hwnd.offsetWidth+i.left>n.width?i.left+i.width-t.hwnd.offsetWidth:i.left;var s=Q.scrollInfo();t.hwnd.style.left=s.l+o+"px",t.hwnd.style.top=s.t+a+"px"}},hide:function(){this.hwnd.style.display="none",Q.removeEvent(window,"blur",this._fHide),Q.removeEvent(document,"mousedown",this._fHide),document.onmousewheel=this._fWheel,this._fOnPopup(!1);for(var e=this.items.length,t=0;e>t;t++)this.items[t].hidePopup()}}),Q.MenuBar=Q.extend({focus:null,items:null,__init__:function(e){e=e||{},this.items=new Q.List,this._hide=Q.bind_handler(this,function(){Q.printf("blur"),Q.removeEvent(document,"mousedown",this._hide),Q.removeEvent(window,"blur",this._hide),this.focus=!1})},append:function(e,t){e._menu=t,e.onmousedown=function(e,t,n){return function(i){return Q.printf("mousedown item"),i=i||window.event,e.focus?(e._hide(),n&&n.hide()):(fireMouseEvent(document.body,"mousedown"),e.focus=!0,Q.addEvent(document,"mousedown",e._hide),Q.addEvent(window,"blur",e._hide),n&&n.showElement(t)),i.cancelBubble=!0,!0}}(this,e,t),e.onmouseover=function(e,t){return function(){Q.printf("item onmouseover"),e.focus&&e.focus_item(t)}}(this,e,t),this.items.append(e)},focus_item:function(e){this.items.each(function(t){return e!=t?t._menu&&t._menu.hide():t._menu&&t._menu.showElement(t),!0})}});var CONST={no_title:"q-attr-no-title",no_icon:"q-attr-no-icon",no_min:"q-attr-no-min",no_max:"q-attr-no-max",no_close:"q-attr-no-close",with_bottom:"q-attr-with-bottom",fixed:"q-attr-fixed",inactive_title:"q-attr-inactive-title",SIZE_MIN:"min",SIZE_MAX:"max",SIZE_NORMAL:"normal",SIZE_RESIZE:3,SIZE_DRAGING:4,SIZE_RESIZING:5,SIZE_MINING:6,IDCANCEL:"0",IDOK:"1",IDNO:"2"},__GLOBALS={};__GLOBALS.MIN_HEIGHT=30,__GLOBALS.MIN_WIDTH=100,__GLOBALS.Z_INDEX=1e4,__GLOBALS.count=0,__GLOBALS.appid=-1,__GLOBALS.apps={},Q.ready(function(){__GLOBALS.desktop=document.body,__GLOBALS.desktop.hook=new Q.List,__GLOBALS.desktop.wnds=new Q.List,__GLOBALS.desktop.active_child=null,__GLOBALS.explorer=new Q.UIApplication,$CreateMaskLayer(__GLOBALS.desktop,"q-top-mask")},!0),Q.Application=Q.extend({id:-1,__init__:function(){this.id=++__GLOBALS.appid,__GLOBALS.apps[this.id]=this},end:function(){delete __GLOBALS.apps[this.id]}}),Q.UIApplication=Q.Application.extend({wnds_map:null,__init__:function(){Q.Application.prototype.__init__.call(this,arguments),this.wnds_map=new Q.List},add_window:function(e){this.wnds_map.append(e)},erase_window:function(e){this.wnds_map.erase(e)},end:function(){this.wnds_map.each(function(e){delete e.app,e.on_close=function(){return!0},$BindWindowMessage(e,MESSAGE.CLOSE)()}),Q.Application.prototype.end.call(this)}});var MESSAGE={CREATE:0,MIN:1,MAX:2,CLOSE:3,ACTIVATE:4,MOVE:5};Q.Window=Q.extend({hwnd:null,__init__:function(e){e=e||{};var t=e.title||"not",n=e.left||0,i=e.top||0,o=e.width||600,a=e.height||400,s=$GetDesktopWindow();e.parent instanceof Q.Window&&(s=e.parent.wnd()||$GetDesktopWindow()),this.hwnd=$CreateWindow(s,t,e.wstyle,n,i,o,a,e.app),this.setContent(e.content),this.hwnd.on_size=Q.bind_handler(this,e.on_size||function(){}),this.hwnd.on_activate=Q.bind_handler(this,e.on_activate||function(){}),this.hwnd.on_move_begin=Q.bind_handler(this,e.on_move_begin||function(){}),this.hwnd.on_move=Q.bind_handler(this,e.on_move||function(){}),this.hwnd.on_move_end=Q.bind_handler(this,e.on_move_end||function(){}),this.hwnd.on_close=Q.bind_handler(this,e.on_close||function(){return!0}),Q.bind_handler(this,e.on_create||function(){})()},wnd:function(){return this.hwnd},setWindowProc:function(e){return $SetWindowProc(this.hwnd,e)},moveTo:function(e,t){return $MoveTo(this.hwnd,e,t)},resizeTo:function(e,t){$ResizeTo(this.hwnd,e,t)},setZIndex:function(e){$SetWindowZIndex(this.hwnd,e)},setContent:function(e){e=e||"",e&&e.nodeType==Q.ELEMENT_NODE?($GetClient(this.hwnd).appendChild(e),e.style.display=""):$GetClient(this.hwnd).innerHTML=e},addStyle:function(e){Q.addClass(this.hwnd,e)},removeStyle:function(e){Q.removeClass(this.hwnd,e)},show:function(e){$ShowWindow(this.hwnd,e)},center:function(){$CenterWindow(this.hwnd)},activate:function(){$BindWindowMessage(this.hwnd,MESSAGE.ACTIVATE)()},adjust:function(){$FitWindow(this.hwnd)},item:function(e){return qid($GetClient(this.hwnd),e)}}),Q.Dialog=Q.Window.extend({old_window_proc:null,__init__:function(e){e=e||{},e.wstyle=e.wstyle,e.wstyle+="|"+CONST.fixed,e.wstyle+="|"+CONST.no_min,e.wstyle+="|"+CONST.no_max;var t=[];e.buttons instanceof Array&&(e.wstyle+="|"+CONST.with_bottom,t=e.buttons),Q.Window.prototype.__init__.call(this,e),this.old_window_proc=this.setWindowProc(function(e){return function(t,n,i){return e.window_proc(n,i)}}(this));for(var n=0;n<t.length;n++){var i=t[n],o=i.style||"sysbtn";this.addBottomButton(i.text,o,function(e,t){return function(){t.onclick()&&e.end()}}(this,i))}},window_proc:function(e,t){switch(e){case MESSAGE.CLOSE:this.hwnd.modal_prev&&($MaskWindow(this.hwnd.modal_prev,!1),this.hwnd.modal_prev.modal_next=null,this.hwnd.modal_prev=null)}return this.old_window_proc(this.hwnd,e,t)},addBottomButton:function(e,t,n){$GetWindowStyle(this.hwnd);if(!$IsStyle(this.hwnd,CONST.with_bottom)||$IsNull($GetBottomBar(this.hwnd)))return!1;var i=document.createElement("button");return $GetBottomBar(this.hwnd).appendChild(i),i.innerText=e,i.onclick=n,i.className=t,!0},domodal:function(e){$IsWindow(e)||(e=$GetActiveChild($GetDesktopWindow()),$IsWindow(e)||(e=$GetDesktopWindow())),$MaskWindow(e,!0),e.modal_next=this.hwnd,this.hwnd.modal_prev=e,this.show(!0),$ResizeTo(this.hwnd,this.hwnd.nWidth,this.hwnd.nHeight),this.center(),$IsDesktopWindow(e)&&this.setZIndex(100001)},end:function(){return $BindWindowMessage(this.hwnd,MESSAGE.CLOSE)(),arguments.length>1?arguments[1]:CONST.IDCANCEL}}),Q.alert=function(e){var t=Q.Dialog.extend({__init__:function(e){e=e||{},e.width=e.width||360,e.height=e.height||200,e.buttons=[],e.on_ok=e.on_ok||function(){return!0},"function"==typeof e.on_ok&&(this.on_ok=e.on_ok,e.buttons.push({text:Q.locale_text("qYes",""),onclick:Q.bind_handler(this,function(){this.on_ok()&&this.end(CONST.IDOK)})})),"function"==typeof e.on_no&&(this.on_no=e.on_no,e.buttons.push({text:Q.locale_text("qNo",""),style:"syscancelbtn",onclick:Q.bind_handler(this,function(){this.on_no()&&this.end(CONST.IDNO)})})),"function"==typeof e.on_cancel&&(this.on_cancel=e.on_cancel,e.buttons.push({text:Q.locale_text("qCancel"," 取消 "),style:"syscancelbtn",onclick:Q.bind_handler(this,function(){this.on_cancel()&&this.end(CONST.IDCANCEL)})})),Q.Dialog.prototype.__init__.call(this,e),this.domodal()}});return new t(e)},Q.UI=Q.extend({ui_iframe:null,__init__:function(e){e=e||{},this.ui_iframe=document.createElement("IFRAME"),this.ui_iframe.onload=function(){e.oncomplete(!0)},this.ui_iframe.onerror=function(){e.oncomplete(!1),document.body.removeChild(this)},this.ui_iframe.style.display="none",this.ui_iframe.src=e.src+"?"+Math.floor(+new Date/1e7),document.body.appendChild(this.ui_iframe)},template:function(e){var t=this.ui_iframe.contentDocument||this.ui_iframe.contentWindow.document,n=t.getElementById(e);return n?n.cloneNode(!0):null},bindCss:function(){for(var e=document.getElementsByTagName("head"),t=this.ui_iframe.contentDocument||this.ui_iframe.contentWindow.document,n=0;n<t.styleSheets.length;n++){var i=t.styleSheets[n];if(!i)return;var o;if(""==i.ownerNode.innerHTML&&i.href)o=document.createElement("link"),o.setAttribute("type","text/css"),o.setAttribute("rel","stylesheet"),o.setAttribute("href",i.href);else{var a=i.ownerNode.innerHTML;if(o=document.createElement("style"),o.setAttribute("type","text/css"),o.styleSheet)o.styleSheet.cssText=a;else{var s=t.createTextNode(a);o.appendChild(s)}}e.length?e[0].appendChild(o):document.documentElement.appendChild(o)}}}),Q.Slider=Q.extend({min:0,max:100,value:0,duration:1,hwnd:null,thumb:null,__init__:function(e){var t=this;e=e||{},this.type="vt"==e.type?"vt":"hr",this.min=e.min,this.max=e.max,this.duration=e.duration||1,this.value=e.value?e.value:0,"function"==typeof e.on_xscroll&&(this.on_xscroll=e.on_xscroll),"function"==typeof e.on_yscroll&&(this.on_yscroll=e.on_yscroll),this.hwnd=Q.$(e.id),this.thumb=find_item(this.hwnd,function(e){return e&&e.nodeType==Q.ELEMENT_NODE&&e.className.indexOf("q-thumb")>=0}),this.thumb&&(Q.drag({id:this.thumb,self:!0,onmove:function(e,n){"hr"!=t.type?(0>n&&(n=0),n>t.hwnd.offsetHeight-t.thumb.offsetHeight&&(n=t.hwnd.offsetHeight-t.thumb.offsetHeight),t.value=Math.floor(t.min+1*(t.max-t.min)*n/(t.hwnd.offsetHeight-t.thumb.offsetHeight)),t.on_yscroll(t.value),t.thumb.style.top=n+"px"):(0>e&&(e=0),e>t.hwnd.offsetWidth-t.thumb.offsetWidth&&(e=t.hwnd.offsetWidth-t.thumb.offsetWidth),t.value=Math.floor(t.min+1*(t.max-t.min)*e/(t.hwnd.offsetWidth-t.thumb.offsetWidth)),t.on_xscroll(t.value),t.thumb.style.left=e+"px")}}),t.setValue(e.value))},getValue:function(){return this.value},setValue:function(e){var t=this;t.value=e>t.max?t.max:e<t.min?t.min:e;var n=1*(t.value-t.min)/(t.max-t.min);if("hr"!=t.type){var i=Math.floor(n*(t.hwnd.offsetHeight-t.thumb.offsetHeight));t.on_yscroll(t.value),t.thumb.style.top=i+"px"}else{var o=Math.floor(n*(t.hwnd.offsetWidth-t.thumb.offsetWidth));t.on_xscroll(t.value),t.thumb.style.left=o+"px"}},on_xscroll:function(){},on_yscroll:function(){}}),Q.CheckBox=Q.extend({hwnd:null,__init__:function(e){e=e||{},this.hwnd=Q.$(e.id),this.onchange=e.onchange||function(){},this.setCheck(!!e.checked),Q.addEvent(this.hwnd,"click",function(e){return function(){e.setCheck(!e.checked())}}(this))},checked:function(){return Q.hasClass(this.hwnd,"checked")},setCheck:function(e){this.checked()!=e&&(e?Q.addClass(this.hwnd,"checked"):Q.removeClass(this.hwnd,"checked"),this.onchange(e))}});var BindAsEventHandler=function(e,t){return function(n){return t.call(e,n||window.event)}};Q.Store=Q.extend({records:null,proxy:null,currentpage:-1,__init__:function(e){e=e||{},this.records=new Q.HashMap,e.data&&this.appendData(e.data),e.proxy&&(this.proxy=e.proxy,this.loadRemote(0,30,null))},clear:function(){this.records=new Q.HashMap},appendData:function(e){for(var t=0;t<e.length;t++)this.push(e[t])},loadRemote:function(e,t,n){var i=this;Q.Ajax({command:i.proxy+"&page="+e+"&size="+t,oncomplete:function(e){var t=Q.json_decode(e.responseText);"function"==typeof n&&n(t.data)}})},loadPage:function(e,t,n){var i=n||function(){},o=this;if(o.proxy)o.loadRemote(e,t,i);else{for(var a=new Q.HashMap,s=(e-1)*t;e*t>s&&!(s>=o.records.length);s++)a.push(o.records.item(s));i(a)}},push:function(e){var t=this;e.__dataindex__=t.records.index,t.records.push(e)},remove:function(e){var t=this.records.find(e);this.records.remove(t)},each:function(e){this.records.each(e)},item:function(e){return this.records[e]}});var __TH=Q.extend({hwnd:null,hwnd_moveline:null,_width:0,_fMove:null,_fStop:null,_isResizable:!1,_isDragable:!1,_left:0,_right:0,_dx:5,__init__:function(e,t){t=t||{},this.onMove=t.onMove||function(){},this.onStart=t.onStart||function(){},this.onStop=t.onStop||function(){},this.hwnd=e,this._width=e.offsetWidth,this.hwnd_moveline=t.moveline,this.hwnd_moveline.style.display="none",this._fMove=BindAsEventHandler(this,this.Move),this._fStop=BindAsEventHandler(this,this.Stop),Q.addEvent(this.hwnd,"mousedown",BindAsEventHandler(this,this.Start)),Q.addEvent(this.hwnd,"mousemove",BindAsEventHandler(this,this.Move))},Start:function(e){var t=Q.absPosition(this.hwnd);this.hwnd.style.cursor&&(this._isResizable=!0,this._dx=t.left+t.width-e.clientX,this.hwnd_moveline.style.display="",this.hwnd_moveline.style.left=e.clientX+"px",this.hwnd_moveline.style.top=t.top+"px"),Q.addEvent(document,"mousemove",this._fMove),Q.addEvent(document,"mouseup",this._fStop),document.all?(Q.addEvent(this.hwnd,"losecapture",this._fStop),this.hwnd.setCapture()):(Q.addEvent(window,"blur",this._fStop),e.preventDefault()),this.onStart(e,this)},Move:function(e){var t=Q.scrollInfo();if(this._isDragable);else if(this._isResizable){if(this._left>e.clientX)return void(this.hwnd_moveline.style.left=this._left+"px");this.hwnd_moveline.style.left=e.clientX+"px"}else{var n=Q.absPosition(this.hwnd);this._left=n.left,this._right=n.left+n.width;var i=e.clientX-t.l;this.hwnd.style.cursor=i<=this._right+3&&i>=this._right-5?"col-resize":""}this.onMove(e,this)},Stop:function(e){this.hwnd_moveline.style.display="none",this._isResizable&&(this._width=e.clientX-this._left+this._dx,this.hwnd.firstChild.style.width=this._width+"px"),this._isDragable,this.onStop(e,this),Q.removeEvent(document,"mousemove",this._fMove),Q.removeEvent(document,"mouseup",this._fStop),document.all?(Q.removeEvent(this.hwnd,"losecapture",this._fStop),this.hwnd.releaseCapture()):Q.removeEvent(window,"blur",this._fStop),this._isResizable=!1,this._isDragable=!1}}),SELECT_MODE_CTRL=1,SELECT_MODE_SHIFT=2;Q.Table=Q.extend({wndParent:null,wnd:null,wndTitleBar:null,wndFrame:null,wndGroupHeader:null,wndGroupBody:null,wndToolbar:null,wndTableHeaderRow:null,wndTableData:null,wndMoveLine:null,columns:[],evtListener:{},store:null,selected_row:null,__init__:function(e){var t=this;e=e||{},t.row_height=e.row_height||30,t.title=e.title,t.store=e.store,t.columns=e.columns||[],"function"==typeof e.row_onclick&&(t.row_onclick=e.row_onclick),"function"==typeof e.row_ondblclick&&(t.row_ondblclick=e.row_ondblclick),"function"==typeof e.row_onmouseover&&(t.row_onmouseover=e.row_onmouseover),"function"==typeof e.row_onmouseout&&(t.row_onmouseout=e.row_onmouseout),t.row_ondblclick="function"==typeof e.row_ondblclick?e.row_ondblclick:function(){},t.row_oninsert="function"==typeof e.row_oninsert?e.row_oninsert:function(){},t.wndParent=Q.$(e.id),t.initview(e),t.render(),t.autosize()},initview:function(e){var t=this;if(t.wnd=document.createElement("DIV"),t.wndTitleBar=document.createElement("DIV"),t.wndFrame=document.createElement("DIV"),t.wndGroupHeader=document.createElement("DIV"),t.wndGroupBody=document.createElement("DIV"),t.wndToolbar=document.createElement("DIV"),t.wndMoveLine=document.createElement("DIV"),document.body.appendChild(t.wndMoveLine),t.wnd.appendChild(t.wndTitleBar),t.wnd.appendChild(t.wndFrame),t.wndFrame.appendChild(t.wndGroupHeader),t.wndFrame.appendChild(t.wndGroupBody),t.wnd.appendChild(t.wndToolbar),t.wnd.className="q-table",t.wndTitleBar.className="q-table-titlebar",t.wndFrame.className="q-table-frame",t.wndGroupHeader.className="q-group-header",t.wndGroupBody.className="q-group-body",t.wndToolbar.className="q-table-toolbar",t.wndMoveLine.className="q-table-moveline",t.wndTitleBar.innerText=t.title,t.wndParent.appendChild(t.wnd),t.wndGroupBody.innerHTML=t.wndGroupHeader.innerHTML='<table cellpadding="0" cellspacing="0" border="0"><tbody></tbody></table>',t.wndTableHeaderRow=t.wndGroupHeader.firstChild.insertRow(-1),t.wndTableData=t.wndGroupBody.firstChild,e.wstyle){var n=(e.wstyle+"").replace(/\|+/g," ");Q.addClass(this.wnd,n)}Q.hasClass(this.wnd,"q-attr-toolbar")||(this.wndToolbar.style.display="none"),t.load_columns(),t.wndGroupHeader.onselectstart=function(){return!1},t.wndGroupBody.onscroll=function(){t._sync_scroll()},t.wndGroupBody.onselectstart=function(){return!1}},autosize:function(){{var e,t=this,n=parseInt(t.wndParent.offsetHeight,10);parseInt(t.wndParent.offsetWidth,10),t.wnd.currentStyle}e=n-t.wndTitleBar.offsetHeight-t.wndToolbar.offsetHeight,t.wndFrame.style.height=e+"px",t.wndGroupBody.style.height=e-t.wndGroupHeader.offsetHeight+"px",t.wndGroupHeader.style.width=t.wndGroupBody.scrollWidth+"px"},_sync_scroll:function(){this.wndGroupHeader.style.left=-this.wndGroupBody.scrollLeft+"px",this.sync_scroll()},setStyle:function(e){Q.addClass(this.wnd,e)},removeStyle:function(e){Q.removeClass(this.wnd,e)},append:function(e,t){var n=this,i=n.wndTableData.insertRow(-1);i.onmouseover=function(e,t){return function(){e.row_is_enabled(t)&&(e.row_is_selected(t)||Q.addClass(t,"mouseover"))}}(this,i),i.onmouseout=function(e,t){return function(){e.row_is_enabled(t)&&(e.row_is_selected(t)||Q.removeClass(t,"mouseover"))}}(this,i),i.onclick=function(e,t){return function(n){return e._rows_onclick(t,n)}}(this,i),i.setAttribute("__dataindex__",t.__dataindex__),i.data=t;for(var o=n.wndTableHeaderRow.cells.length,a=0;o>a;a++){var s=i.insertCell(-1),r=n.wndTableHeaderRow.cells[a],d=n.columns[r.getAttribute("_index")],l=t[d.name];"function"==typeof d.renderer&&(l=d.renderer(t));var c=d.width,u=n._create_cell(i.rowIndex,a,{content:l,align:d.align,className:d.className,width:c,height:n.row_height,isHTML:d.isHTML});s.style.display=r.style.display,s.appendChild(u)}n.row_oninsert(i,t)},_create_cell:function(e,t,n){var i=document.createElement("DIV");return i.className="q-table-cdata",n.className&&(i.className+=" "+n.className),i.align=n.align,i.style.cssText="width:"+n.width+"px; height:"+n.height+"px;line-height: "+n.height+"px;",i.innerHTML=n.content,i},clear:function(){this.store.clear(),this.wndTableData.innerHTML=""},appendData:function(e){this.store.appendData(e)},render:function(){this.store.each(function(e){return function(t,n){e.append(n,t)}}(this))},load_columns:function(){for(var e=0;e<this.columns.length;e++){var t=this.columns[e];t.width=parseInt(t.width,10),this.insert_column(e,t)}},insert_column:function(e,t){var n=this,i=n.wndTableHeaderRow.insertCell(-1);t.isHidden=!!t.isHidden,i.style.display=t.isHidden?"none":"",i.setAttribute("_index",e),
i.innerHTML='<DIV align="'+t.align+'" class="q-column-header" style="width:'+t.width+'px;"><a HideFocus>'+t.title+"</a></DIV>",i.firstChild.onclick=function(){n._column_click(this.parentNode.cellIndex)},t.fixed||new __TH(i,{moveline:n.wndMoveLine,onStart:function(e,t){n._column_MouseDown(e,t)},onStop:function(e,t){n._column_MouseUp(e,t)}})},setSortFunc:function(e,t){var n=this,i=n.columns[e];i?i.sort=t:alert("Invalid Column")},_column_MouseDown:function(e,t){var n=this;t._isResizable&&(n.wndMoveLine.style.height=n.wnd.offsetHeight-n.wndTitleBar.offsetHeight+"px")},_column_MouseUp:function(e,t){var n=this,i=t.hwnd;if(t._isResizable){var o=i.cellIndex;n.rows_each(function(e){var n=e.cells[o].childNodes[0];n.style.width=t._width+"px"}),n.autosize(),n._sync_scroll()}},_column_click:function(e){var t=this.columns[e];if(t.sort,t&&t.clicks)for(var n=0;n<t.clicks.length;n++)t.clicks[n]()},_rows_onclick:function(e,t){var n=this;if(!this.row_is_enabled(e))return!1;if(Q.removeClass(e,"mouseover"),Q.hasClass(this.wnd,"q-attr-multiselect"))n.select_mode==SELECT_MODE_CTRL?n.row_set_selected(e,!n.row_is_selected(e)):n.select_mode==SELECT_MODE_SHIFT||(n.rows_selected.each(function(e,t){n.row_set_selected(n.rows_selected.item(t),!1)}),n.row_set_selected(e,!0));else{if(e==this.selected_row)return!1;this.row_set_selected(e,!0),this.row_set_selected(this.selected_row,!1),this.selected_row=e}return n.row_onclick?n.row_onclick(e,t):!0},_rows_ondblclick:function(e){return this.row_is_enabled(e)?void(this.row_ondblclick&&this.row_ondblclick(e)):!1},rows_each:function(e){for(var t=this,n=0;n<t.wndTableData.rows.length;n++)e(t.wndTableData.rows[n])},row_enable:function(){},row_remove:function(e){var t=this,n=t.store.records[t.row_index(e)];t.wndTableData.deleteRow(e.rowIndex),t.store.remove(n),t.autosize()},row_insert:function(e,t){var n=this;n.store.push(t),n.insertrow(e,t),n.autosize()},row_index:function(e){return parseInt(e.getAttribute("__dataindex__"),10)},row_is_enabled:function(e){return e&&!e.getAttribute("_disabled")},row_is_selected:function(e){return Q.hasClass(e,"q-selected")},rows_selected_all:function(e){var t=this;t.rows_each(function(n){t.row_set_selected(n,e)})},row_set_selected:function(e,t){if(this.row_is_enabled(e)){{this.row_index(e)}t?Q.addClass(e,"q-selected"):Q.removeClass(e,"q-selected")}},getRecord:function(e){var t=this.row_index(e);return this.store.records.item(t)},addToolButton:function(){},sync_scroll:function(){}}),Q.DropDownList=Q.extend({hwnd:null,drop_wnd:null,ctrl:null,__init__:function(e){var t=this;this.hwnd=document.createElement("BUTTON"),this.hwnd.className="q-select",Q.addClass(this.hwnd,e.wstyle),this.on_change=e.on_change||function(){},this.ctrl=Q.$(e.id),this.ctrl.parentNode.insertBefore(this.hwnd,this.ctrl),this.ctrl.onchange=function(e,t){return function(){Q.printf("ctrl onchage"),e.on_item_changed(t.options[t.selectedIndex].text,t.options[t.selectedIndex].value)}}(this,this.ctrl);var n=new Q.MenuBar;if(this.drop_wnd=new Q.Menu({style:e.wstyle,on_popup:function(e){e?Q.addClass(t.hwnd,"checked"):Q.removeClass(t.hwnd,"checked")}}),"select"==this.ctrl.tagName.toLowerCase())for(var i=this.ctrl.options.length,o=0;i>o;o++){var a=new Q.MenuItem({text:this.ctrl.options[o].text,data:o,callback:Q.bind_handler(t,t.on_menu_clicked)});this.drop_wnd.addMenuItem(a),o==this.ctrl.selectedIndex&&(this.setValue(this.ctrl.options[o].value),this.setText(this.ctrl.options[o].text))}this.drop_wnd.hide(),n.append(this.hwnd,this.drop_wnd),e.value&&this.setValue(e.value)},on_menu_clicked:function(e){Q.printf(e.data);var t=e.data;t!=this.ctrl.selectedIndex&&this.setValue(this.ctrl.options[t].value)},on_item_changed:function(e,t){this.setText(e),this.on_change(e,t)},setText:function(e){return this.trim(this.hwnd.innerText)==this.trim(e)?!1:(this.hwnd.innerText=this.trim(e),!0)},setValue:function(e){for(var t=this.ctrl,n=this.ctrl.selectedIndex,i=0;i<t.options.length;i++)if(t.options[i].value==e){if(n!=i)return t.options[i].selected=!0,this.on_item_changed(t.options[i].text,t.options[i].value),!0;break}return!1},trim:function(e){return e.replace(/&nbsp;/,"")}});var g_simple_os=null,g_os_start_menu,g_os_setting,g_task_items=[];Q.SimpleOS=Q.extend({apps:null,window_list_bar:null,task_bar:null,start_button:null,skin:"",__init__:function(e){g_simple_os=this,e=e||{},this.apps={},this.on_logout=e.on_logout,this.window_list_bar=e.window_list_bar,this.task_bar=e.task_bar,this.start_button=e.start_button,this.skin=e.skin,Q.workspace=function(){var t=document.body.clientWidth,n=document.body.clientHeight;return document.documentElement.clientWidth&&(t=document.documentElement.clientWidth),document.documentElement.clientHeight&&(n=document.documentElement.clientHeight),n-=e.task_bar.offsetHeight,{width:t,height:n}},this._init_menu(e),register_hook(Q.bind_handler(this,this.wnds_hook))},_init_menu:function(e){var t=this;g_os_start_menu=new Q.Menu({style:"os-start-menu",on_popup:function(e){e?Q.addClass(t.start_button,"q-active"):Q.removeClass(t.start_button,"q-active")}}),this.start_button.onclick=function(){g_os_start_menu.showElement(this)};var n=new Q.MenuItem({text:"系统设置",callback:function(){g_os_setting||(g_os_setting=new Q.Dialog({wstyle:e.skin,title:"系统设置",width:480,height:370,on_close:function(){delete g_os_setting,g_os_setting=null}})),g_os_setting.setContent("simpleos system setting"),g_os_setting.show(!0),g_os_setting.center()}}),i=new Q.MenuItem({text:"程序",popup_style:"os-start-menu"}),o=new Q.MenuItem({type:MENU_SEPERATOR,text:""}),a=new Q.MenuItem({text:"注销",callback:function(){setTimeout(function(){t.on_logout()},300)}});g_os_start_menu.addMenuItem(n),g_os_start_menu.addMenuItem(i),g_os_start_menu.addMenuItem(o),g_os_start_menu.addMenuItem(a);for(var s=0;s<e.apps.length;s++){var r=e.apps[s],d=new Q.MenuItem({text:r.name,callback:function(e){return function(){t.run(e)}}(r)});i.addSubMenuItem(d)}g_os_start_menu.hide()},wnds_hook:function(e,t){switch(t){case MESSAGE.CREATE:var n=this,i=document.createElement("button");i.className="item",i.innerText=$GetTitleText(e),i.bind_data=e,i.onclick=function(e,t){return function(){for(var i=n.window_list_bar.childNodes,o=0;o<i.length;o++){var a=i[o];a.className="item"}t.className="selected-item",$BindWindowMessage(e,MESSAGE.ACTIVATE)()}}(e,i),this.window_list_bar.appendChild(i);break;case MESSAGE.ACTIVATE:for(var o=this.window_list_bar.childNodes,a=0;a<o.length;a++){var s=o[a];s.className=s.bind_data==e?"selected-item":"item"}break;case MESSAGE.CLOSE:for(var o=this.window_list_bar.childNodes,a=0;a<o.length;a++){var s=o[a];s.bind_data==e&&(s.onclick=null,s.parentNode.removeChild(s))}}},each_apps:function(e){for(var t in this.apps)if(!e(this.apps[t]))break},run_error:function(e,t){var n=new Q.Dialog({wstyle:this.skin+" q-attr-with-bottom",width:500,height:200,title:"ERROR",content:'<div style="margin: 20px;line-height: 30px;word-break:break-all;">'+t+"</div>",buttons:[{text:"关闭",onclick:function(){return!0}}]});n.show(!0),n.center()},destroy_instance:function(e){Q.printf(this.apps),Q.printf("appid->"+e+" to delete"),delete this.apps[e],Q.printf(this.apps)},create_instance:function(e){var t=null;if(e.single&&e.klass&&this.each_apps(function(n){return n instanceof e.klass?(t=n,n.__active__(),!1):!0}),!t){var n=this;t=new e.klass({ui:e.ui_runtime}),t.__exit__=function(){Q.printf("app "+e.name+" is exit."),n.destroy_instance(this.id),this.end()},this.apps[t.id]=t}return t},run:function(e){var t=this,n="Application ["+e.name+"] is run failed.";if(e.klass)try{t.create_instance(e),Q.printf("create app ok")}catch(i){t.run_error(e,n+"<br>"+i.description)}else{var o=null;window._entry=function(e){o=e},Q.loadModule(e.src,function(i){return i?(Q.printf("load from file and create app ok"),e.klass=o,void(e.ui_runtime=new Q.UI({src:e.ui,oncomplete:function(n){Q.printf("load ui -> "+(n?"ok":"failed")),t.create_instance(e)}}))):void t.run_error(e,n+"<br> File("+e.src+") is error.")})}}}),Q.PlaceHolder=Q.extend({hwnd:null,holder:null,__init__:function(e){e=e||{},this.hwnd=Q.$(e.id),this.holder=Q.$(e.holder),Q.addEvent(this.hwnd,"blur",Q.bind_handler(this,this.onblur)),Q.addEvent(this.hwnd,"focus",Q.bind_handler(this,this.onfocus)),this.checkValue()},onblur:function(){this.checkValue()},onfocus:function(){Q.addClass(this.hwnd,"q-inplace")},checkValue:function(){""!=this.hwnd.value?Q.addClass(this.hwnd,"q-inplace"):Q.removeClass(this.hwnd,"q-inplace")}});var BindAsEventHandler=function(e,t){return function(n){return t.call(e,n||window.event)}},TREEITEM_NULL=-1,TREEITEM_NOSELECTED=-2,TREEITEM_DRAG_NONE=0,TREEITEM_DRAG_TOP=1,TREEITEM_DRAG_CENTER=2,TREEITEM_DRAG_BOTTOM=3,__InitDragItem=Q.extend({hwnd:null,_fMove:null,_fStop:null,__init__:function(e,t){t=t||{},this.onMove=t.onMove||function(){},this.onStart=t.onStart||function(){},this.onStop=t.onStop||function(){},this.hwnd=e,this._fMove=BindAsEventHandler(this,this.Move),this._fStop=BindAsEventHandler(this,this.Stop),Q.addEvent(this.hwnd,"mousedown",BindAsEventHandler(this,this.Start))},Start:function(e){e=e||window.event,Q.addEvent(document,"mousemove",this._fMove),Q.addEvent(document,"mouseup",this._fStop),document.all?(Q.addEvent(this.hwnd,"losecapture",this._fStop),this.hwnd.setCapture(),e.cancelBubble=!0):(Q.addEvent(window,"blur",this._fStop),e.preventDefault()),e.cancelBubble=!0,this.onStart(e,this)},Move:function(e){e=e||window.event,this.onMove(e,this)},Stop:function(e){e=e||window.event,this.onStop(e,this),Q.removeEvent(document,"mousemove",this._fMove),Q.removeEvent(document,"mouseup",this._fStop),document.all?(Q.removeEvent(this.hwnd,"losecapture",this._fStop),this.hwnd.releaseCapture()):Q.removeEvent(window,"blur",this._fStop)}});Q.Tree=Q.extend({hwnd:null,hwndTree:null,hwndAccept:null,hwndMoveLine:null,ID2Nodes:null,selected:TREEITEM_NOSELECTED,idx:-1,isdraging:!1,ismoved:!1,dragtype:TREEITEM_DRAG_NONE,Acceptable:!1,onMoveLineMove_:null,__init__:function(e){var t=this;e=e||{},t.ID2Nodes={},t.Acceptable=!!e.Acceptable,t.onItemAccept=e.onItemAccept||function(){},t.onMoveLineMove_=Q.bind_handler(this,this.onMoveLineMove),t.onContextMenu=e.onContextMenu||function(){},t.hwnd=document.createElement("DIV"),t.hwndTree=document.createElement("ul"),t.hwndMoveLine=document.createElement("fieldset"),document.body.appendChild(t.hwndMoveLine);var n=this.createNode(-1,e.name,!!e.open),i=this.getItemNode(n);Q.addClass(i.hwnd,"q-root"),t.hwndTree.appendChild(i.hwnd),t.hwnd.appendChild(t.hwndTree),t.hwnd.className="q-simpletree",t.hwndMoveLine.className="moveline",t.hwndMoveLine.style.display="none";var o=Q.$(e.id);o.appendChild(t.hwnd)},render:function(e){this.dorender(0,e,e.root)},query:function(e,t,n){for(var i=[],o=e.data.length,a=0;o>a;a++)e.data[a][t]==n&&i.push(e.data[a]);return i},dorender:function(e,t,n){for(var i=this.query(t,t.parentKey,n),o=i.length,a=0;o>a;a++){var s=i[a],r=this.createNode(e,s[t.text],!0);this.dorender(r,t,s[t.key])}},getRoot:function(){return 0},getSelectedItem:function(){return this.selected==TREEITEM_NOSELECTED?TREEITEM_NULL:this.selected},setItemSelected:function(e){var t=this,n=t.getSelectedItem();if(n!=e){var i=t.getItemNode(e);i&&(i.link.style.background="#C2CFF1",t.selected=e);var o=t.getItemNode(n);o&&(o.link.style.background="")}},setItemIcon:function(e,t){var n=this.getItemNode(e);n&&n.icon&&(n.icon.className="icon "+t)},setItemLink:function(e,t){var n=this.getItemNode(e);n&&n.link&&(n.link.href=t)},setItemText:function(e,t){var n=this.getItemNode(e);n&&(n.textNode.innerText=t)},getItemText:function(e){var t=this.getItemNode(e);return t?t.textNode.innerText:""},setItemData:function(e,t){var n=this,i=n.getItemNode(e),o=i.hwnd.data;return i.hwnd.data=t,o},getItemData:function(e){var t=this.getItemNode(e);return t.hwnd.data},getItemNode:function(e){return this.ID2Nodes[e]},getItemByData:function(e){for(var t in this.ID2Nodes){var n=this.getItemNode(t);if(n.hwnd.data==e)return n}return null},getNextItem:function(e){var t=this,n=t.getItemNode(e);if(!n)return TREEITEM_NULL;var i=n.hwnd.nextSibling;return i?i.idx:TREEITEM_NULL},getPrevItem:function(e){var t=this,n=t.getItemNode(e);if(!n)return TREEITEM_NULL;var i=n.hwnd.previousSibling;return i?i.idx:TREEITEM_NULL},getParent:function(e){var t=this.getItemNode(e);return t?t.parent:TREEITEM_NULL},getLastChild:function(e){var t=this,n=t.getItemNode(e);return null==n?TREEITEM_NULL:n.lastChild},getFirstChild:function(e){var t=this,n=t.getItemNode(e);return null==n?TREEITEM_NULL:n.firstChild},createNode:function(e,t,n){var i=this,o=!0;i.idx++;var a=null,s=i.idx,r=i.getItemNode(e),d=0;if(r){d=r.level+1,r.expand.expandable=!0;var l=i.getItemNode(r.lastChild);if(l&&(l.isLastChild=!1,l.expand.className=l.expand.expandable?""==l.subarea.style.display?"expand expand_on":"expand expand_off":"expand child"),r.firstChild==TREEITEM_NULL){r.firstChild=s;var c="expand_";r.isLastChild&&(c="last_expand_"),c+=""==r.subarea.style.display?"on":"off",r.expand.className="expand "+c}r.lastChild=s}return a=new treeNode(s,e,d,n,t,o),i.ID2Nodes[s]=a,a.hwnd=document.createElement("li"),a.hwnd.idx=s,a.expand=document.createElement("DIV"),a.link=document.createElement("A"),a.icon=document.createElement("SPAN"),a.textNode=document.createElement("SPAN"),a.subarea=document.createElement("ul"),a.expand.expandable=!1,a.hwnd.className="q-tree-item",a.expand.className="expand last_child",a.expand.style.left=20*d+"px",a.link.style.paddingLeft=20*d+25+"px",a.icon.className="icon default",a.textNode.className="textNode",a.subarea.className="",a.textNode.innerText=a.text,a.textNode.href="#",a.textNode.idx=s,a.link.idx=s,a.link.onclick=function(){i.itemClick(this.idx),i.setItemSelected(this.idx)},a.link.oncontextmenu=function(e){return i.itemClick(this.idx),i.setItemSelected(this.idx),i.onContextMenu(this.idx,e),!1},a.link.onselectstart=function(){return!1},a.link.ondblclick=function(){return i.itemDblClick(this.idx),!1},a.expand.onclick=function(){i.expandClick(i.idx);var e="";a.isLastChild&&(e="last_"),this.expandable&&(e+="expand_","none"==a.subarea.style.display?(a.subarea.style.display="",e+="on"):(a.subarea.style.display="none",e+="off"),this.className="expand "+e)},a.link.appendChild(a.icon),a.link.appendChild(a.textNode),a.hwnd.appendChild(a.expand),a.hwnd.appendChild(a.link),a.hwnd.appendChild(a.subarea),r?r.subarea.appendChild(a.hwnd):i.hwndTree.appendChild(a.hwnd),s},expand:function(){},remove:function(e){var t=this,n=t.getItemNode(e),i=t.getItemNode(n.parent);if(!n||!i)return null;var o=i.firstChild,a=i.lastChild;if(o==a)i.expand.expandable=!1,i.firstChild=TREEITEM_NULL,i.lastChild=TREEITEM_NULL;else if(o==e){var s=t.getNextItem(e),r=t.getItemNode(s);i.firstChild=s,t.MeasureNodeExpand(r)}else if(a==e){var d=t.getPrevItem(e),l=t.getItemNode(d);i.lastChild=d,l.isLastChild=!0,t.MeasureNodeExpand(l)}return t.MeasureNodeExpand(i),n.hwnd.parentNode.removeChild(n.hwnd),n},appendChild:function(e,t){var n=this,i=n.getItemNode(t),o=n.getItemNode(e);if(!i)return!1;for(var a=t;a!=TREEITEM_NULL;){if(e==a)return!1;a=n.getParent(a)}var s=n.remove(e);if(o.level=i.level+1,o.parent=t,i.expand.expandable=!0,i.firstChild==TREEITEM_NULL)i.firstChild=e;else{var r=n.getLastChild(t);if(r!=TREEITEM_NULL){var d=n.getItemNode(r);d.isLastChild=!1,n.MeasureNodeExpand(d)}}o.isLastChild=!0,i.lastChild=e,n.MeasureNodeExpand(i),n.MeasureNodeExpand(o);var l=i.subarea;l.appendChild(s.hwnd),o.expand.style.left=20*(o.level-1)+"px",o.link.style.paddingLeft=20*(o.level-1)+25+"px",n.updateItemIntent(e)},traverseNode:function(e,t){for(var n=this.getItemNode(e),i=0;i<n.subarea.childNodes.length;i++){if(t&&!t(n.subarea.childNodes[i].idx,t))return!1;if(!this.traverseNode(n.subarea.childNodes[i].idx,t))return!1}return!0},MeasureNodeExpand:function(e){var t="expand ";e.isLastChild&&(t+="last_"),e.firstChild!=TREEITEM_NULL?(t+="expand_",t+=""==e.subarea.style.display?"on":"off"):t+="child",e.expand.className=t},insertBefore:function(e,t){this.insertItem(e,t,!1)},insertAfter:function(e,t){this.insertItem(e,t,!0)},insertItem:function(e,t,n){var i=this,o=i.getItemNode(t),a=i.getItemNode(e),s=i.getItemNode(o.parent);if(!o||!a||!s)return!1;var r=i.remove(e);a.level=o.level,a.parent=o.parent,n?o.isLastChild?(o.isLastChild=!1,a.isLastChild=!0,s.lastChild=e):a.isLastChild=!1:(s.firstChild==t&&(s.firstChild=e),a.isLastChild=!1),i.MeasureNodeExpand(o),i.MeasureNodeExpand(a);var d=s.subarea;n?d.lastChild==o.hwnd?d.appendChild(r.hwnd):d.insertBefore(r.hwnd,o.hwnd.nextSibling):d.insertBefore(r.hwnd,o.hwnd),a.expand.style.left=20*(a.level-1)+"px",a.link.style.paddingLeft=20*(a.level-1)+25+"px",i.updateItemIntent(e)},updateItemIntent:function(e){var t=this;t.traverseNode(e,function(e){var n=t.getItemNode(e),i=t.getItemNode(t.getParent(e));return n.level=i.level+1,n.expand.style.left=20*(n.level-1)+"px",n.link.style.paddingLeft=20*(n.level-1)+25+"px",!0})},removeChildren:function(e){for(var t=this,n=t.getFirstChild(e);n>0;){t.removeChildren(n);var i=n;n=t.getNextItem(n),t.remove(i)}},onExpand:function(){},onStart:function(e,t){var n=this;if(2!=e.button&&3!=e.button&&n.Acceptable){n.ismoved=!1,n.isdraging=!0,n.hwndMoveLine.style.width=n.hwnd.offsetWidth-4+"px";var i=Q.absPosition(n.hwnd);n.hwndMoveLine.style.left=i.left+"px",n.onMove(e,t),"none"==n.hwndMoveLine.style.display,Q.addEvent(n.hwndMoveLine,"mousemove",n.onMoveLineMove_)}},onMove:function(e,t){var n=this;if(2!=e.button&&3!=e.button&&n.Acceptable&&(n.ismoved||(n.ismoved=!0),e=e||window.event,n.isdraging)){for(var i=!1,o=e.srcElement,a=null;o&&o!=document.body;){if(1==o.nodeType&&"a"==(o.nodeName+"").toLowerCase())a=o;else if(o==n.hwnd){i=!0;break}o=o.parentNode}if(i){if(a){for(var s=n.getParent(a.idx);s!=TREEITEM_NULL;){if(s==t.hwnd.idx)return n.hwndMoveLine.style.display="none",void(n.hwndAccept=null);s=n.getParent(s)}var r=Q.absPosition(a);if(e.clientY>=r.top&&e.clientY<r.top+a.offsetHeight/2-2)return n.dragtype=TREEITEM_DRAG_TOP,n.hwndMoveLine.style.borderWidth="1px",n.hwndMoveLine.style.height="1px",n.hwndMoveLine.style.top=r.top-1+"px",void(n.ismoved&&(n.hwndMoveLine.style.display=""));if(e.clientY>=r.top+a.offsetHeight/2-3&&e.clientY<=r.top+a.offsetHeight/2+3){if(a!=t.hwnd)return n.hwndMoveLine.style.top=r.top+"px",n.hwndMoveLine.style.borderWidth="2px",n.hwndMoveLine.style.height=a.offsetHeight-4+"px",n.hwndAccept=a,void(n.dragtype=TREEITEM_DRAG_CENTER)}else if(e.clientY<=r.top+a.offsetHeight&&e.clientY>=r.top+a.offsetHeight/2+3)return n.dragtype=TREEITEM_DRAG_BOTTOM,n.hwndMoveLine.style.borderWidth="1px",n.hwndMoveLine.style.height="1px",n.hwndMoveLine.style.top=r.top-1+a.offsetHeight+"px",void(n.ismoved&&(n.hwndMoveLine.style.display=""))}n.hwndAccept=null}}},onStop:function(e,t){var n=this;n.Acceptable&&(n.isdraging=!1,n.ismoved=!1,this.hwndMoveLine.style.display="none",Q.removeEvent(n.hwndMoveLine,"mousemove",n.onMoveLineMove_),n.hwndAccept&&(n.hwndAccept!=t.hwnd&&n.onAccept(t.hwnd.idx,n.hwndAccept.idx),n.hwndAccept=null),n.dragtype=TREEITEM_DRAG_NONE)},onMoveLineMove:function(e){var t=this;if(t.Acceptable){e=e||window.event;var n=Q.absPosition(t.hwndMoveLine);e.clientY>=n.top+t.hwndMoveLine.offsetHeight/2-3&&e.clientY<=n.top+t.hwndMoveLine.offsetHeight/2+3||(t.hwndMoveLine.style.borderWidth="1px",t.hwndMoveLine.style.height="1px")}},onAccept:function(e,t){var n=this;n.Acceptable&&n.onItemAccept(e,t,n.dragtype)},itemClick:function(){},expandClick:function(){},itemDblClick:function(){},onNodeDelete:function(){},onItemAccept:function(){}}),Q.tabs=Q.extend({items:null,active:null,__init__:function(e){e=e||{},this.items=e.items||[],this.each(function(t){return function(n){var i=function(e,t){return function(){console.log("mouseover"),e.timer&&(console.log("f kill timeout"),clearTimeout(e.timer),e.timer=null),e.set_active(t)}}(t,n.tab),o=function(e,t,n){return function(){e.timer&&(clearTimeout(e.timer),e.timer=null),console.log("set timeout"),e.timer=setTimeout(function(e,t){return function(){console.log("hide tab"),t.style.display="none",Q.removeClass(e,"q-selected")}}(Q.$(t),Q.$(n)),200)}}(t,n.tab,n.content),a=function(e){return function(){e.timer&&(console.log("f_hide_stop kill timeout"),clearTimeout(e.timer),e.timer=null)}}(t,n.content);"mouseover"==e.action?(Q.addEvent(Q.$(n.tab),"mouseover",i),Q.addEvent(Q.$(n.tab),"mouseout",o),Q.addEvent(Q.$(n.content),"mouseover",a),Q.addEvent(Q.$(n.content),"mouseout",o)):Q.addEvent(Q.$(n.tab),"click",i)}}(this)),this.set_active(e.active)},set_active:function(e){this.each(function(t,n){return function(i){i.tab==n?(t.active=e,Q.addClass(Q.$(i.tab),"q-selected"),Q.$(i.content)&&(Q.$(i.content).style.display="")):(Q.removeClass(Q.$(i.tab),"q-selected"),Q.$(i.content)&&(Q.$(i.content).style.display="none"))}}(this,e))},each:function(e){for(var t=0;t<this.items.length;t++)e(this.items[t])}}),Q.ImagesBox=Q.extend({hwnd:null,__init__:function(e){e=e||{};var t=Q.$(e.id);this.hwnd=document.createElement("div"),t.appendChild(this.hwnd),this.hwnd.className="q-images-box",this.on_item_changed=e.on_item_changed||function(){},this.is_item_enabled=e.is_item_enabled||function(){return!0},"function"==typeof e.on_item_dblclick&&(this.on_item_dblclick=e.on_item_dblclick)},create_element:function(e,t){var n=this,i=document.createElement("DIV");i.__userdata=e,i.setAttribute("data-url",e.src),i.setAttribute("data-width",e.width),i.setAttribute("data-height",e.height),i.className="q-box-item",this.hwnd.appendChild(i),i.innerHTML='<span class="q-box-info"> \r\n <span class="wh">'+e.width+"x"+e.height+" </span> \r\n </span>";var o=document.createElement("div"),a=document.createElement("a"),s=document.createElement("img");i.inner_img=s,a.appendChild(s),o.appendChild(a),i.appendChild(o);var r=document.createElement("div");r.className="select-mask",i.appendChild(r),o.className="wayixia-image",a.href="javscript:void(0);",a.onclick=function(e){e.preventDefault()};var d=this.calculate(i.offsetWidth,i.offsetHeight,e.width,e.height);s.src=e.src,s.className="image",s.style.cssText="margin-top:"+d.top+"px;width:"+d.width+"px;height:"+d.height+"px;",i.onmouseover=function(){n.is_item_enabled(this)&&(Q.hasClass(this,"mouseselected")||Q.addClass(this,"mouseover"))},i.onmouseout=function(){n.is_item_enabled(this)&&(Q.hasClass(this,"mouseselected")||Q.removeClass(this,"mouseover"))},i.onclick=function(){n.set_check(this,!Q.hasClass(this,"mouseselected"))},Q.click(i,function(e){n.set_check(e,!Q.hasClass(e,"mouseselected"))},this.on_item_dblclick),t(i)},each_item:function(e){for(var t=this.hwnd.childNodes,n=0;n<t.length;n++){var i=t[n];i.nodeType!=Q.ELEMENT_NODE||i.id||e(i)}},select_all:function(e){this.each_item(function(e,t){return function(n){e.set_check(n,t)}}(this,e))},set_check:function(e,t){this.is_item_enabled(e)&&(Q.removeClass(e,"mouseover"),t!=Q.hasClass(e,"mouseselected")&&(t?Q.addClass(e,"mouseselected"):Q.removeClass(e,"mouseselected"),this.on_item_changed(e,t)))},set_style:function(e){Q.removeClass(this.hwnd,this.old_style),this.old_style=e,Q.addClass(this.hwnd,e),this.each_item(function(e){return function(t){e.on_item_size(t)}}(this))},on_item_size:function(e){var t=e.inner_img,n=this.calculate(parseInt(e.currentStyle.width,10),parseInt(e.currentStyle.height,10),t.width,t.height);t.style.cssText="margin-top:"+n.top+"px;width:"+n.width+"px;height:"+n.height+"px;"},calculate:function(e,t,n,i){var o=e*i-t*n,a=0,s=0;return 0>o?(a=e,s=e*i/(1*n)):(s=t,a=n*s/(1*i)),{width:a,height:s,top:(t-s)/2}},getImageInfoHandler:function(e,t,n){var i=this;return function(){var o=this,a=i.copy_data(e);a.userdata=t,a.src=o.src,a.width=o.width,a.height=o.height,i.create_element(a,n)}},display_images:function(e,t,n){var i=this;return n=n||function(){},this.hwnd.innerHTML="",function(){for(var o in e){var a=e[o],s=new Image;s.onload=i.getImageInfoHandler(t,a,n),s.src=o}}},check_size:function(e,t,n){var i=e.getAttribute("data-width"),o=e.getAttribute("data-height");e.style.display=t>i||n>o?"none":""},copy_data:function(e){var t={};for(var n in e)t[n]=e[n];return t}});var controlid=null,currdate=null,startdate=null,enddate=null,yy=null,mm=null,hh=null,ii=null,currday=null,addtime=!1,today=new Date,lastcheckedyear=!1,lastcheckedmonth=!1;Q.ready(function(){loadcalendar()},!0),window.ActiveXObject||(Element.prototype.selectNodes=function(e){var t=new XPathEvaluator,n=t.evaluate(e,this,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),i=new Array;if(null!=n)for(var o=n.iterateNext();o;)i.push(o),o=n.iterateNext();return i},Element.prototype.selectSingleNode=function(e){var t=new XPathEvaluator,n=t.evaluate(e,this,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);return null!=n?n.singleNodeValue:null}),Q.xml=function(e){var t;return window.ActiveXObject?(t=new ActiveXObject("MSXML2.DOMDocument"),t.loadXML(e).documentElement):t=(new DOMParser).parseFromString(e,"text/xml").documentElement,t.ownerDocument?t.ownerDocument:t},Q.xmlfile=function(e){return XMLDocument(e)},Q.selectSingleNode=function(e,t){if(window.ActiveXObject)return e.selectSingleNode(t);var n=new XPathEvaluator,i=n.createNSResolver(null==e.ownerDocument?e.documentElement:e.ownerDocument.documentElement),o=n.evaluate(t,e,i,XPathResult.FIRST_ORDERED_NODE_TYPE,null);return o.singleNodeValue};var controlid=null,currdate=null,startdate=null,enddate=null,yy=null,mm=null,hh=null,ii=null,currday=null,addtime=!1,today=new Date,lastcheckedyear=!1,lastcheckedmonth=!1;Q.ready(function(){loadcalendar()},!0),Q.DropWindow=Q.Window.extend({timer:null,_fHide:null,_fWheel:null,_fOnPopup:null,_show:!1,__init__:function(e){e=e||{},this._fHide=function(e,t){return function(e){e=e||window.event;for(var n=Q.isNS6()?e.target:e.srcElement;n&&!Q.hasClass(n,"q-dropwindow")&&n!=document.body;)n=n.parentNode;return n&&n!=document.body?(e.returnValue=!1,!1):void t()}}(this,Q.bind_handler(this,this.hide)),this._fOnPopup="function"==typeof e.on_popup?e.on_popup:function(){},e.wstyle="q-dropwindow q-attr-no-title q-attr-fixed",Q.Window.prototype.__init__.call(this,e)},showElement:function(e){if(e.nodeType==Q.ELEMENT_NODE){this.hide(),Q.addEvent(document,"mousedown",this._fHide),Q.addEvent(window,"blur",this._fHide),this._fOnPopup(!0),this.show(!0);var t=Q.workspace(),n=Q.absPosition(e),i=Q.absPosition(this.wnd()),o=0,a=0;a=n.top+n.height+i.height>t.height?n.top-i.height:n.top+n.height,o=i.width+n.left>t.width?n.left+n.width-i.width:n.left;var s=Q.scrollInfo();this.moveTo(s.l+o,s.t+a)}},hide:function(){this.show(!1),Q.removeEvent(window,"blur",this._fHide),Q.removeEvent(document,"mousedown",this._fHide),document.onmousewheel=this._fWheel,this._fOnPopup(!1)}});

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/iknown-libq.js.git
git@api.gitlife.ru:oschina-mirror/iknown-libq.js.git
oschina-mirror
iknown-libq.js
iknown-libq.js
master