Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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