small-package/luci-app-netspeedtest/luasrc/view/netspeedtest/speedtest.htm

32 lines
1.0 KiB
HTML

<%+cbi/valueheader%>
<label class="cbi-value-title"> </label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-apply" id="update_service" type="button" size="0" onclick="run()" value="<%= translate('Perform wanspeedtest') %>" />
</div>
<script type="text/javascript">
const RUN_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest","run")%>';
const S_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest")%>';
function run() {
var legend = document.getElementById('test-rc-legend');
var output = document.getElementById('test-rc-output');
output.innerHTML =
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Network speed test, please wait for 1 minutes%>'
;
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
XHR.get(RUN_URL, null, () => {
setTimeout(() => { window.location = S_URL }, 3000);
});
return false;
}
</script>
<%+cbi/valuefooter%>