DroneDeploy
Search…
Plans.getCurrentlyViewed
1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
<meta charset="UTF-8">
6
<title>Document</title>
7
<style>
8
.author {
9
font-size: 0.9em;
10
}
11
12
.title {
13
font-size: 1.1em;
14
font-weight: 500;
15
border-bottom: 1px dotted black;
16
}
17
18
.sans {
19
font-family: Lato, sans-serif;
20
color: rgba(0, 0, 0, 0.87);
21
}
22
23
.key {
24
font-weight: 700;
25
}
26
27
ul {
28
padding: 5px;
29
}
30
31
li {
32
list-style: none;
33
}
34
</style>
35
</head>
36
37
<body>
38
<h1 class="title sans">Plans.getCurrentlyViewed example</h1>
39
<ul id="plan"></ul>
40
<script>
41
var planOutput = document.getElementById('plan')
42
43
function formatObject(obj) {
44
var keys = Object.keys(obj);
45
var result = keys.map(function(key) {
46
return typeof obj[key] === 'object' ? `<li><span class="key sans">${key}</span>: </li><ul>${formatObject(obj[key])}</ul></li>` : `<li><span class="key sans">${key}</span>: ${obj[key]}</li>`
47
}).join('')
48
return result
49
}
50
51
new DroneDeploy({
52
version: 1
53
})
54
.then(function(dronedeployApi) {
55
return dronedeployApi.Plans.getCurrentlyViewed()
56
})
57
.then(function(plan) {
58
planOutput.innerHTML = formatObject(plan)
59
});
60
</script>
61
</body>
62
63
</html>
Copied!
Last modified 2yr ago
Copy link