DroneDeploy
Search…
Projects.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">Projects.getCurrentlyViewed example</h1>
39
<ul id="project"></ul>
40
<script>
41
const projectOutput = document.getElementById('project')
42
43
function formatObject(obj) {
44
const keys = Object.keys(obj);
45
return 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
}
49
50
new DroneDeploy({
51
version: 1
52
})
53
.then(function(dronedeployApi) {
54
return dronedeployApi.Projects.getCurrentlyViewed()
55
})
56
.then(function(project) {
57
projectOutput.innerHTML = formatObject(project)
58
});
59
</script>
60
</body>
61
62
</html>
Copied!
Last modified 2yr ago
Copy link