Created
November 21, 2017 04:36
-
-
Save kerbeh/6c199d8c409ad68529e255f5809da657 to your computer and use it in GitHub Desktop.
Echo360 ALP Device Room and IP config builder Bookmarklet
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
//** 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