Cleaning up javascript a bit

This commit is contained in:
2022-10-27 01:09:54 -04:00
parent 6d63be70c4
commit f1ac868ee8

View File

@@ -20,9 +20,9 @@
</div>
</section>
<script>
var isTouchDevice = 'ontouchstart' in document.documentElement;
var starturl = '/start'
var stopurl = '/stop'
var isTouchDevice = "ontouchstart" in document.documentElement;
var starturl = "/start";
var stopurl = "/stop";
$( "#spoop" )
.mouseup(function() {
$.getJSON(stopurl, { }, function(data) { }); return false;
@@ -30,18 +30,16 @@
.mousedown(function() {
$.getJSON(starturl, { }, function(data) { }); return false;
})
$('#spoop').on('touchstart', function(){
$("#spoop").on("touchstart", function(){
if (isTouchDevice) {
$.getJSON(starturl, { }, function(data) { }); return false;
}
});
$('#spoop').on('touchend', function(){
$("#spoop").on("touchend", function(){
if (isTouchDevice) {
$.getJSON(stopurl, { }, function(data) { }); return false;
}
});
</script>
</body>
</html>