Skip to content

Instantly share code, notes, and snippets.

@JoelGeraci
Created September 14, 2021 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoelGeraci/3d0f96a221479f67c4b6dcdeef0068ea to your computer and use it in GitHub Desktop.
Save JoelGeraci/3d0f96a221479f67c4b6dcdeef0068ea to your computer and use it in GitHub Desktop.
function executeSearch() {
var previewFilePromise = window.adobeFilePreview;
previewFilePromise.then(adobeViewer => {
adobeViewer.getAPIs().then(apis => {
if ($("#search-term").val().length == 0) {
$("#search-term").val($("#search-term").attr("placeholder"));
}
apis.search($("#search-term").val()).then(searchObject => {
window.searchObject = searchObject;
searchObject.onResultsUpdate(onResultsUpdate)
.catch(error => onFail(error));
})
.catch(error => onFail(error));
});
});
}
function onResultsUpdate(result) {
updateSearchLocation(result)
}
function searchNext() {
window.searchObject.next();
}
function searchPrevious() {
window.searchObject.previous();
}
function searchClear() {
window.searchObject.clear();
$(".search-location").css("display", "none");
$("#search-term").val("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment