Skip to content

Instantly share code, notes, and snippets.

@suzak
Created October 14, 2015 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save suzak/cd0c22556a460d4c0224 to your computer and use it in GitHub Desktop.
Save suzak/cd0c22556a460d4c0224 to your computer and use it in GitHub Desktop.
indexer = {
id: 'scala',
name: 'Scala',
icon: 'https://www.zdrojak.cz/wp-content/uploads/2014/07/scala-icon.png',
index: function (ctx) {
return ctx.fetchDocument('http://www.scala-lang.org/api/current/').then(function (document) {
Array.from(document.querySelectorAll('li.pack')).map(function (pack) {
ctx.pushIndex(pack.title, pack.querySelector('a.tplshow').href);
Array.from(pack.querySelector('.templates').querySelectorAll('li')).map(function (it) {
Array.from(it.querySelectorAll('a.tplshow')).map(function (a) {
var object = a.querySelector('.object') ? '$' : '';
ctx.pushIndex(`${it.title}${object}`, a.href);
});
});
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment