Skip to content

Commit

Permalink
Mobile-friendly styling
Browse files Browse the repository at this point in the history
  • Loading branch information
steinbro committed Dec 17, 2023
1 parent 445fff3 commit 2cc2e3b
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,32 @@ function vocalize(latitude, longitude) {
turf.point([longitude, latitude]),
);

audioQueue.addToQueue('assets/sounds/sense_poi.wav');
audioQueue.addToQueue('app/sounds/sense_poi.wav');
audioQueue.addToQueue({ text: feature.properties.name + ' is ' + distance.value + ' ' + distance.units + ' away' });
}
})
}

audioQueue.addToQueue('assets/sounds/mode_exit.wav');
audioQueue.addToQueue('app/sounds/mode_exit.wav');
})
}

document.addEventListener('DOMContentLoaded', function () {
var btnNearMe = document.getElementById('btn_near_me');
btnNearMe.addEventListener('click', function() {
if (audioQueue.queue.length > 0) {
// was already playing; stop audio
//if (audioQueue.queue.length > 0) {
if (btnNearMe.textContent == '(stop)') {
audioQueue.stopAndClear();
audioQueue.addToQueue('assets/sounds/mode_exit.wav');
audioQueue.addToQueue('app/sounds/mode_exit.wav');
btnNearMe.textContent = 'Places Near Me';
return;
}

// indicate that clicking button again will stop audio
btnNearMe.textContent = '(stop)';

// play mode enter sound
audioQueue.addToQueue('assets/sounds/mode_enter.wav');
audioQueue.addToQueue('app/sounds/mode_enter.wav');

// use location from URL if specified, otherwise use location services
var searchParams = new URLSearchParams(window.location.search);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions app/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* touch-friendly button */
button {
padding: 10px 20px;
font-size: 16px;
}
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<!-- Render to a usable size on mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="app/styles/main.css" />

<script src='https://unpkg.com/@turf/turf@6/turf.min.js'></script>
<script src="app/main.js" type="module"></script>
</head>
Expand Down

0 comments on commit 2cc2e3b

Please sign in to comment.