Created
August 9, 2017 01:49
-
-
Save danrasmuson/aa5db910fce2a8b5dcded5ac3481b1e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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