From 9c26030dcf80b2eae5f0155fb50fbbb941112038 Mon Sep 17 00:00:00 2001 From: hhCandy Date: Wed, 13 Feb 2019 10:10:15 +0800 Subject: [PATCH] add timeout --- easyVer.min.js | 12 ++++++++---- index.html | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/easyVer.min.js b/easyVer.min.js index 33f39da..227073c 100644 --- a/easyVer.min.js +++ b/easyVer.min.js @@ -1,3 +1,6 @@ + +var v_timeOut=Date.parse(new Date()); + function imgVer(Config) { var el = eval(Config.el); var w = Config.width; @@ -23,6 +26,7 @@ function imgVer(Config) { } var imgSrc = "https://cdn.yimian.ac.cn/easyVer/image.php?df="+Math.floor(Math.random()*10); + v_timeOut=Date.parse(new Date()); var X = RandomNum(MinN_X, MaxN_X); var Y = RandomNum(MinN_Y, MaxN_Y); var left_Num = -X + 10; @@ -185,7 +189,7 @@ var touch_pageX; var Max_left = ver_Num + deviation; if (moveStart == '') {} else { if (Max_left > moveEnd_X && moveEnd_X > Min_left) { - $(".ver-tips").html('Authority Confimed!'); + $(".ver-tips").html('Authority Confimed! Only use '+(Date.parse(new Date())-v_timeOut)/1000+'s!'); $(".ver-tips").addClass("slider-tips"); $(".puzzle-lost-box").addClass("hidden"); $("#puzzleBox").addClass("hidden"); @@ -202,7 +206,7 @@ var touch_pageX; setTimeout(function() { $(".ver-tips").removeClass("slider-tips"); document.getElementById("scream").src="https://cdn.yimian.ac.cn/easyVer/image.php?df="+Math.floor(Math.random()*10); - imgVer(Config); + imgVer(Config);v_timeOut=Date.parse(new Date()); }, 2000); @@ -244,7 +248,7 @@ var touch_pageX; var Max_left = ver_Num + deviation; if (moveStart == '') {} else { if (Max_left > moveEnd_X && moveEnd_X > Min_left) { - $(".ver-tips").html('Authority Confimed!'); + $(".ver-tips").html('Authority Confimed! Only use '+(Date.parse(new Date())-v_timeOut)/1000+'s!'); $(".ver-tips").addClass("slider-tips"); $(".puzzle-lost-box").addClass("hidden"); $("#puzzleBox").addClass("hidden"); @@ -261,7 +265,7 @@ var touch_pageX; setTimeout(function() { $(".ver-tips").removeClass("slider-tips"); document.getElementById("scream").src="https://cdn.yimian.ac.cn/easyVer/image.php?df="+Math.floor(Math.random()*10); - imgVer(Config); + imgVer(Config);v_timeOut=Date.parse(new Date()); }, 2000); diff --git a/index.html b/index.html index 635b14d..20b2595 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - +