speedtest.slackware.uk/html/index.php

145 lines
6.1 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<?php if ($_COOKIE['theme'] == "light") { ?>
<link rel="stylesheet" href="/light.css" type="text/css">
<?php } else { ?>
<link rel="stylesheet" href="/dark.css" type="text/css">
<?php } ?>
<link rel="shortcut icon" href="/favicon.ico">
<meta name="author" content="Darren 'Tadgy' Austin">
<meta name="description" content="Slackware UK download speedtest">
<meta name="keywords" content="Slackware UK, speedtest, speed">
<title>Slackware UK: Speedtest</title>
<script type="text/javascript" src="/speedtest.js"></script>
<script type="text/javascript">
var s=new Speedtest();
s.setParameter("test_order","IP_D"); // Only get IP, and do ping and download tests
s.setParameter("time_auto",true); // Use a fixed duration for tests
s.setParameter("time_dl_max",10); // 10 seconds for the download test
function I(id) {
return document.getElementById(id);
}
function startStop() {
if(s.getState() == 3) {
s.abort();
} else {
s.start();
I("startstopbutton").className="running";
}
}
function initUI() {
I("downloadtext").textContent="";
I("pingtext").textContent="";
I("jittertext").textContent="";
I("ip").textContent="";
}
s.onupdate=function(data) {
I("ip").textContent=data.clientIp;
I("downloadtext").textContent=(data.testState == 1 && data.dlStatus == 0) ? "..." : data.dlStatus;
I("pingtext").textContent=data.pingStatus;
I("jittertext").textContent=data.jitterStatus;
var prog=(Number(data.dlProgress)*2+Number(data.pingProgress))/3;
I("progress").style.width=(100*prog)+"%";
}
s.onend=function(aborted) {
I("startstopbutton").className="";
if(aborted) {
initUI();
}
}
</script>
</head>
<body>
<div id="page">
<div id="logo">
<?php if ($_COOKIE['theme'] == "light") { ?>
<a href="//slackware.uk/" title="Slackware UK"><img src="/slackwareuk-black.png" title="Slackware UK" alt="Slackware UK Logo"></a>
<?php } else { ?>
<a href="//slackware.uk/" title="Slackware UK"><img src="/slackwareuk-white.png" title="Slackware UK" alt="Slackware UK Logo"></a>
<?php } ?>
</div>
<hr>
<div class="notice">
<span class="heading bold">Patronage & Donations</span><br>
If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons:
<div id="donatebuttons">
<?php if ($_COOKIE['theme'] == "light") { ?>
<a class="donatebutton" href="https://www.patreon.com/slackwareUK" title="Patreon"><img src="/patreon-black.png" title="Patreon" alt="Patreon Logo"></a>
<a class="donatebutton" href="https://paypal.me/DonateToSlackwareUK" title="PayPal"><img src="/paypal-black.png" title="PayPal" alt="PayPal Logo"></a>
<?php } else { ?>
<a class="donatebutton" href="https://www.patreon.com/slackwareUK" title="Patreon"><img src="/patreon-white.png" title="Patreon" alt="Patreon Logo"></a>
<a class="donatebutton" href="https://paypal.me/DonateToSlackwareUK" title="PayPal"><img src="/paypal-white.png" title="PayPal" alt="PayPal Logo"></a>
<?php } ?>
</div>
All <a href="//slackware.uk/html/donors.php" title="Donors">donations</a> will be gratefully received - thank you!
</div>
<div id="theme">
<div></div>
<div></div>
<div class="box boxmargins" id="themetoggle">
<span id="themetoggletext">Toggle&nbsp;theme:</span><a href="/toggletheme.php" title="Toggle Theme"><img id="themetoggleimg" src="/toggletheme.png" title="Toggle Theme" alt="Toggle Theme Button"></a>
</div>
</div>
<div class="box boxmargins" id="headingbox">
<div id="headingtext">
<span class="heading bold">Slackware UK Speedtest</span><br>
<span class="subheading">
On this page you can test the speed at which you<br>
can download data from the Slackware UK server.
</span>
</div>
</div>
<div class="box boxmargins boxpadding" id="testbox">
<div id="tests">
<div>
<div class="subheading bold">Ping</div>
<div id="pingtext" class="metertext"></div>
<div>ms</div>
</div>
<div>
<div class="subheading bold">Jitter</div>
<div id="jittertext" class="metertext"></div>
<div>ms</div>
</div>
<div>
<div class="subheading bold">Download</div>
<div id="downloadtext" class="metertext"></div>
<div>Mbit/sec</div>
</div>
</div>
<div id="startstopbutton" onclick="startStop()"></div>
<div id="ipinfo">
Your IP information: <span id="ip"></span>
</div>
</div>
<br>
<div class="bold" id="progresstext">Test progress</div>
<div id="progressbar">
<div id="progress"></div>
</div>
<div class="bold" id="footer">
<div id="copyright">
Slackware UK logo, design and code &copy; <?php print (date ("Y")); ?> Darren 'Tadgy' Austin.<br>
Speedtest code by <a href="https://github.com/librespeed/speedtest.git" title="LibreSpeed">LibreSpeed</a>.
</div>
<div id="poweredby">
<?php if ($_COOKIE['theme'] == "light") { ?>
Powered by <a href="http://slackware.com/" title="Slackware Linux"><img src="/slackwarelinux-black.png" title="Slackware Linux" alt="Slackware Linux"></a>, naturally.
<?php } else { ?>
Powered by <a href="http://slackware.com/" title="Slackware Linux"><img src="/slackwarelinux-white.png" title="Slackware Linux" alt="Slackware Linux"></a>, naturally.
<?php } ?>
<div>
</div>
<script type="text/javascript">
initUI();
</script>
</div>
</body>
</html>