summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus2020-10-19 21:46:07 +0200
committerHorus2020-10-19 21:46:07 +0200
commit2a9a10f8adb0457df73a78abae3bd8ece21eb5bd (patch)
treeba4503911d2cbcca8b0079c6c5f2b6bd7fcc0774
parent0111daba4d324d17c04ab9876fd8928fd7630b1f (diff)
downloadbpm -2a9a10f8adb0457df73a78abae3bd8ece21eb5bd.tar.gz
minor improvements.
-rw-r--r--index.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/index.php b/index.php
index 5d5188a..e1e3621 100644
--- a/index.php
+++ b/index.php
@@ -53,6 +53,8 @@
</div>
<script>
+ var lastClick = 0;
+ var bpm = [];
var dances = <?php readfile("dances.json"); ?>;
function median(values){
if ( values.length === 0 ) {
@@ -81,8 +83,6 @@
document.getElementById("showBpm").innerHTML = Math.round(median(bpm.slice()));
}
window.addEventListener("load",function() {
- var lastClick = 0;
- var bpm = [];
document.getElementById("countBpm").addEventListener("click", function(e){
var d = new Date();
var t = d.getTime();
@@ -96,7 +96,7 @@
} else {
var _bpm = 60 / seconds
bpm.push( _bpm );
- if ( bpm.length > 10 ) {
+ if ( bpm.length > 15 ) {
// keep only last 10 clicks
bpm.shift();
}