1 |
- var adaptUILayout=(function(){var c=(function(){var d={};var h={width:window.screen.width,height:window.screen.height};var g=window.navigator.appVersion;var l=window.orientation;var i=null;var f=function(m){return m.constructor==String?g.indexOf(m)>-1:g.test(m)};var k=function(m,o,n){if(m&&o){d[m]={key:o,size:n}}};var j=function(m){if(d[m]){delete d[m]}};var e=function(){if(i!=null){return i}for(var m in d){if(f(d[m].key)){i=d[m].size;break}}if(i==null){i=h}return i};return{add:k,del:j,cal:e,s:l}})();var b=function(e){var d=false;if(navigator.userAgent.match(/iPad/i)&&document.documentElement.clientWidth<=768){d=true}if(!navigator.userAgent.match(/iPad/i)&&document.documentElement.clientWidth<=e){d=true}return d};var a=function(k){var f,e,i,j,h,d,g;g=navigator.userAgent.toLowerCase();isiOS=g.indexOf("ipad")>-1||g.indexOf("iphone")>-1;e=window.devicePixelRatio;e<1.5?2:e;if(window.orientation==0||window.orientation==180){if(c.s!=0){if(c.cal().width<c.cal().height){f=c.cal().width}else{f=c.cal().height}}else{f=c.cal().width}}else{if(c.s!=0){if(c.cal().width>c.cal().height){f=c.cal().width}else{f=c.cal().height}}else{f=c.cal().height}}if(e==2&&(f==320||f==360||f==592||f==640)){f*=2}if(e==1.5&&(f==320)){f*=2;e=2}if(e==1.5&&(f==640)){e=2}i=k/f*e*160;j=isiOS?"width="+k+"px, user-scalable=no":"target-densitydpi="+i+", width="+k+", user-scalable=no";meta=meta=document.getElementsByName("viewport")[0];meta.content=j};return{regulateScreen:c,adapt:a,viewport:b}})();var isViewport=adaptUILayout.viewport(750);if(isViewport){adaptUILayout.adapt(750);$(window).bind("orientationchange",function(a){adaptUILayout.adapt(750)})}$(function(){$("body").addClass("show");try{viewport(adaptUILayout.regulateScreen.cal())}catch(a){}});
|