Skip to content

Instantly share code, notes, and snippets.

@jbouzekri
Created October 20, 2015 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbouzekri/2573f3228ba613bfab2b to your computer and use it in GitHub Desktop.
Save jbouzekri/2573f3228ba613bfab2b to your computer and use it in GitHub Desktop.
chrome JS snippet to export compatible mobile in Google dev console
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