~tsileo/blobstash-pwa

ref: 970bad609050d5f3efdf8f209a1034bbe6e2ac26 blobstash-pwa/templates/index.html -rw-r--r-- 1.8 KiB
970bad60Thomas Sileo Tweak and check in support 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>BlobStash</title>
    <link rel="manifest" href="/api/apps/{{.app_id}}/manifest.json" crossorigin="use-credentials">
<script>
  if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('/api/apps/{{.app_id}}/service-worker.js')
  }
</script>
  </head>
  <body>
    <h1>BlobStash</h1>
    <h2>Check in</h2>
    <form action="/api/apps/{{.app_id}}/checkin" method="POST">
     <a href="#" class="location_autofill">set location</a>
     <div>
     <input type="text" name="location_lat" id="location_lat" placeholder="latitude">
     <input type="text" name="location_lng" id="location_lng" placeholder="longitude">
     </div>
     <input type="hidden" name="location_ts" id="location_ts">
     <div>
     <input type="text" name="location_name" placeholder="location name (optional)">
     </div>
     <div>
     <input type="submit" value="check in">
     </div>
    </form>
    <h2>Share plugin</h2>
    <p>BlobStash should appear as a target when sharing images/pictures.</p>
    <script>
var askForLocation = function(ev) {
    ev.preventDefault();
    navigator.geolocation.getCurrentPosition(function(position) {
        console.log(position);
        document.getElementById("location_lat").value = position.coords.latitude;
        document.getElementById("location_lng").value = position.coords.longitude;
        document.getElementById("location_ts").value = Date.now();
    });
}
var items = document.getElementsByClassName("location_autofill")
for (var i = 0; i < items.length; i++) {
    items[i].addEventListener('click', askForLocation);
}
    </script>
  </body>
</html>