Last active
July 5, 2019 16:46
-
-
Save sempostma/a4e68cef87de0fad64e8b0c2f5c68d49 to your computer and use it in GitHub Desktop.
Extract data from devices.css demo page
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
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