Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions content_scripts/lib_detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
return encoded.join(',');
};

var detectLibraries = function() {
var detectedLibraries = function() {
var tests = d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests;
var libraries = [];
for (var i in tests) {
Expand All @@ -31,8 +31,18 @@
return libraries;
};

var sortByName = function(libraries) {
return libraries.sort(function(a, b) {
var aName = a.name.toLowerCase(),
bName = b.name.toLowerCase();
if (aName > bName) return 1;
if (aName < bName) return -1;
return 0;
});
};

if (window === top) {
var libs = detectLibraries();
var libs = sortByName(detectedLibraries());
if (libs.length > 0) {
document.getElementById('d41d8cd98f00b204e9800998ecf8427e_lib_detect').content = encodeLibraries(libs);
}
Expand Down