Created
February 25, 2017 09:51
-
-
Save danburzo/1768cb67a80591b69f7522020fd2064c to your computer and use it in GitHub Desktop.
Find the WordPress themes & plugins used by a 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
function _match(str, regex) { | |
var matches = []; | |
str.replace(regex, function() { | |
matches.push(Array.prototype.slice.call(arguments)); | |
}); | |
return matches; | |
} | |
function _unique(item, idx, arr) { | |
return arr.indexOf(item) === idx; | |
} | |
function find_themes(str) { | |
return _match(str, /wp\-content\/themes\/([^\/]+)/g) | |
.map(function(item) { | |
return item[1]; | |
}) | |
.filter(_unique); | |
} | |
function find_plugins(str) { | |
return _match(str, /wp\-content\/plugins\/([^\/]+)/g).map(function(item) { | |
return item[1]; | |
}) | |
.filter(_unique); | |
} | |
function inspect_wp() { | |
var html = document.documentElement.innerHTML; | |
console.info('Found themes:'); | |
console.table(find_themes(html)); | |
console.info('Found plugins:'); | |
console.table(find_plugins(html)); | |
} | |
inspect_wp(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment