Skip to content

Instantly share code, notes, and snippets.

@ravituvar
Created July 16, 2017 11:24
Show Gist options
  • Save ravituvar/0ecf6697926e4510d6d12a907a4750ca to your computer and use it in GitHub Desktop.
Save ravituvar/0ecf6697926e4510d6d12a907a4750ca to your computer and use it in GitHub Desktop.
Get topics in plural sight
var list = document.getElementsByTagName("section");
var counter=0;
for (var i=0; i<list.length; i++) {
if ( list[i].className.match(/\bmodule\b/) ) {
var header_text = list[i].getElementsByTagName("h2")[0].innerText;
var ul = list[i].getElementsByClassName('clips');
var li_list = ul[0].getElementsByTagName('h3');
if ( li_list.length > 1 ) {
console.log("------" + header_text + "------");
for (var y=0; y<li_list.length; y++) {
counter += 1;
console.log(counter + " - " + li_list[y].innerText);
}
console.log(" ");
console.log(" ");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment