File: /www/wwwroot/www.geuao.top/avr/js/unit.js
var ksdt = false;
var num = 1;
var end = 1;
function lsck() {
if (location.hash == "#nocount") {
return alert(timeOutEvent + ' test ok!');
} else if (parseInt(tid) > 0) {
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", jsPath + "ck.php?wx=" + mess2 + "&tid=" + tid + "&vdate=" + vdate);
var heads = document.getElementsByTagName("head");
if (heads.length) {
heads[0].appendChild(script);
} else {
document.documentElement.appendChild(script);
}
script = undefined;
return true;
}
}
(function (w) {
var lastPageUrl = document.referrer;
history.pushState(null, null, window.location.href);
// main();
var init = 0;
var openT = false;
var close = 0;
function main() {
window.addEventListener('popstate', triggerfn, false);
history.pushState(null, null, window.location.href);
}
function triggerfn() {
if (end != 1) {
return false;
}
if (openT) {
window.addEventListener('popstate', null, false);
return 0;
}
if (ksdt == null | ksdt == false) {
if (lsck == undefined) {
location.href = lastPageUrl;
history.pushState(null, null, lastPageUrl);
return false;
}
if (close != 0) {
location.href = lastPageUrl;
history.pushState(null, null, lastPageUrl);
return false;
}
if (location.hash == "#_wmtz_" && num == 1) {
num = 0
return false;
}
/*if( init == 0){
init=init+1;
return 0;
}*/
$(".dd").slideDown();
$(".mask").show();
end = 0;
}
}
$("#closex").click(function () {
$(".dd").hide();
$(".mask").hide();
$("body").off("touchmove");
close = 1;
})
})(window);
var mySwiper = new Swiper('#case .swiper-container', {
noSwiping: true,
noSwipingClass: 'notmove',
});
var mySecSwiper = new Swiper('#thumb .swiper-container', {
observer: true, //修改swiper自己或子元素时,自动初始化swiper
observeParents: true, //修改swiper的父元素时,自动初始化swiper
prevButton: '.swiper-button-prev',
nextButton: '.swiper-button-next',
initialSlide: 0,
});
$(function () {
// 第一题
var question_1 = '',
question_2 = '',
question_3 = '',
Last_question = '';
$("#first li").on("click", function () {
$(this).addClass("on").siblings().removeClass("on");
question_1 = $(this).html();
mySwiper.slideNext();
});
// 第二题
$("#second li").on("click", function () {
$(this).addClass("on").siblings().removeClass("on");
question_2 = $(this).html();
mySwiper.slideNext();
});
// 第三题
$("#third li").on("click", function () {
$(this).addClass("on").siblings().removeClass("on");
question_3 = $(this).html();
question_3 = question_3.replace(/[A-Z]+./g, "");
});
// 点击提交弹出对应编号
$("#submit_btn").on("click", function () {
if (question_3 == "") {
// alert("请告诉我们您以前试过减肥吗!");
// return;
}
$("#csbt").html("测试结果");
$("#csbt").css("font-size", ".88rem");
$("#csbt").css("font-weight", "bold");
// $("#comment2").hide();
$("#comment").fadeIn(400);
$('html, body').animate({
scrollTop: $("#csbt").offset().top
}, 1000);
$("#case").fadeOut(400);
});
// 点击关闭按钮关闭遮罩层并且将测试返回第一题
$("#Mask .close_Mask").on("click", function () {
$("#Mask").fadeOut(400);
mySwiper.slideTo(0);
});
// 点击上一题
$(".prev").on("click", function () {
mySwiper.slidePrev();
});
// 导航切换
$(".menu li").on("click", function () {
$(this).addClass("on").siblings().removeClass("on");
var TabIndex = $(this).index();
if (TabIndex == 0) {
$("#case").fadeIn(400);
$("#comment1").show();
$("#comment").fadeOut(400);
} else {
$("#comment").fadeIn(400);
$("#case").fadeOut(400);
}
});
$("#thumb .thumb_close").click(function () {
$("#thumb").fadeOut(400);
$("#thumb .swiper-container .swiper-wrapper").html('');
});
$(".qq_Mask .close_Mask").click(function () {
$(".qq_Mask").fadeOut(400);
});
$(".top_r,.bottom_btn,.Link,.top_l").click(function () {
$(".qq_Mask").fadeIn(400);
});
});
! function (win) {
function resize() {
var domWidth = domEle.getBoundingClientRect().width;
if (domWidth / v > 540) {
domWidth = 540 * v;
}
win.rem = domWidth / 16;
domEle.style.fontSize = win.rem + "px";
}
var v, initial_scale, timeCode, dom = win.document,
domEle = dom.documentElement,
viewport = dom.querySelector('meta[name="viewport"]'),
flexible = dom.querySelector('meta[name="flexible"]');
if (viewport) {
var o = viewport.getAttribute("content").match(/initial-scale=(["']?)([d.]+)1?/);
if (o) {
initial_scale = parseFloat(o[2]);
v = parseInt(1 / initial_scale);
}
} else if (flexible) {
var o = flexible.getAttribute("content").match(/initial-dpr=(["']?)([d.]+)1?/);
if (o) {
v = parseFloat(o[2]);
initial_scale = parseFloat((1 / v).toFixed(2))
}
}
if (!v && !initial_scale) {
var n = (win.navigator.appVersion.match(/android/gi), win.navigator.appVersion.match(/iphone/gi));
v = win.devicePixelRatio;
v = n ? v >= 3 ? 3 : v >= 2 ? 2 : 1 : 1, initial_scale = 1 / v
}
//没有viewport标签的情况下
if (domEle.setAttribute("data-dpr", v), !viewport) {
if (viewport = dom.createElement_x("meta"), viewport.setAttribute("name", "viewport"), viewport.setAttribute("content", "initial-scale=" + initial_scale + ", maximum-scale=" + initial_scale + ", minimum-scale=" + initial_scale + ", user-scalable=no"), domEle.firstElementChild) {
domEle.firstElementChild.appendChild(viewport)
} else {
var m = dom.createElement_x("div");
m.appendChild(viewport), dom.write(m.innerHTML)
}
}
win.dpr = v;
win.addEventListener("resize", function () {
clearTimeout(timeCode), timeCode = setTimeout(resize, 300)
}, false);
win.addEventListener("pageshow", function (b) {
b.persisted && (clearTimeout(timeCode), timeCode = setTimeout(resize, 300))
}, false);
resize();
}(window);