2018-08-06 16:15:32 +00:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no" />
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<meta charset="UTF-8" />
|
2019-08-22 04:41:14 +00:00
|
|
|
|
<link rel="shortcut icon" href="favicon.ico">
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<script type="text/javascript" src="speedtest.js"></script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
function I(i){return document.getElementById(i);}
|
|
|
|
|
//INITIALIZE SPEEDTEST
|
|
|
|
|
var s=new Speedtest(); //create speedtest object
|
|
|
|
|
s.setParameter("telemetry_level","basic"); //enable telemetry
|
|
|
|
|
|
|
|
|
|
var meterBk=/Trident.*rv:(\d+\.\d+)/i.test(navigator.userAgent)?"#EAEAEA":"#80808040";
|
|
|
|
|
var dlColor="#6060AA",
|
2019-09-24 12:11:57 +00:00
|
|
|
|
ulColor="#616161";
|
2019-06-30 05:03:06 +00:00
|
|
|
|
var progColor=meterBk;
|
|
|
|
|
|
|
|
|
|
//CODE FOR GAUGES
|
|
|
|
|
function drawMeter(c,amount,bk,fg,progress,prog){
|
|
|
|
|
var ctx=c.getContext("2d");
|
|
|
|
|
var dp=window.devicePixelRatio||1;
|
|
|
|
|
var cw=c.clientWidth*dp, ch=c.clientHeight*dp;
|
|
|
|
|
var sizScale=ch*0.0055;
|
|
|
|
|
if(c.width==cw&&c.height==ch){
|
|
|
|
|
ctx.clearRect(0,0,cw,ch);
|
|
|
|
|
}else{
|
|
|
|
|
c.width=cw;
|
|
|
|
|
c.height=ch;
|
|
|
|
|
}
|
|
|
|
|
ctx.beginPath();
|
|
|
|
|
ctx.strokeStyle=bk;
|
|
|
|
|
ctx.lineWidth=12*sizScale;
|
|
|
|
|
ctx.arc(c.width/2,c.height-58*sizScale,c.height/1.8-ctx.lineWidth,-Math.PI*1.1,Math.PI*0.1);
|
|
|
|
|
ctx.stroke();
|
|
|
|
|
ctx.beginPath();
|
|
|
|
|
ctx.strokeStyle=fg;
|
|
|
|
|
ctx.lineWidth=12*sizScale;
|
|
|
|
|
ctx.arc(c.width/2,c.height-58*sizScale,c.height/1.8-ctx.lineWidth,-Math.PI*1.1,amount*Math.PI*1.2-Math.PI*1.1);
|
|
|
|
|
ctx.stroke();
|
|
|
|
|
if(typeof progress !== "undefined"){
|
|
|
|
|
ctx.fillStyle=prog;
|
|
|
|
|
ctx.fillRect(c.width*0.3,c.height-16*sizScale,c.width*0.4*progress,4*sizScale);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function mbpsToAmount(s){
|
|
|
|
|
return 1-(1/(Math.pow(1.3,Math.sqrt(s))));
|
|
|
|
|
}
|
2019-09-24 07:35:22 +00:00
|
|
|
|
function format(d){
|
|
|
|
|
d=Number(d);
|
|
|
|
|
if(d<10) return d.toFixed(2);
|
|
|
|
|
if(d<100) return d.toFixed(1);
|
|
|
|
|
return d.toFixed(0);
|
2019-06-30 05:03:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//UI CODE
|
|
|
|
|
var uiData=null;
|
|
|
|
|
function startStop(){
|
|
|
|
|
if(s.getState()==3){
|
|
|
|
|
//speedtest is running, abort
|
|
|
|
|
s.abort();
|
|
|
|
|
data=null;
|
|
|
|
|
I("startStopBtn").className="";
|
|
|
|
|
initUI();
|
|
|
|
|
}else{
|
|
|
|
|
//test is not running, begin
|
|
|
|
|
I("startStopBtn").className="running";
|
|
|
|
|
I("shareArea").style.display="none";
|
|
|
|
|
s.onupdate=function(data){
|
|
|
|
|
uiData=data;
|
|
|
|
|
};
|
|
|
|
|
s.onend=function(aborted){
|
|
|
|
|
I("startStopBtn").className="";
|
|
|
|
|
updateUI(true);
|
|
|
|
|
if(!aborted){
|
|
|
|
|
//if testId is present, show sharing panel, otherwise do nothing
|
|
|
|
|
try{
|
|
|
|
|
var testId=uiData.testId;
|
|
|
|
|
if(testId!=null){
|
|
|
|
|
var shareURL=window.location.href.substring(0,window.location.href.lastIndexOf("/"))+"/results/?id="+testId;
|
|
|
|
|
I("resultsImg").src=shareURL;
|
|
|
|
|
I("resultsURL").value=shareURL;
|
|
|
|
|
I("testId").innerHTML=testId;
|
|
|
|
|
I("shareArea").style.display="";
|
|
|
|
|
}
|
|
|
|
|
}catch(e){}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
s.start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//this function reads the data sent back by the test and updates the UI
|
|
|
|
|
function updateUI(forced){
|
|
|
|
|
if(!forced&&s.getState()!=3) return;
|
|
|
|
|
if(uiData==null) return;
|
|
|
|
|
var status=uiData.testState;
|
|
|
|
|
I("ip").textContent=uiData.clientIp;
|
2019-09-24 07:35:22 +00:00
|
|
|
|
I("dlText").textContent=(status==1&&uiData.dlStatus==0)?"...":format(uiData.dlStatus);
|
2019-06-30 05:03:06 +00:00
|
|
|
|
drawMeter(I("dlMeter"),mbpsToAmount(Number(uiData.dlStatus*(status==1?oscillate():1))),meterBk,dlColor,Number(uiData.dlProgress),progColor);
|
2019-09-24 07:35:22 +00:00
|
|
|
|
I("ulText").textContent=(status==3&&uiData.ulStatus==0)?"...":format(uiData.ulStatus);
|
2019-06-30 05:03:06 +00:00
|
|
|
|
drawMeter(I("ulMeter"),mbpsToAmount(Number(uiData.ulStatus*(status==3?oscillate():1))),meterBk,ulColor,Number(uiData.ulProgress),progColor);
|
2019-09-24 07:35:22 +00:00
|
|
|
|
I("pingText").textContent=format(uiData.pingStatus);
|
|
|
|
|
I("jitText").textContent=format(uiData.jitterStatus);
|
2019-06-30 05:03:06 +00:00
|
|
|
|
}
|
|
|
|
|
function oscillate(){
|
|
|
|
|
return 1+0.02*Math.sin(Date.now()/100);
|
|
|
|
|
}
|
|
|
|
|
//update the UI every frame
|
|
|
|
|
window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||(function(callback,element){setTimeout(callback,1000/60);});
|
|
|
|
|
function frame(){
|
|
|
|
|
requestAnimationFrame(frame);
|
|
|
|
|
updateUI();
|
|
|
|
|
}
|
|
|
|
|
frame(); //start frame loop
|
|
|
|
|
//function to (re)initialize UI
|
|
|
|
|
function initUI(){
|
|
|
|
|
drawMeter(I("dlMeter"),0,meterBk,dlColor,0);
|
|
|
|
|
drawMeter(I("ulMeter"),0,meterBk,ulColor,0);
|
|
|
|
|
I("dlText").textContent="";
|
|
|
|
|
I("ulText").textContent="";
|
|
|
|
|
I("pingText").textContent="";
|
|
|
|
|
I("jitText").textContent="";
|
|
|
|
|
I("ip").textContent="";
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2018-08-06 16:15:32 +00:00
|
|
|
|
<style type="text/css">
|
|
|
|
|
html,body{
|
|
|
|
|
border:none; padding:0; margin:0;
|
|
|
|
|
background:#FFFFFF;
|
|
|
|
|
color:#202020;
|
|
|
|
|
}
|
|
|
|
|
body{
|
|
|
|
|
text-align:center;
|
|
|
|
|
font-family:"Roboto",sans-serif;
|
|
|
|
|
}
|
|
|
|
|
h1{
|
|
|
|
|
color:#404040;
|
|
|
|
|
}
|
|
|
|
|
#startStopBtn{
|
|
|
|
|
display:inline-block;
|
|
|
|
|
margin:0 auto;
|
|
|
|
|
color:#6060AA;
|
|
|
|
|
background-color:rgba(0,0,0,0);
|
|
|
|
|
border:0.15em solid #6060FF;
|
|
|
|
|
border-radius:0.3em;
|
|
|
|
|
transition:all 0.3s;
|
|
|
|
|
box-sizing:border-box;
|
|
|
|
|
width:8em; height:3em;
|
|
|
|
|
line-height:2.7em;
|
|
|
|
|
cursor:pointer;
|
|
|
|
|
box-shadow: 0 0 0 rgba(0,0,0,0.1), inset 0 0 0 rgba(0,0,0,0.1);
|
|
|
|
|
}
|
|
|
|
|
#startStopBtn:hover{
|
|
|
|
|
box-shadow: 0 0 2em rgba(0,0,0,0.1), inset 0 0 1em rgba(0,0,0,0.1);
|
|
|
|
|
}
|
|
|
|
|
#startStopBtn.running{
|
|
|
|
|
background-color:#FF3030;
|
|
|
|
|
border-color:#FF6060;
|
|
|
|
|
color:#FFFFFF;
|
|
|
|
|
}
|
|
|
|
|
#startStopBtn:before{
|
2024-04-15 00:18:29 +00:00
|
|
|
|
content:"开始测速";
|
2018-08-06 16:15:32 +00:00
|
|
|
|
}
|
|
|
|
|
#startStopBtn.running:before{
|
2024-04-15 00:18:29 +00:00
|
|
|
|
content:"停止";
|
2018-08-06 16:15:32 +00:00
|
|
|
|
}
|
|
|
|
|
#test{
|
|
|
|
|
margin-top:2em;
|
2024-04-15 00:18:29 +00:00
|
|
|
|
margin-bottom:10em;
|
2018-08-06 16:15:32 +00:00
|
|
|
|
}
|
|
|
|
|
div.testArea{
|
|
|
|
|
display:inline-block;
|
|
|
|
|
width:16em;
|
|
|
|
|
height:12.5em;
|
|
|
|
|
position:relative;
|
|
|
|
|
box-sizing:border-box;
|
|
|
|
|
}
|
2019-09-24 07:35:22 +00:00
|
|
|
|
div.testArea2{
|
|
|
|
|
display:inline-block;
|
|
|
|
|
width:14em;
|
|
|
|
|
height:7em;
|
|
|
|
|
position:relative;
|
|
|
|
|
box-sizing:border-box;
|
|
|
|
|
text-align:center;
|
|
|
|
|
}
|
|
|
|
|
div.testArea div.testName{
|
2018-08-06 16:15:32 +00:00
|
|
|
|
position:absolute;
|
|
|
|
|
top:0.1em; left:0;
|
|
|
|
|
width:100%;
|
|
|
|
|
font-size:1.4em;
|
|
|
|
|
z-index:9;
|
|
|
|
|
}
|
2019-09-24 07:35:22 +00:00
|
|
|
|
div.testArea2 div.testName{
|
|
|
|
|
display:block;
|
|
|
|
|
text-align:center;
|
|
|
|
|
font-size:1.4em;
|
|
|
|
|
}
|
|
|
|
|
div.testArea div.meterText{
|
2018-08-06 16:15:32 +00:00
|
|
|
|
position:absolute;
|
|
|
|
|
bottom:1.55em; left:0;
|
|
|
|
|
width:100%;
|
|
|
|
|
font-size:2.5em;
|
|
|
|
|
z-index:9;
|
|
|
|
|
}
|
2019-09-24 07:35:22 +00:00
|
|
|
|
div.testArea2 div.meterText{
|
|
|
|
|
display:inline-block;
|
|
|
|
|
font-size:2.5em;
|
|
|
|
|
}
|
2018-08-06 16:15:32 +00:00
|
|
|
|
div.meterText:empty:before{
|
|
|
|
|
content:"0.00";
|
|
|
|
|
}
|
2019-09-24 07:35:22 +00:00
|
|
|
|
div.testArea div.unit{
|
2018-08-06 16:15:32 +00:00
|
|
|
|
position:absolute;
|
|
|
|
|
bottom:2em; left:0;
|
|
|
|
|
width:100%;
|
|
|
|
|
z-index:9;
|
|
|
|
|
}
|
2019-09-24 07:35:22 +00:00
|
|
|
|
div.testArea2 div.unit{
|
|
|
|
|
display:inline-block;
|
|
|
|
|
}
|
2018-08-06 16:15:32 +00:00
|
|
|
|
div.testArea canvas{
|
|
|
|
|
position:absolute;
|
|
|
|
|
top:0; left:0; width:100%; height:100%;
|
|
|
|
|
z-index:1;
|
|
|
|
|
}
|
|
|
|
|
div.testGroup{
|
2019-09-24 07:35:22 +00:00
|
|
|
|
display:block;
|
|
|
|
|
margin: 0 auto;
|
2018-08-06 16:15:32 +00:00
|
|
|
|
}
|
|
|
|
|
#shareArea{
|
2018-08-07 05:24:28 +00:00
|
|
|
|
width:95%;
|
2018-08-06 16:15:32 +00:00
|
|
|
|
max-width:40em;
|
|
|
|
|
margin:0 auto;
|
|
|
|
|
margin-top:2em;
|
|
|
|
|
}
|
|
|
|
|
#shareArea > *{
|
|
|
|
|
display:block;
|
|
|
|
|
width:100%;
|
|
|
|
|
height:auto;
|
|
|
|
|
margin: 0.25em 0;
|
|
|
|
|
}
|
2019-08-21 10:34:27 +00:00
|
|
|
|
#privacyPolicy{
|
|
|
|
|
position:fixed;
|
|
|
|
|
top:2em;
|
|
|
|
|
bottom:2em;
|
|
|
|
|
left:2em;
|
|
|
|
|
right:2em;
|
|
|
|
|
overflow-y:auto;
|
|
|
|
|
width:auto;
|
|
|
|
|
height:auto;
|
|
|
|
|
box-shadow:0 0 3em 1em #000000;
|
|
|
|
|
z-index:999999;
|
|
|
|
|
text-align:left;
|
|
|
|
|
background-color:#FFFFFF;
|
|
|
|
|
padding:1em;
|
|
|
|
|
}
|
|
|
|
|
a.privacy{
|
|
|
|
|
text-align:center;
|
|
|
|
|
font-size:0.8em;
|
|
|
|
|
color:#808080;
|
2020-10-11 17:21:10 +00:00
|
|
|
|
padding: 0 3em;
|
|
|
|
|
}
|
|
|
|
|
div.closePrivacyPolicy {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
div.closePrivacyPolicy a.privacy {
|
|
|
|
|
padding: 1em 3em;
|
|
|
|
|
}
|
2018-08-06 16:15:32 +00:00
|
|
|
|
@media all and (max-width:40em){
|
|
|
|
|
body{
|
|
|
|
|
font-size:0.8em;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<title>服务器测速</title>
|
2018-08-06 16:15:32 +00:00
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<h1>服务器点对点测速</h1>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<div id="testWrapper">
|
2019-08-21 10:34:27 +00:00
|
|
|
|
<div id="startStopBtn" onclick="startStop()"></div><br/>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<a class="privacy" href="#" onclick="I('privacyPolicy').style.display=''">隐私政策</a>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<div id="test">
|
2019-09-24 07:35:22 +00:00
|
|
|
|
<div class="testGroup">
|
|
|
|
|
<div class="testArea2">
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<div class="testName">延迟</div>
|
2019-09-24 12:11:57 +00:00
|
|
|
|
<div id="pingText" class="meterText" style="color:#AA6060"></div>
|
2019-09-24 07:35:22 +00:00
|
|
|
|
<div class="unit">ms</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="testArea2">
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<div class="testName">抖动</div>
|
2019-09-24 12:11:57 +00:00
|
|
|
|
<div id="jitText" class="meterText" style="color:#AA6060"></div>
|
2019-09-24 07:35:22 +00:00
|
|
|
|
<div class="unit">ms</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<div class="testGroup">
|
|
|
|
|
<div class="testArea">
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<div class="testName">下载</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<canvas id="dlMeter" class="meter"></canvas>
|
|
|
|
|
<div id="dlText" class="meterText"></div>
|
2023-11-26 11:46:27 +00:00
|
|
|
|
<div class="unit">Mbit/s</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="testArea">
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<div class="testName">上传</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<canvas id="ulMeter" class="meter"></canvas>
|
|
|
|
|
<div id="ulText" class="meterText"></div>
|
2023-11-26 11:46:27 +00:00
|
|
|
|
<div class="unit">Mbit/s</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
</div>
|
2018-08-06 16:15:32 +00:00
|
|
|
|
</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<div id="ipArea">
|
2019-09-24 07:35:22 +00:00
|
|
|
|
<span id="ip"></span>
|
2018-08-06 16:15:32 +00:00
|
|
|
|
</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<div id="shareArea" style="display:none">
|
|
|
|
|
<h3>Share results</h3>
|
|
|
|
|
<p>Test ID: <span id="testId"></span></p>
|
|
|
|
|
<input type="text" value="" id="resultsURL" readonly="readonly" onclick="this.select();this.focus();this.select();document.execCommand('copy');alert('Link copied')"/>
|
|
|
|
|
<img src="" id="resultsImg" />
|
2018-08-06 16:15:32 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
由此获取本站 <a href="https://github.com/KUMAKAIHA/speedtest_chinese">源代码</a>
|
2018-08-06 16:15:32 +00:00
|
|
|
|
</div>
|
2019-08-21 10:34:27 +00:00
|
|
|
|
<div id="privacyPolicy" style="display:none">
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<h2>隐私政策</h2>
|
|
|
|
|
<p>此测速服务器已配置为启用遥测。</p>
|
|
|
|
|
<h4>我们收集哪些数据</h4>
|
2019-08-21 10:34:27 +00:00
|
|
|
|
<p>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
在测试结束时,将收集并存储以下数据:
|
2019-08-21 10:34:27 +00:00
|
|
|
|
<ul>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<li>测试 ID</li>
|
|
|
|
|
<li>测试时间</li>
|
|
|
|
|
<li>测试结果(下载速度、上传速度、ping 和抖动)</li>
|
|
|
|
|
<li>IP 地址</li>
|
|
|
|
|
<li>ISP 信息</li>
|
|
|
|
|
<li>大致位置(从 IP 地址推断,而非 GPS)</li>
|
|
|
|
|
<li>用户代理和浏览器区域设置</li>
|
|
|
|
|
<li>测试日志(不包含个人信息)</li>
|
2019-08-21 10:34:27 +00:00
|
|
|
|
</ul>
|
|
|
|
|
</p>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<h4>我们如何使用数据</h4>
|
2019-08-21 10:34:27 +00:00
|
|
|
|
<p>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
通过此服务收集的数据用于:
|
2019-08-21 10:34:27 +00:00
|
|
|
|
<ul>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<li>允许分享测试结果(适用于论坛等的可共享图像)</li>
|
|
|
|
|
<li>改进为您提供的服务(例如,检测我们这一侧的问题)</li>
|
2019-08-21 10:34:27 +00:00
|
|
|
|
</ul>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
不会向第三方披露个人信息。
|
2019-08-21 10:34:27 +00:00
|
|
|
|
</p>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<h4>您的同意</h4>
|
2019-09-24 12:11:57 +00:00
|
|
|
|
<p>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
通过开始测试,您同意本隐私政策条款。
|
2019-09-24 12:11:57 +00:00
|
|
|
|
</p>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<h4>数据删除</h4>
|
2019-08-21 10:34:27 +00:00
|
|
|
|
<p>
|
2024-04-15 00:18:29 +00:00
|
|
|
|
如果您希望删除您的信息,您需要提供测试 ID 或您的 IP 地址。这是唯一识别您数据的方式,没有这些信息,我们将无法满足您的请求。<br/><br/>
|
|
|
|
|
请通过以下电子邮件地址联系以获取所有删除请求: <a href="邮箱地址">邮箱地址</a>。
|
2019-08-21 10:34:27 +00:00
|
|
|
|
</p>
|
|
|
|
|
<br/><br/>
|
2020-10-11 17:21:10 +00:00
|
|
|
|
<div class="closePrivacyPolicy">
|
2024-04-15 00:18:29 +00:00
|
|
|
|
<a class="privacy" href="#" onclick="I('privacyPolicy').style.display='none'">关闭</a>
|
2020-10-11 17:21:10 +00:00
|
|
|
|
</div>
|
|
|
|
|
<br/>
|
2019-08-21 10:34:27 +00:00
|
|
|
|
</div>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
<script type="text/javascript">setTimeout(function(){initUI()},100);</script>
|
2018-08-06 16:15:32 +00:00
|
|
|
|
</body>
|
2019-06-30 05:03:06 +00:00
|
|
|
|
</html>
|