Skip to content

Instantly share code, notes, and snippets.

@sempostma
Last active July 5, 2019 16:46
Show Gist options
  • Save sempostma/a4e68cef87de0fad64e8b0c2f5c68d49 to your computer and use it in GitHub Desktop.
Save sempostma/a4e68cef87de0fad64e8b0c2f5c68d49 to your computer and use it in GitHub Desktop.
Extract data from devices.css demo page
Array.from(document.querySelectorAll('.section-device')).map(x => {
var def = x.querySelector('.device').classList.item(1);
var colors = Array.from(x.querySelectorAll('.dot.tooltip'))
if (colors.length === 0) {
return [{
className: def,
color: null
}]
}
return colors.map(c => {
return {
className: `${def} ${c.getAttribute('data-tooltip')}`,
color: c.getAttribute('style')
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment