-
-
Save cho45/1af88e31f40b3b2b4671 to your computer and use it in GitHub Desktop.
This file contains hidden or 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); | |
}); | |
}); | |
}); | |
}); | |
}, | |
item : function (item) { | |
item[1] = "data:text/html," + encodeURIComponent("<iframe sandbox='' style='width:100%;height:100%;border:none' src='" + item[1] + "'>"); | |
return item; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment