Created
October 14, 2015 11:04
-
-
Save suzak/cd0c22556a460d4c0224 to your computer and use it in GitHub Desktop.
This file contains 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
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