<head>
<title>PiThrottler Configuration</title>
- <script>
- const presets = {
- Unlimited: {
- label: "Unlimited",
- latency: 0,
- ploss: 0,
- throughput: 0
- },
- F4G: {
- label: "4G Fast",
- latency: 30,
- ploss: 0,
- throughput: 20000
- },
- S4G: {
- label: "4G Slow",
- latency: 150,
- ploss: 1,
- throughput: 10000
- },
- F3G: {
- label: "3G Fast",
- latency: 110,
- ploss: 0,
- throughput: 5000
- },
- S3G: {
- label: "3G Slow",
- latency: 200,
- ploss: 3,
- throughput: 1000
- }
- };
- function saveSettings() {
- fetch("/set?latency=" + document.getElementById("latencyRange").value + "&ploss=" + document.getElementById("plossRange").value + "&throughput=" + document.getElementById("tpRange").value);
- }
-
- async function checkForUpdates() {
- const updateAvailable = await fetch("/checkupdate");\r
- if (await updateAvailable.text() == "0") {\r
- document.getElementById("updateStatus").innerHTML = "Up to date.";\r
- } else {\r
- document.getElementById("updateStatus").innerHTML = "An update is available.";\r
- document.getElementById("updateButton").style.display = "";\r
- }\r
- }
-
- async function runUpdate() {
- document.getElementById("updateStatus").innerHTML = "Updating...";
- document.getElementById("updateButton").style.display = "none";
- const updateAvailable = await fetch("/runupdate");\r
- location.reload();\r
- }
-
- function loadPresets() {
- let innerhtml = "";
- for (type in presets) {
- innerhtml += "<option value='" + type + "'>" + presets[type].label + "</option>";
- }
- document.getElementById("preset").innerHTML = innerhtml;
- }
-
- function changePreset() {
- var preset = document.getElementById("preset").value;
- document.getElementById("latencyRange").value = presets[preset].latency;
- document.getElementById("latency").innerHTML = presets[preset].latency;
- document.getElementById("plossRange").value = presets[preset].ploss;
- document.getElementById("ploss").innerHTML = presets[preset].ploss;
- document.getElementById("tpRange").value = presets[preset].throughput;
- document.getElementById("tp").innerHTML = presets[preset].throughput;
- }
- </script>
+ <link rel="stylesheet" href="pithrottler.css">
+ <script src="pithrottler.js"></script>
</head>
<body onload="loadPresets();">
+ <h3>PiThrottler Control</h3>
<select id="preset" onchange="changePreset();">
</select>
<div class="slidecontainer">
+html {
+ background-color:#101010;
+}
+
+body {
+ text-align:center;
+ color:#fff;
+ font-family:Arial;
+}
+
+select, button {
+ width: 160px;
+ height: 30px;
+ border: 1px solid #444;
+ font-size: 18px;
+ background-color: #202020;
+ border-radius: 5px;
+ color: #1c87c9;
+}
+
+select:hover, button:hover {
+ background-color:#303030;
+}
+
+select {
+ box-shadow: 4px 4px #666;
+ margin-bottom:10px;
+}
--- /dev/null
+const presets = {
+ Unlimited: {
+ label: "Unlimited",
+ latency: 0,
+ ploss: 0,
+ throughput: 0
+ },
+ F4G: {
+ label: "4G Fast",
+ latency: 30,
+ ploss: 0,
+ throughput: 20000
+ },
+ S4G: {
+ label: "4G Slow",
+ latency: 150,
+ ploss: 1,
+ throughput: 10000
+ },
+ F3G: {
+ label: "3G Fast",
+ latency: 110,
+ ploss: 0,
+ throughput: 5000
+ },
+ S3G: {
+ label: "3G Slow",
+ latency: 200,
+ ploss: 3,
+ throughput: 1000
+ }
+};
+function saveSettings() {
+ fetch("/set?latency=" + document.getElementById("latencyRange").value + "&ploss=" + document.getElementById("plossRange").value + "&throughput=" + document.getElementById("tpRange").value);
+}
+
+async function checkForUpdates() {
+ const updateAvailable = await fetch("/checkupdate");
+ if (await updateAvailable.text() == "0") {
+ document.getElementById("updateStatus").innerHTML = "Up to date.";
+ } else {
+ document.getElementById("updateStatus").innerHTML = "An update is available.";
+ document.getElementById("updateButton").style.display = "";
+ }
+}
+
+async function runUpdate() {
+ document.getElementById("updateStatus").innerHTML = "Updating...";
+ document.getElementById("updateButton").style.display = "none";
+ const updateAvailable = await fetch("/runupdate");
+ location.reload();
+}
+
+function loadPresets() {
+ let innerhtml = "";
+ for (type in presets) {
+ innerhtml += "<option value='" + type + "'>" + presets[type].label + "</option>";
+ }
+ document.getElementById("preset").innerHTML = innerhtml;
+}
+
+function changePreset() {
+ var preset = document.getElementById("preset").value;
+ document.getElementById("latencyRange").value = presets[preset].latency;
+ document.getElementById("latency").innerHTML = presets[preset].latency;
+ document.getElementById("plossRange").value = presets[preset].ploss;
+ document.getElementById("ploss").innerHTML = presets[preset].ploss;
+ document.getElementById("tpRange").value = presets[preset].throughput;
+ document.getElementById("tp").innerHTML = presets[preset].throughput;
+}
\ No newline at end of file