Skip to content

Instantly share code, notes, and snippets.

@mig82
Created February 15, 2019 13:13
Show Gist options
  • Save mig82/4a1b86561ed933c6217676d01baf2235 to your computer and use it in GitHub Desktop.
Save mig82/4a1b86561ed933c6217676d01baf2235 to your computer and use it in GitHub Desktop.
Extracting links to headers from an Ombud web preview.
var baseURL = "https://app.ombud.com/v1/rx/AWQDn7ewgLe6Qjc33rXM/documents/AWjw3gjm4XgXoZ-r27ON/webview_preview";
var entries= document.getElementsByClassName("entry");
var count = entries.length;
console.log("Total %d", count);
var index = [];
for (var i = 0; i < count; i++) {
var entry = entries[i];
var question = entry.getElementsByClassName("question")[0].innerText;
index.push({
index: i+1,
question: question,
link: `${baseURL}#${entry.id}`
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment