1 line
7.4 KiB
JavaScript
1 line
7.4 KiB
JavaScript
|
(function(){var _1=20;var _2=0;var _3=null;var _4=null;var _5=0;var _6=location.hash;var _7="#_";var _8=[];var _9=0;var _a;var _b=false;var _c="portrait";var _d="landscape";window.iui={animOn:true,showPage:function(_e,_f){if(_e){if(_4){_4.removeAttribute("selected");_4=null;}if(hasClass(_e,"dialog")){showDialog(_e);}else{var _10=_3;_3=_e;if(_10){setTimeout(slidePages,0,_10,_e,_f);}else{updatePage(_e,_10);}}}},showPageById:function(_11){var _12=$(_11);if(_12){var _13=_8.indexOf(_11);var _14=_13!=-1;if(_14){_8.splice(_13,_8.length);}iui.showPage(_12,_14);}},showPageByHref:function(_15,_16,_17,_18,cb){var req=new XMLHttpRequest();req.onerror=function(){if(cb){cb(false);}};req.onreadystatechange=function(){if(req.readyState==4){if(_18){replaceElementWithSource(_18,req.responseText);}else{var _1b=document.createElement("div");_1b.innerHTML=req.responseText;iui.insertPages(_1b.childNodes);}if(cb){setTimeout(cb,1000,true);}}};if(_16){req.open(_17||"GET",_15,true);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");req.setRequestHeader("Content-Length",_16.length);req.send(_16.join("&"));}else{req.open(_17||"GET",_15,true);req.send(null);}},insertPages:function(_1c){var _1d;for(var i=0;i<_1c.length;++i){var _1f=_1c[i];if(_1f.nodeType==1){if(!_1f.id){_1f.id="__"+(++_9)+"__";}var _20=$(_1f.id);if(_20){_20.parentNode.replaceChild(_1f,_20);}else{document.body.appendChild(_1f);}if(_1f.getAttribute("selected")=="true"||!_1d){_1d=_1f;}--i;}}if(_1d){iui.showPage(_1d);}},getSelectedPage:function(){for(var _21=document.body.firstChild;_21;_21=_21.nextSibling){if(_21.nodeType==1&&_21.getAttribute("selected")=="true"){return _21;}}},isNativeUrl:function(_22){for(var i=0;i<iui.nativeUrlPatterns.length;i++){if(_22.match(iui.nativeUrlPatterns[i])){return true;}}return false;},nativeUrlPatterns:[new RegExp("^http://maps.google.com/maps?"),new RegExp("^mailto:"),new RegExp("^tel:"),new RegExp("^http://www.youtube.com/watch\\?v="),new RegExp("^http://www.youtube.com/v/"),new RegExp("^javascript:"),]};addEventListener("load",function(_24){var _25=iui.getSelectedPage();var _26=getPageFromLoc();if(_25){iui.showPage(_25);}if(_26&&(_26!=_25)){iui.showPage(_26);}setTimeout(preloadImages,0);if(typeof window.onorientationchange=="object"){window.onorientationchange=orientChangeHandler;_b=true;setTimeout(orientChangeHandler,0);}setTimeout(checkOrientAndLocation,0);_a=setInterval(checkOrientAndLocation,300);},false);addEventListener("unload",function(_27){return;},false);addEventListener("click",function(_28){var _29=findParent(_28.target,"a");if(_29){function unselect(){_29.removeAttribute("selected");}if(_29.href&&_29.hash&&_29.hash!="#"&&!_29.target){_29.setAttribute("selected","true");iui.showPage($(_29.hash.substr(1)));setTimeout(unselect,500);}else{if(_29==$("backButton")){history.back();}else{if(_29.getAttribute("type")=="submit"){var _2a=findParent(_29,"form");if(_2a.target=="_self"){_2a.submit();return;}submitForm(_2a);}else{if(_29.getAttribute("type")=="cancel"){cancelDialog(findParent(_29,"form"));}else{if(_29.target=="_replace"){_29.setAttribute("selected","progress");iui.showPageByHref(_29.href,null,null,_29,unselect);}else{if(iui.isNativeUrl(_29.href)){return;}else{if(_29.target=="_webapp"){location.href=_29.href;}else{if(!_29.target){_29.setAttribute("selected","progress");iui.showPageByHref(_29.href,null,null,null,unselect);}else{return;}}}}}}}}_28.preventDefault();}},true);addEventListener("click",function(_2b){var div=findParent(_2b.target,"div");if(div&&hasClass(div,"toggle")){div.setAttribute("toggled",div.getAttribute("toggled")!="true");_2b.preventDefault();}},true);function getPageFromLoc(){var _2d;var _2e=location.hash.match(/#_([^\?_]+)/);if(_2e){_2d=_2e[1];}if(_2d){_2d=$(_2d);}return _2d;}function orientChangeHandler(){var _2f=window.orientation;switch(_2f){case 0:setOrientation(_c);break;case 90:case -90:setOrientation(_d);break;}}function checkOrientAndLocation(){if(!_b){if(window.innerWidth!=_5){_5=window.innerWidth;var _30=_5==320?_c:_d;setOrientation(_30);}}if(location.hash!=_6){var _31=location.hash.sub
|