Last active
August 29, 2015 14:04
-
-
Save aholmes/8136779a7b01cf4e80b1 to your computer and use it in GitHub Desktop.
JavaScript to generate an object from https://github.com/irccloud/irccloud-tools/wiki/API-Stream-Message-Reference
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 container = $('.markdown-body'), | |
classes = {}; | |
container.find('h2').each(function(i) | |
{ | |
var className = $(this).text().replace(/[^-a-zA-Z0-9_ ]+/g, '').trim(), | |
currentClass, next; | |
classes[className] = {}; | |
next = this; | |
do | |
{ | |
next = next.nextElementSibling; | |
} | |
while(next.nodeName !== 'UL'); | |
currentClass = next; | |
$(currentClass).find('li code').each(function(ci) | |
{ | |
var fieldName = $(this).text().replace(/[^-a-zA-Z0-9_ ]+/g, '').trim(), | |
description = this.nextSibling; | |
classes[className][fieldName] = $(description).text(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment