Created
October 20, 2015 13:50
-
-
Save jbouzekri/2573f3228ba613bfab2b to your computer and use it in GitHub Desktop.
chrome JS snippet to export compatible mobile in Google dev console
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 allLabel = document.querySelectorAll('div[role=menu] ul li a span'); | |
for (keycomp in allLabel) { | |
if (typeof allLabel[keycomp] == 'object') { | |
var label = allLabel[keycomp].textContent; | |
if (label.startsWith('Tous les appareils')) { | |
var allNumber = label.substring(label.lastIndexOf("(")+1,label.lastIndexOf(")")); | |
} else if (label.startsWith('Compatible')) { | |
var compNumber = label.substring(label.lastIndexOf("(")+1,label.lastIndexOf(")")); | |
} | |
} | |
} | |
console.log(compNumber + '/' + allNumber); | |
var phoneGroups = document.querySelectorAll('[data-manufacturer-group]'); | |
for (key in phoneGroups) { | |
if (typeof phoneGroups[key] == 'object') { | |
var groupName = phoneGroups[key].querySelector('h3').textContent; | |
var devices = phoneGroups[key].querySelectorAll('[data-product]'); | |
for (deviceKey in devices) { | |
if (!!devices[deviceKey].textContent) { | |
console.log(groupName+' - '+devices[deviceKey].textContent) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment