Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danrasmuson/aa5db910fce2a8b5dcded5ac3481b1e4 to your computer and use it in GitHub Desktop.
Save danrasmuson/aa5db910fce2a8b5dcded5ac3481b1e4 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div>Current Annotation</div>
<div id="current-annotation"></div>
<script>
var qs = document.querySelector.bind(document);
var currentAnnotation = qs('#current-annotation');
new DroneDeploy({version: 1}).then(function(dronedeploy){
var planId$ = dronedeploy.Plans.getCurrentlyViewed().then(function(plan){ return plan.id });
function getAnnotation(annotationId){
return planId$.then(function(planId){
return dronedeploy.Annotations.get(planId).then(function(annotations){
var desiredAnnotation = annotations.find(function(annotation){
return annotation.id === annotationId;
})
return desiredAnnotation;
});
});
}
dronedeploy.Annotations.getCurrentlyViewed().subscribe(function(currentId){
if (currentId === undefined){
currentAnnotation.innerHTML = 'None';
} else{
getAnnotation(currentId).then(function(annotation){
currentAnnotation.innerHTML = JSON.stringify(annotation);
});
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment