Last active
August 29, 2015 14:12
-
-
Save HyShai/9a33d0d448448616866f to your computer and use it in GitHub Desktop.
A bookmarklet to show which Javascript libraries are running on a webpage.
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
//full credit for this to https://github.com/andrewbredow using his Library-Detector-for-Chrome | |
(function() { | |
function callback() { | |
var tests = d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests; | |
var libraries = []; | |
for (var i in tests) { | |
try { | |
var result = tests[i].test(window); | |
if (result === false) continue; | |
libraries.push({ | |
name: i, | |
version: result.version | |
}) | |
} catch (e) { | |
console.log("Library Detector test for " + i + " failed:", e) | |
} | |
} | |
var existing = ""; | |
for (var x = 0; x < libraries.length; x++) { | |
existing += libraries[x].name + ": " + libraries[x].version + "\n" | |
} | |
alert(existing) | |
} | |
var s = document.createElement("script"); | |
s.src = "https://cdn.rawgit.com/andrewbredow/Library-Detector-for-Chrome/master/library/libraries.js"; | |
if (s.addEventListener) { | |
s.addEventListener("load", callback, false) | |
} else if (s.readyState) { | |
s.onreadystatechange = callback | |
} | |
document.body.appendChild(s); | |
})() |
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
javascript:(function()%7Bfunction%20callback()%7Bvar%20tests%3Dd41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests%3Bvar%20libraries%3D%5B%5D%3Bfor(var%20i%20in%20tests)%7Btry%7Bvar%20result%3Dtests%5Bi%5D.test(window)%3Bif(result%3D%3D%3Dfalse)continue%3Blibraries.push(%7Bname%3Ai%2Cversion%3Aresult.version%7D)%7Dcatch(e)%7Bconsole.log(%22Library%20Detector%20test%20for%20%22%2Bi%2B%22%20failed%3A%22%2Ce)%7D%7Dvar%20existing%3D%22%22%3Bfor(var%20x%3D0%3Bx%3Clibraries.length%3Bx%2B%2B)%7Bexisting%2B%3Dlibraries%5Bx%5D.name%2B%22%3A%20%22%2Blibraries%5Bx%5D.version%2B%22%5Cn%22%7Dalert(existing)%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fcdn.rawgit.com%2Fandrewbredow%2FLibrary-Detector-for-Chrome%2Fmaster%2Flibrary%2Flibraries.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment