Last active
December 24, 2015 09:49
-
-
Save tebriel/6779910 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
| var insert = "INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES "; | |
| var docs = "polymaps.org/docs/"; | |
| var type='Method' | |
| var sections = [] | |
| $('a', $('ul', $('.sidebar'))).each(function(index, link) { | |
| atag = $(link) | |
| var path=docs+atag.attr('href') | |
| var name=atag.text() | |
| sections.push("('"+name+"', 'Section', '"+path+"')"); | |
| }); | |
| console.log(insert+sections.join(', ')+";"); | |
| //map.html | |
| var methods = [] | |
| $('dl.function').each(function(index, item){ | |
| var dltag=$(item); | |
| name=dltag.attr('id'); | |
| path=docs+"map.html#"+name; | |
| if ((name.indexOf('map.') === -1) && (name.indexOf('po.') === -1)) { | |
| name = "map."+name; | |
| } | |
| methods.push("('"+name+"', 'Method', '"+path+"')"); | |
| }); | |
| console.log(insert+methods.join(', ')+";"); | |
| // image.html | |
| var methods = [] | |
| $('dl.function').each(function(index, item){ | |
| var dltag=$(item); | |
| name=dltag.attr('id'); | |
| path=docs+"image.html#"+name; | |
| if (name.indexOf('po.') === -1) { | |
| name = "image."+name; | |
| } | |
| methods.push("('"+name+"', 'Method', '"+path+"')"); | |
| }); | |
| console.log(insert+methods.join(', ')+";"); | |
| // layer.html | |
| var methods = [] | |
| var title='layer' | |
| var type='Method' | |
| $('dl.function').each(function(index, item){ | |
| var dltag=$(item); | |
| var curMethod = type; | |
| name=dltag.attr('id'); | |
| path=docs+title+".html#"+name; | |
| if (name.indexOf('po.') === -1) { | |
| name = title+"."+name; | |
| } else { | |
| curMethod = 'Constructor'; | |
| } | |
| methods.push("('"+name+"', '"+curMethod+"', '"+path+"')"); | |
| }); | |
| console.log(insert+methods.join(', ')+";"); | |
| // geoJson.html | |
| var methods = [] | |
| var title='geoJson' | |
| var type='Method' | |
| $('dl.function').each(function(index, item){ | |
| var dltag=$(item); | |
| var curMethod = type; | |
| name=dltag.attr('id'); | |
| path=docs+title+".html#"+name; | |
| if (name.indexOf('po.') === -1) { | |
| name = title+"."+name; | |
| } else { | |
| curMethod = 'Constructor'; | |
| } | |
| methods.push("('"+name+"', '"+curMethod+"', '"+path+"')"); | |
| }); | |
| console.log(insert+methods.join(', ')+";"); | |
| // arrow.html | |
| var methods = [] | |
| var title='arrow' |
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
| var jq = document.createElement('script'); | |
| jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; | |
| document.getElementsByTagName('head')[0].appendChild(jq); | |
| // ... give time for script to load, then type. | |
| setTimeout(function(){ | |
| var insert = "INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES "; | |
| var docs = "polymaps.org/docs/"; | |
| var type='Method'; | |
| var methods = []; | |
| var title=$('h2').text(); | |
| $('dl.function').each(function(index, item){ | |
| var dltag=$(item); | |
| var curMethod = type; | |
| name=dltag.attr('id'); | |
| path=docs+title+".html#"+name; | |
| if (name.indexOf('po.') === -1) { | |
| name = title+"."+name; | |
| } else { | |
| curMethod = 'Constructor'; | |
| } | |
| methods.push("('"+name+"', '"+curMethod+"', '"+path+"')"); | |
| }); | |
| console.log(insert+methods.join(', ')+";"); | |
| }, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment