Skip to content

Instantly share code, notes, and snippets.

@kerbeh
Created November 21, 2017 04:36
Show Gist options
  • Save kerbeh/6c199d8c409ad68529e255f5809da657 to your computer and use it in GitHub Desktop.
Save kerbeh/6c199d8c409ad68529e255f5809da657 to your computer and use it in GitHub Desktop.
Echo360 ALP Device Room and IP config builder Bookmarklet
//** Echo ALP **/
//Scrape the rooms and IPs from the page
var ips = [...document.querySelectorAll("div.network span.type")].map(IP => `${IP.textContent}`);
var rooms = [...document.querySelectorAll("div.roomName")].map(Room => `${Room.textContent}`);
var configArray = {};
var alertString = "";
//Loop over the IPs and add the matching room
var count = 0;
for (ip of ips) {
configArray[rooms[count].trim()] = ip;
alertString += '"' + rooms[count].trim() + '"' + "=>" + '"' + ip + '"' + ",\n";
count++;
}
//Output the results to the console and an alert box
console.log(configArray);
alert(alertString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment