Created
March 18, 2020 05:55
-
-
Save SmugZombie/a4de4885f405952d33f153e2527dfcd1 to your computer and use it in GitHub Desktop.
Simple script to parse a site name and site domain from a Liquid Web Wordpress Admin Page
This file contains 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
// Simple script to parse a site name and site domain from a Liquid Web Wordpress Admin Page | |
// Ron Egli - github.com/smugzombie | |
var domainArray = document.getElementsByClassName("domain-details") | |
var sites = [] | |
for(i=0; i < domainArray.length; i ++){ | |
site_name = document.getElementsByClassName("domain-details")[i].children[0].innerText | |
site_domain = document.getElementsByClassName("domain-details")[i].children[1].children[0].children[1].innerText | |
sites[sites.length] = [site_name, site_domain] | |
} | |
var csv = 'Site_Name, Domain\n'; | |
sites.forEach(function(row) { | |
csv += row.join(','); | |
csv += "\n"; | |
}); | |
var hiddenElement = document.createElement('a'); | |
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv); | |
hiddenElement.target = '_blank'; | |
hiddenElement.download = 'sites.csv'; | |
hiddenElement.click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment