(auth)
| 1368 | PingRequest(); |
| 1369 | } |
| 1370 | var ServerConnect = function(auth) { |
| 1371 | var Self = this; |
| 1372 | var xhr = new XMLHttpRequest(); |
| 1373 | var url = OpenSpeedTestdb; |
| 1374 | if (auth == 1) { |
| 1375 | url = webIP; |
| 1376 | } |
| 1377 | if (auth == 5) { |
| 1378 | url = saveDataURL; |
| 1379 | } |
| 1380 | if (auth == 7) { |
| 1381 | url = get_IP; |
| 1382 | } |
| 1383 | xhr.open("POST", url, true); |
| 1384 | xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
| 1385 | xhr.onreadystatechange = function() { |
| 1386 | if (xhr.readyState == 4 && xhr.status == 200) { |
| 1387 | return_data = xhr.responseText.trim(); |
| 1388 | if (auth == 2) { |
| 1389 | key = return_data; |
| 1390 | } |
| 1391 | if (auth == 1) { |
| 1392 | TestServerip = return_data; |
| 1393 | } |
| 1394 | if (auth == 3) { |
| 1395 | setTimeout(function() { |
| 1396 | location.href = showResult + return_data; |
| 1397 | }, 1500); |
| 1398 | } |
| 1399 | if (auth == 6) { |
| 1400 | openSpeedTestServerList = JSON.parse(return_data); |
| 1401 | launch = true; |
| 1402 | runTasks(); |
| 1403 | } |
| 1404 | if (auth == 7) { |
| 1405 | Show.YourIP.el.textContent = return_data; |
| 1406 | } |
| 1407 | } |
| 1408 | }; |
| 1409 | if (auth == 2) { |
| 1410 | logData = "r=n"; |
| 1411 | } |
| 1412 | if (auth == 3) { |
| 1413 | logData = "r=l" + "&d=" + downloadSpeed + "&u=" + uploadSpeed + "&dd=" + dataUsedfordl / 1048576 + "&ud=" + dataUsedforul / 1048576 + "&p=" + pingEstimate + "&do=" + myhostName + "&S=" + key + "&sip=" + TestServerip + "&jit=" + jitterEstimate + "&ua=" + userAgentString; |
| 1414 | } |
| 1415 | if (auth == 5) { |
| 1416 | logData = saveTestData; |
| 1417 | } |
| 1418 | if (auth == 6) { |
| 1419 | logData = "r=s"; |
| 1420 | } |
| 1421 | xhr.send(logData); |
| 1422 | }; |
| 1423 | }; |
| 1424 | OpenSpeedTest.Start = function() { |
| 1425 | new openSpeedtestEngine(); |
no test coverage detected