(function () { // var realWidth=document.documentElement.clientWidth; // alert(window.screen.width); // alert(navigator.userAgent) var realWidth=window.screen.width; var mobileJs = document.createElement('script'); var head = document.getElementsByTagName('HEAD')[0]; // document.documentElement.clientWidth鏄獥鍙eぇ灏忥紝濡傛灉涓€寮€濮嬫湁璁緈eta width=device-width鍐嶆娴嬶紝灏辨槸璁惧澶у皬锛屽惁鍒欎竴寰嬩负娴忚鍣ㄩ粯璁ょ殑980; // window.screen.width鏄睆骞曠殑鐪熷疄澶у皬锛岃窡娴忚鍣ㄦ棤鍏 var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod", "miniProgram" , "miniprogram" ,"MiniProgram"]; var isPC = true; for (var v = 0; v < Agents.length; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { isPC = false; break; } } window.isPC=isPC; if(!isPC){ $('html').addClass('is_mobile'); }else{ $('html').addClass('is_PC'); } if (!isPC) { // var vivo=/VivoBrowser/; // var qq=/QQBrowser/; var isSpecial=false var specialBrowser=['VivoBrowser','QQBrowser'] for (var v = 0; v < specialBrowser.length; v++) { if (userAgentInfo.indexOf(specialBrowser[v]) > 0) { isSpecial = true; break; } } var isMiNi=false var miniPrograms=["miniProgram" , "miniprogram" ,"MiniProgram"] for (var v = 0; v < miniPrograms.length; v++) { if (userAgentInfo.indexOf(miniPrograms[v]) > 0) { isMiNi = true; break; } } // isVivo=vivo.test(window.navigator.userAgent); if (isMiNi) { var docEl = document.documentElement; var all_width=document.documentElement.clientWidth; var fs=parseInt(all_width)/10 var fontEl = document.createElement('style'); fontEl.innerHTML = 'html{font-size:'+ fs +'px!important;}'; docEl.firstElementChild.appendChild(fontEl); var rem=fs; window.mflag=true; window.rem=fs; window.rem2px = function (v) { v = parseFloat(v); return v * rem; }; window.px2rem = function (v) { v = parseFloat(v); return v / rem; }; } // 鐗规畩娴忚鍣ㄥ崟鐙瀹 鍥哄畾980鏄剧ず else if (isSpecial){ var metaEl = document.querySelector('meta[name="viewport"]'); var docEl = document.documentElement; // var metaEl=document.createElement("meta"); // metaEl.name="viewport"; // metaEl.setAttribute('content','width='+document.documentElement.clientWidth+',maximum-scale=1,user-scalable=no'); metaEl.setAttribute('content','width=980,maximum-scale=1,user-scalable=no'); var fontEl = document.createElement('style'); fontEl.innerHTML = 'html{font-size:98px!important;}'; docEl.firstElementChild.appendChild(fontEl); // docEl.firstElementChild.appendChild(metaEl); var rem=98; window.mflag=true; window.rem = Math.ceil(980/10); window.rem2px = function (v) { v = parseFloat(v); return v * rem; }; window.px2rem = function (v) { v = parseFloat(v); return v / rem; }; // 濡傛灉鍑虹幇鏍瑰瓧浣撲慨鏀瑰畬鏈塨ug锛岃窡rem涓嶇浉绛夌殑锛岄偅灏变慨鏀筸eta var fs=parseInt($("html").css("font-size")); if (fs!=rem) { var ww=fs*10; metaEl.setAttribute('content','width='+ww+',maximum-scale=1,user-scalable=no'); } } else{ (function () { var dpr, rem, scale; var docEl = document.documentElement; var fontEl = document.createElement('style'); var metaEl = document.querySelector('meta[name="viewport"]'); // var metaEl=document.createElement("meta") // metaEl.name="viewport"; dpr = window.devicePixelRatio || 1; // rem = Math.ceil(docEl.clientWidth * dpr / 10); rem = Math.ceil(realWidth * dpr / 10) scale = 1 / dpr; // 璁剧疆viewport锛岃繘琛岀缉鏀撅紝杈惧埌楂樻竻鏁堟灉 metaEl.setAttribute('content', 'width=' + dpr * realWidth + ',initial-scale=' + scale + ',maximum-scale=' + scale + ', minimum-scale=' + scale + ',user-scalable=no'); // 璁剧疆data-dpr灞炴€э紝鐣欎綔鐨刢ss hack涔嬬敤 docEl.setAttribute('data-dpr', dpr); // 鍔ㄦ€佸啓鍏ユ牱寮 docEl.firstElementChild.appendChild(fontEl); fontEl.innerHTML = 'html{font-size:' + rem + 'px!important;}'; //绉诲姩绔爣绛撅紱 window.mflag=true; // 缁檍s璋冪敤鐨勶紝鏌愪竴dpr涓媟em鍜宲x涔嬮棿鐨勮浆鎹㈠嚱鏁 window.rem2px = function (v) { v = parseFloat(v); return v * rem; }; window.px2rem = function (v) { v = parseFloat(v); return v / rem; }; window.dpr = dpr; window.rem = rem; var fs=parseInt($("html").css("font-size")); if (fs!=rem) { var ww=fs*10; metaEl.setAttribute('content','width='+ww+',maximum-scale=1,user-scalable=no'); } // docEl.firstElementChild.appendChild(metaEl); })() // 绉婚櫎鍘熸湁鐨刪eader $(document).ready(function(){$(".navbar-default").remove()}); } } // else if(realWidth>=720&&realWidth<=1024){ // var metaEl = document.querySelector('meta[name="viewport"]'); // metaEl.setAttribute("content","width=1280,user-scalable=0,maximum-scale=1.0") // } else{ var docEl = document.documentElement; var metaEl = document.querySelector('meta[name="viewport"]'); metaEl.setAttribute("content","width=device-width,initial-scale=0.3,maximum-scale=1.0,minimum-scale=0.2,user-scalable=yes") // 鎶婂姩鎬佹坊鍔犳敼鎴愬姩鎬佷慨鏀 // var metaEl=document.createElement("meta") // metaEl.name="viewport"; // metaEl.setAttribute("content","width=device-width,initial-scale=0.3,maximum-scale=1.0,minimum-scale=0.2,user-scalable=yes") // docEl.firstElementChild.appendChild(metaEl); } })(); function noScroll(event){ event.preventDefault(); } function showList(){ if ($(".show_list").css("height")=="0px") { $(".show_list").css("height","calc(100vh)"); $(".navbar-mobile .list_content").css("margin-top","0") // 鏄剧ず鐨勬椂鍊欓樆姝㈤〉闈㈡粴鍔 // document.documentElement.style.position = 'fixed'; window.addEventListener('touchmove',noScroll,{passive:false}) } } function hideList(){ if ($(".show_list").css("height")!="0px") { $(".show_list").css("height","0"); $(".navbar-mobile .list_content").css("margin-top","-1rem") // 鏄剧ず鐨勬椂鍊欓樆姝㈤〉闈㈡粴鍔 // document.documentElement.style.position = 'fixed'; window.removeEventListener('touchmove',noScroll,{passive:false}) } } // :active鍏煎IOS $(document).ready(function(){ document.body.addEventListener('touchstart', function (){}); }) // 绂佹UC鑷姩鍔犻摼鎺 function noUc_link(){ $("a").each(function(index, element) { try{ var thishref=$(this).attr("href"); var thisText=$(this).html(); if(thishref.indexOf("uc.cn")>=0){ $(this).replaceWith(thisText); } } catch(e){ } }); $("script").each(function(index, element) { try{ var thissrc=$(this).attr("src"); if(thissrc.indexOf("ucbrowser")>=0){ $(this).remove(); } } catch(e){ } }); } // 鎵цUC澶勭悊 $(function(){ var pageDATA_ua = window.navigator.userAgent.toLowerCase(); if(pageDATA_ua.indexOf('ucbrowser')>=0){ noUc_link(); setTimeout(function(){ // ($("iframe[src*='ucweb.com']")[0]).remove(); $(".delete_next").next().remove(); }, 3000); }; })