Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a config file instead of having to modify the main file #630

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions example_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"telemetry_level": "basic",
"url_dl": "URL-OF-YOUR-BACKEND/garbage.jsp",
"url_ul": "URL-OF-YOUR-BACKEND/empty.jsp",
"url_ping": "URL-OF-YOUR-BACKEND/empty.jsp",
"url_getIp": "URL-OF-YOUR-BACKEND/getIP.jsp"
}
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
<script type="text/javascript" src="speedtest.js"></script>
<script type="text/javascript">
function I(i){return document.getElementById(i);}
//INITIALIZE SPEEDTEST
//INITIALIZE SPEEDTEST FROM FILE "config.json"
var s=new Speedtest(); //create speedtest object
s.setParameter("telemetry_level","basic"); //enable telemetry
fetch( "config.json" )
.then( response => response.json() )
.then( (responseJson) => {
for( let key in responseJson ){
s.setParameter( key, responseJson[key] );
}
});

var meterBk=/Trident.*rv:(\d+\.\d+)/i.test(navigator.userAgent)?"#EAEAEA":"#80808040";
var dlColor="#6060AA",
Expand Down