Skip to content

Commit

Permalink
More SpeedTest Work
Browse files Browse the repository at this point in the history
Added config for speed test
  • Loading branch information
causefx committed Jun 3, 2017
1 parent 6b9ea13 commit 8719a7d
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 8 deletions.
1 change: 1 addition & 0 deletions config/configDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@
"homepageCustomHTML1Auth" => false,
"git_branch" => "master",
"git_check" => true,
"speedTest" => false,
);
138 changes: 137 additions & 1 deletion homepage.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css">

<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="<?=$baseURL;?>bower_components/mdi/css/materialdesignicons.min.css?v=<?php echo INSTALLEDVERSION; ?>">
<link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css?v=<?php echo INSTALLEDVERSION; ?>">

<!--Scripts-->
<script src="bower_components/jquery/dist/jquery.min.js"></script>
Expand Down Expand Up @@ -234,6 +234,142 @@
<?php echo HOMEPAGECUSTOMHTML1; ?>
</div>
<?php } ?>
<?php if(SPEEDTEST == "true"){ ?>
<style type="text/css">

.flash {
animation: flash 0.6s linear infinite;
}

@keyframes flash {
0% { opacity: 0.6; }
50% { opacity: 1; }
}

</style>
<script type="text/javascript">
var w = null
function runTest() {
document.getElementById('startBtn').style.display = 'none'
document.getElementById('testArea').style.display = ''
document.getElementById('abortBtn').style.display = ''
w = new Worker('bower_components/speed/speedtest_worker.min.js')
var interval = setInterval(function () { w.postMessage('status') }, 100)
w.onmessage = function (event) {
var data = event.data.split(';')
var status = Number(data[0])
var dl = document.getElementById('download')
var ul = document.getElementById('upload')
var ping = document.getElementById('ping')
var jitter = document.getElementById('jitter')
dl.className = status === 1 ? 'flash' : ''
ping.className = status === 2 ? 'flash' : ''
jitter.className = ul.className = status === 3 ? 'flash' : ''
if (status >= 4) {
clearInterval(interval)
document.getElementById('abortBtn').style.display = 'none'
document.getElementById('startBtn').style.display = ''
w = null
}
if (status === 5) {
document.getElementById('testArea').style.display = 'none'
}
dl.textContent = data[1] + " Mbit/s";
$("#downloadpercent").attr("style", "width: " + data[1] + "%;");
$("#uploadpercent").attr("style", "width: " + data[2] + "%;");
$("#pingpercent").attr("style", "width: " + data[3] + "%;");
$("#jitterpercent").attr("style", "width: " + data[5] + "%;");
ul.textContent = data[2] + " Mbit/s";
ping.textContent = data[3] + " ms";
jitter.textContent = data[5] + " ms";
}
w.postMessage('start')
}
function abortTest() {
if (w) w.postMessage('abort')
}
</script>

<div class="row" id="testArea" style="display:none">

<div class="test col-sm-3 col-lg-3">
<div class="content-box ultra-widget green-bg" data-counter="">
<div id="downloadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
<div class="w-content">
<div class="w-icon right pull-right"><i class="mdi mdi-cloud-download"></i></div>
<div class="w-descr left pull-left text-center">
<span class="testName text-uppercase w-name">Download</span>
<br>
<span class="w-amount counter" id="download" ></span>
</div>
</div>
</div>
</div>

<div class="test col-sm-3 col-lg-3">
<div class="content-box ultra-widget red-bg" data-counter="">
<div id="uploadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
<div class="w-content">
<div class="w-icon right pull-right"><i class="mdi mdi-cloud-upload"></i></div>
<div class="w-descr left pull-left text-center">
<span class="testName text-uppercase w-name">Upload</span>
<br>
<span class="w-amount counter" id="upload" ></span>
</div>
</div>
</div>
</div>

<div class="test col-sm-3 col-lg-3">
<div class="content-box ultra-widget yellow-bg" data-counter="">
<div id="pingpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
<div class="w-content">
<div class="w-icon right pull-right"><i class="mdi mdi-timer"></i></div>
<div class="w-descr left pull-left text-center">
<span class="testName text-uppercase w-name">Latency</span>
<br>
<span class="w-amount counter" id="ping" ></span>
</div>
</div>
</div>
</div>

<div class="test col-sm-3 col-lg-3">
<div class="content-box ultra-widget blue-bg" data-counter="">
<div id="jitterpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
<div class="w-content">
<div class="w-icon right pull-right"><i class="mdi mdi-pulse"></i></div>
<div class="w-descr left pull-left text-center">
<span class="testName text-uppercase w-name">Jitter</span>
<br>
<span class="w-amount counter" id="jitter" ></span>
</div>
</div>
</div>
</div>

<br/>

</div>

<div id="abortBtn" class="row" style="display: none" onclick="javascript:abortTest()">
<div class="col-lg-12">
<div class="content-box red-bg" style="cursor: pointer;">
<h1 style="margin: 10px" class="text-uppercase text-center">Abort Speed Test</h1>
<div class="clearfix"></div>
</div>
</div>
</div>

<div id="startBtn" class="row" onclick="javascript:runTest()">
<div class="col-lg-12">
<div class="content-box green-bg" style="cursor: pointer;">
<h1 style="margin: 10px" class="text-uppercase text-center">Run Speed Test</h1>
<div class="clearfix"></div>
</div>
</div>
</div>
<?php } ?>
<?php if((NZBGETURL != "" && qualifyUser(NZBGETHOMEAUTH)) || (SABNZBDURL != "" && qualifyUser(SABNZBDHOMEAUTH))) { ?>
<div id="downloadClientRow" class="row">
<sort>2</sort>
Expand Down
3 changes: 2 additions & 1 deletion lang/de.ini
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@ REMOVE = "Remove"
GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
GIT_CHECK = "Check for new 'master' releases"
GIT_FORCE = "Force Install Branch"
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
SPEED_TEST = "Speed Test"
3 changes: 2 additions & 1 deletion lang/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@ REMOVE = "Remove"
GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
GIT_CHECK = "Check for new 'master' releases"
GIT_FORCE = "Force Install Branch"
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
SPEED_TEST = "Speed Test"
3 changes: 2 additions & 1 deletion lang/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@ REMOVE = "Remove"
GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
GIT_CHECK = "Check for new 'master' releases"
GIT_FORCE = "Force Install Branch"
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
SPEED_TEST = "Speed Test"
3 changes: 2 additions & 1 deletion lang/fr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@ REMOVE = "Remove"
GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
GIT_CHECK = "Check for new 'master' releases"
GIT_FORCE = "Force Install Branch"
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
SPEED_TEST = "Speed Test"
3 changes: 2 additions & 1 deletion lang/it.ini
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@ REMOVE = "Remove"
GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
GIT_CHECK = "Check for new 'master' releases"
GIT_FORCE = "Force Install Branch"
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
SPEED_TEST = "Speed Test"
3 changes: 2 additions & 1 deletion lang/nl.ini
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@ REMOVE = "Remove"
GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
GIT_CHECK = "Check for new 'master' releases"
GIT_FORCE = "Force Install Branch"
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
SPEED_TEST = "Speed Test"
3 changes: 2 additions & 1 deletion lang/pl.ini
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@ REMOVE = "Remove"
GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
GIT_CHECK = "Check for new 'master' releases"
GIT_FORCE = "Force Install Branch"
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."
SPEED_TEST = "Speed Test"
6 changes: 6 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,12 @@ function submitTabs(form) {
'value' => HOMEPAGEAUTHNEEDED,
'options' => $userTypes,
),
array(
'type' => 'checkbox',
'labelTranslate' => 'SPEED_TEST',
'name' => 'speedTest',
'value' => SPEEDTEST,
),
/*
array(
'type' => 'custom',
Expand Down

0 comments on commit 8719a7d

Please sign in to comment.