From 3584c7c36b4056e9de150fd3cdfe22ebe6b3086c Mon Sep 17 00:00:00 2001 From: kollucharan <132676020+kollucharan@users.noreply.github.com> Date: Tue, 11 Feb 2025 14:56:55 +0530 Subject: [PATCH 1/5] added status ,changed logo --- docker/standalone.php | 1582 ++++++++++++++++++++++------------------- index.html | 150 +++- logo.png | Bin 3293 -> 4399 bytes 3 files changed, 1015 insertions(+), 717 deletions(-) diff --git a/docker/standalone.php b/docker/standalone.php index ed714faf8..e9456909d 100755 --- a/docker/standalone.php +++ b/docker/standalone.php @@ -22,716 +22,872 @@ function I(i) { return document.getElementById(i); } s.setParameter("getIp_ispInfo_distance", ""); - 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", - ulColor = "#616161"; - var progColor = meterBk; - - function mbpsToAmount(s) { - return 1 - 1 / Math.pow(1.3, Math.sqrt(s)); - } - function format(d) { - d = Number(d); - if (d < 10) return d.toFixed(2); - if (d < 100) return d.toFixed(1); - return d.toFixed(0); - } - - // 3: Good - // 2: Average - // 1: Poor - // "": Empty - - function classifySpeed(value) { - if (value == "") return 0; - if (value > 50) return 3; - if (value >= 10) return 2; - return 1; - } - - function classifySpeedUpload(value) { - if (value == "") return 0; - if (value > 20) return 3; - if (value >= 5) return 2; - return 1; - } - - function updateDlColor(value) { - const dl_text_element = document.getElementById("dlText"); - const speed_classification = classifySpeed(value); - - switch (speed_classification) { - case 3: - dl_text_element.style.color = "#16A34A"; - break; - case 2: - dl_text_element.style.color = "#CA8A04"; - break; - case 1: - dl_text_element.style.color = "#DC2626"; - break; - case 0: - dl_text_element.style.color = "#111827"; - break; - - default: - dl_text_element.style.color = "#111827"; - } - } - - function updateUlColor(value) { - const ul_text_element = document.getElementById("ulText"); - const speed_classification = classifySpeedUpload(value); - - switch (speed_classification) { - case 3: - ul_text_element.style.color = "#16A34A"; - break; - case 2: - ul_text_element.style.color = "#CA8A04"; - break; - case 1: - ul_text_element.style.color = "#DC2626"; - break; - case 0: - ul_text_element.style.color = "#111827"; - break; - - default: - ul_element.style.color = "#111827"; - } - } - - function classifyPing(value) { - if (value == "") return 0; - if (value > 100) return 1; - if (value >= 20) return 2; - return 3; - } - - function updatePingColor(value) { - const ping_element = document.getElementById("pingText"); - const ping_classification = classifyPing(value); - - switch (ping_classification) { - case 3: - ping_element.style.color = "#16A34A"; - break; - case 2: - ping_element.style.color = "#CA8A04"; - break; - case 1: - ping_element.style.color = "#DC2626"; - break; - case 0: - ping_element.style.color = "#111827"; - break; - - default: - ping_element.style.color = "#111827"; - } - } - - function classifyJitter(value) { - if (value == "") return 0; - if (value > 20) return 1; - if (value >= 5) return 2; - return 3; - } - - function updateJitterColor(value) { - const jitter_element = document.getElementById("jitText"); - const jitter_classification = classifyJitter(value); - - // jitter_classification === 2?jitter_element.style.color = "#16A34A":(jitter_classification === 1?jitter_element.style.color = "#CA8A04":jitter_element.style.color = "#DC2626"); - - switch (jitter_classification) { - case 3: - jitter_element.style.color = "#16A34A"; - break; - case 2: - jitter_element.style.color = "#CA8A04"; - break; - case 1: - jitter_element.style.color = "#DC2626"; - break; - case 0: - jitter_element.style.color = "#111827"; - break; - - default: - jitter_element.style.color = "#111827"; - } - } - - //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 - // I("startStopBtn").textContent = "Try Again"; - I("startStopBtn").className = "new-class"; - try { - var testId = uiData.testId; - if (testId != null) { - var shareURL = - window.location.href.substring( - 0, - window.location.href.lastIndexOf("/") - ) + - "/results/?id=" + - testId; - console.log("ShareURL: ", shareURL); - // 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; - - I("dlText").textContent = - status == 1 && uiData.dlStatus == 0 ? "..." : format(uiData.dlStatus); - // drawMeter(I("dlMeter"), mbpsToAmount(Number(uiData.dlStatus * (status == 1 ? oscillate() : 1))), meterBk, dlColor, Number(uiData.dlProgress), progColor); - I("ulText").textContent = - status == 3 && uiData.ulStatus == 0 ? "..." : format(uiData.ulStatus); - // drawMeter(I("ulMeter"), mbpsToAmount(Number(uiData.ulStatus * (status == 3 ? oscillate() : 1))), meterBk, ulColor, Number(uiData.ulProgress), progColor); - I("pingText").textContent = format(uiData.pingStatus); - I("jitText").textContent = format(uiData.jitterStatus); - - if (status == 1) { - updateDlColor(uiData.dlStatus); - // updateDlColor(30, "download"); - } else if (status == 3) { - updateUlColor(uiData.ulStatus); - } else { - updateDlColor(uiData.dlStatus); - updateUlColor(uiData.ulStatus); - } - - updatePingColor(uiData.pingStatus); - updateJitterColor(uiData.jitterStatus); - } - 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() { - I("dlText").textContent = ""; - I("ulText").textContent = ""; - I("pingText").textContent = ""; - I("jitText").textContent = ""; - } - - - - - Talview Speedtest - - - -
-
- -
-
- -
-
-
Internet Speed Test
- -
-

- Before you begin your assessment or interview, please ensure your - internet connection meets the minimum requirement for a smooth - experience: -

-
    -
  1. Click “Start” to check your current network performance.
  2. -
  3. - Once the test is complete, review the results displayed on the - screen. -
  4. -
  5. - Ensure all network metrics meet the requirements listed above. -
  6. -
-
- - -
-
-
-
-
Ping
-
-
-
ms
-
-
- -
- -
-
-
Jitter
-
-
-
ms
-
-
- -
-
-
-
-
-
Download
-
-
-
Mbps
-
-
- -
- -
-
-
Upload
-
-
-
Mbps
-
-
- -
-
-
- - - -
-
-
- - -
-
- - - - \ No newline at end of file + + + 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", + ulColor = "#616161"; + var progColor = meterBk; + + let message = ""; + let prevTestState = null; + let flag2 = false; + let flag = false; + let instructionsare = ` + `; + + function mbpsToAmount(s) { + return 1 - 1 / Math.pow(1.3, Math.sqrt(s)); + } + function format(d) { + d = Number(d); + if (d < 10) return d.toFixed(2); + if (d < 100) return d.toFixed(1); + return d.toFixed(0); + } + + // 3: Good + // 2: Average + // 1: Poor + // "": Empty + + function classifySpeed(value) { + if (value == "") return 0; + if (value > 50) return 3; + if (value >= 5) return 2; + return 1; + } + + function classifySpeedUpload(value) { + if (value == "") return 0; + if (value > 20) return 3; + if (value >= 5) return 2; + return 1; + } + + function updateDlColor(value) { + const dl_text_element = document.getElementById("dlText"); + const speed_classification = classifySpeed(value); + + switch (speed_classification) { + case 3: + dl_text_element.style.color = "#16A34A"; + break; + case 2: + dl_text_element.style.color = "#CA8A04"; + break; + case 1: + dl_text_element.style.color = "#DC2626"; + break; + case 0: + dl_text_element.style.color = "#111827"; + break; + + default: + dl_text_element.style.color = "#111827"; + } + } + + function updateUlColor(value) { + const ul_text_element = document.getElementById("ulText"); + const speed_classification = classifySpeedUpload(value); + + switch (speed_classification) { + case 3: + ul_text_element.style.color = "#16A34A"; + break; + case 2: + ul_text_element.style.color = "#CA8A04"; + break; + case 1: + ul_text_element.style.color = "#DC2626"; + break; + case 0: + ul_text_element.style.color = "#111827"; + break; + + default: + ul_element.style.color = "#111827"; + } + } + + function classifyPing(value) { + if (value == "") return 0; + if (value > 100) return 1; + if (value >= 20) return 2; + return 3; + } + + function updatePingColor(value) { + const ping_element = document.getElementById("pingText"); + const ping_classification = classifyPing(value); + + switch (ping_classification) { + case 3: + ping_element.style.color = "#16A34A"; + break; + case 2: + ping_element.style.color = "#CA8A04"; + break; + case 1: + ping_element.style.color = "#DC2626"; + break; + case 0: + ping_element.style.color = "#111827"; + break; + + default: + ping_element.style.color = "#111827"; + } + } + + function classifyJitter(value) { + if (value == "") return 0; + if (value > 20) return 1; + if (value >= 5) return 2; + return 3; + } + + function updateJitterColor(value) { + const jitter_element = document.getElementById("jitText"); + const jitter_classification = classifyJitter(value); + + // jitter_classification === 2?jitter_element.style.color = "#16A34A":(jitter_classification === 1?jitter_element.style.color = "#CA8A04":jitter_element.style.color = "#DC2626"); + + switch (jitter_classification) { + case 3: + jitter_element.style.color = "#16A34A"; + break; + case 2: + jitter_element.style.color = "#CA8A04"; + break; + case 1: + jitter_element.style.color = "#DC2626"; + break; + case 0: + jitter_element.style.color = "#111827"; + break; + + default: + jitter_element.style.color = "#111827"; + } + } + + //UI CODE + var uiData = null; + + function startStop() { + flag = false; + flag2 = false; + + I("instructions").innerHTML = ""; + + if (prevTestState == 4) { + clearmessage(); + } + + if (s.getState() == 3) { + //speedtest is running, abort + s.abort(); + data = null; + // prevTestState = null; + I("startStopBtn").className = ""; + I("message").innerHTML = ""; + I("message").classList.remove("Loader"); + initUI(); + } else { + //test is not running, begin + I("message").innerHTML = "Test in progress..."; + I("message").classList.add("Loader"); + 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 + // I("startStopBtn").textContent = "Try Again"; + I("startStopBtn").className = "new-class"; + try { + var testId = uiData.testId; + if (testId != null) { + var shareURL = + window.location.href.substring( + 0, + window.location.href.lastIndexOf("/") + ) + + "/results/?id=" + + testId; + console.log("ShareURL: ", shareURL); + // 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; + //console.log(uiData); + I("dlText").textContent = + status == 1 && uiData.dlStatus == 0 ? "..." : format(uiData.dlStatus); + // drawMeter(I("dlMeter"), mbpsToAmount(Number(uiData.dlStatus * (status == 1 ? oscillate() : 1))), meterBk, dlColor, Number(uiData.dlProgress), progColor); + I("ulText").textContent = + status == 3 && uiData.ulStatus == 0 ? "..." : format(uiData.ulStatus); + // drawMeter(I("ulMeter"), mbpsToAmount(Number(uiData.ulStatus * (status == 3 ? oscillate() : 1))), meterBk, ulColor, Number(uiData.ulProgress), progColor); + I("pingText").textContent = format(uiData.pingStatus); + I("jitText").textContent = format(uiData.jitterStatus); + + if (status == 1) { + updateDlColor(uiData.dlStatus); + } else if (status == 3) { + updateUlColor(uiData.ulStatus); + } else { + updateDlColor(uiData.dlStatus); + updateUlColor(uiData.ulStatus); + } + + updatePingColor(uiData.pingStatus); + updateJitterColor(uiData.jitterStatus); + + if (status == 4) { + if (prevTestState !== 4) ToShowStatus(); + } + + prevTestState = uiData.testState; + } + 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() { + I("dlText").textContent = ""; + I("ulText").textContent = ""; + I("pingText").textContent = ""; + I("jitText").textContent = ""; + } + + function ToShowStatus() { + // console.log("Function Called"); + + I("message").classList.remove("Loader"); + + message = ""; + + if (uiData?.dlStatus < 1 && uiData?.ulStatus < 1) { + message = + "Upload and download speeds are below the recommended threshold"; + flag2 = true; + } else if (uiData?.dlStatus < 1) { + message = "Your Download Speed is less than recommended threshold"; + flag2 = true; + } else if (uiData?.ulStatus < 1) { + message = " Your Upload Speed is less than recommended threshold"; + flag2 = true; + } + + if (uiData?.pingStatus > 50 && uiData?.jitterStatus > 30) { + if (!flag2) + mesage = + "It is recommended to meet threshold speed for a seamless experience. While you can still start with the session, you might encounter errors due to low bandwidth. For help, visit : Talview.support.com"; + else { + message += ", and we detected high jitter and ping. "; + } + } else if (uiData?.jitterStatus > 30) { + if (!flag2) + mesage = + "It is recommended to meet threshold speed for a seamless experience. While you can still start with the session, you might encounter errors due to low bandwidth. For help, visit : Talview.support.com"; + else { + message += ", and we detected high jitter. "; + } + } else if (uiData?.pingStatus > 50) { + if (!flag2) + mesage = + "It is recommended to meet threshold speed for a seamless experience. While you can still start with the session, you might encounter errors due to low bandwidth. For help, visit : Talview.support.com"; + else { + message += ", and we detected high Ping "; + } + } + + if ( + !message && + ((uiData?.ulStatus >= 1 && uiData?.ulStatus < 5) || + (uiData?.dlStatus >= 1 && uiData?.dlStatus < 5)) + ) { + message = + "It is recommended to meet threshold speed for a seamless experience. While you can still start with the session, you might encounter errors due to low bandwidth. For help, visit: Talview.support.com"; + } + + if ( + uiData?.dlStatus >= 5 && + uiData?.ulStatus >= 5 && + uiData?.pingStatus <= 50 && + uiData?.jitterStatus <= 30 + ) { + message = + "Your network speed meets the requirements for the session. You’re all set"; + flag = true; + } + + if (!flag) { + if (flag2) { + message += + " Please check your connection settings and try again. For help, visit : Talview.support.com "; + } + document.querySelector("#instructions").innerHTML = instructionsare; + } + + I("message").innerHTML = message; + + if (flag) I("message").classList.add("success"); + + if (!flag) I("message").classList.add("alert-danger"); + } + + function clearmessage() { + // console.log("help called"); + + I("message").innerHTML = ""; + I("message").classList.remove("alert-danger"); + } + + + + + Talview Speedtest + + + +
+
+ +
+
+ +
+
+
Internet Speed Test
+ +
+

+ Before you begin your assessment or interview, please ensure your + internet connection meets the minimum requirement for a smooth + experience: +

+
    +
  1. Click "Start" to check your current network performance.
  2. +
  3. + Once the test is complete, review the results displayed on the + screen. +
  4. +
  5. + Ensure all network metrics meet the requirements listed above. +
  6. +
+
+ + +
+
+
+
+
Ping
+
+
+
ms
+
+
+ +
+ +
+
+
Jitter
+
+
+
ms
+
+
+ +
+
+
+
+
+
Download
+
+
+
Mbps
+
+
+ +
+ +
+
+
Upload
+
+
+
Mbps
+
+
+ +
+
+
+ +
+
+ + + +
+
+
+ + +
+
+ + + diff --git a/index.html b/index.html index 7cca020c0..2a8d99f47 100755 --- a/index.html +++ b/index.html @@ -10,6 +10,23 @@ + } + - Talview Speedtest - + Talview Speedtest + - -
-
- -
+ +
+
+
+
+ +
+
+
Internet Speed Test
+ +
+

+ Before you begin your assessment or interview, please ensure your + internet connection meets the minimum requirement for a smooth + experience: +

+
    +
  1. Click "Start" to check your current network performance.
  2. +
  3. + Once the test is complete, review the results displayed on the + screen. +
  4. +
  5. + Ensure all network metrics meet the requirements listed above. +
  6. +
+
-
-
-
Internet Speed Test
- -
-

- Before you begin your assessment or interview, please ensure your - internet connection meets the minimum requirement for a smooth - experience: -

-
    -
  1. Click "Start" to check your current network performance.
  2. -
  3. - Once the test is complete, review the results displayed on the - screen. -
  4. -
  5. - Ensure all network metrics meet the requirements listed above. -
  6. -
-
- - -
-
-
-
-
Ping
-
-
-
ms
-
+ +
+
+
+
+
Ping
+
+
+
ms
-
+ +
-
-
-
Jitter
-
-
-
ms
-
+
+
+
Jitter
+
+
+
ms
-
+
-
-
-
-
Download
-
-
-
Mbps
-
+
+
+
+
+
Download
+
+
+
Mbps
-
+ +
-
-
-
Upload
-
-
-
Mbps
-
+
+
+
Upload
+
+
+
Mbps
-
+
+
-
-
- - +
+
+ + -
-
-
+
+
+
- - - - - +
+ + + + \ No newline at end of file diff --git a/index.html b/index.html index d48faaeb3..9d2c9cf46 100755 --- a/index.html +++ b/index.html @@ -14,18 +14,17 @@ let prevTestState = null; let flag2 = false; let flag = false; - let instructionsare = ` + let slow_speed_instructions = `
    - Improving Your Internet Connection Speed - -
  • Restart your router
  • -
  • Connect to a different network
  • -
  • Check for any active VPNs or firewalls
  • -
  • Use a wired connection instead of Wi-Fi for better stability.
  • -
  • Put your router in a central location. Make sure that walls or other solid objects aren't blocking your Wi-Fi signal.
  • -
  • Close apps that you don’t need, as they can slow down your connection.
  • -
  • Make sure no one else is using the internet while you’re testing. Things like watching/ video streaming will slow down the connection.
  • -
`; + Improving Your Internet Connection Speed +
  • Restart your router
  • +
  • Connect to a different network
  • +
  • Check for any active VPNs or firewalls
  • +
  • Use a wired connection instead of Wi-Fi for better stability.
  • +
  • Put your router in a central location. Make sure that walls or other solid objects aren't blocking your Wi-Fi signal.
  • +
  • Close apps that you don't need, as they can slow down your connection.
  • +
  • Make sure no one else is using the internet while you're testing. Things like watching/ video streaming will slow down the connection.
  • + `; function I(i) { return document.getElementById(i); @@ -186,7 +185,7 @@ flag = false; flag2 = false; - I("instructions").innerHTML = ""; + I("slow-speed-error-instruction").innerHTML = ""; if (prevTestState == 4) { clearmessage(); @@ -198,13 +197,13 @@ data = null; // prevTestState = null; I("startStopBtn").className = ""; - I("message").innerHTML = ""; - I("message").classList.remove("Loader"); + I("statusMessage").innerHTML = ""; + I("statusMessage").classList.remove("Loader"); initUI(); } else { //test is not running, begin - I("message").innerHTML = "Test in progress..."; - I("message").classList.add("Loader"); + I("statusMessage").innerHTML = "Test in progress..."; + I("statusMessage").classList.add("Loader"); I("startStopBtn").className = "running"; I("shareArea").style.display = "none"; s.onupdate = function (data) { @@ -245,7 +244,6 @@ if (uiData == null) return; var status = uiData.testState; // I("ip").textContent = uiData.clientIp; - //console.log(uiData); I("dlText").textContent = status == 1 && uiData.dlStatus == 0 ? "..." : format(uiData.dlStatus); // drawMeter(I("dlMeter"), mbpsToAmount(Number(uiData.dlStatus * (status == 1 ? oscillate() : 1))), meterBk, dlColor, Number(uiData.dlProgress), progColor); @@ -299,9 +297,7 @@ } function ToShowStatus() { - // console.log("Function Called"); - - I("message").classList.remove("Loader"); + I("statusMessage").classList.remove("Loader"); message = ""; @@ -365,21 +361,19 @@ message += " Please check your connection settings and try again. For help, visit : Talview Support "; } - document.querySelector("#instructions").innerHTML = instructionsare; + document.querySelector("#slow-speed-error-instruction").innerHTML = slow_speed_instructions; } - I("message").innerHTML = message; + I("statusMessage").innerHTML = message; - if (flag) I("message").classList.add("success"); + if (flag) I("statusMessage").classList.add("success"); - if (!flag) I("message").classList.add("alert-danger"); + if (!flag) I("statusMessage").classList.add("alert-danger"); } function clearmessage() { - // console.log("help called"); - - I("message").innerHTML = ""; - I("message").classList.remove("alert-danger"); + I("statusMessage").innerHTML = ""; + I("statusMessage").classList.remove("alert-danger"); } @@ -790,8 +784,8 @@
    -
    -
    +
    +