Skip to content

Commit

Permalink
Merge pull request johnmichel#9 from johnmichel/master
Browse files Browse the repository at this point in the history
Last minute changes!
  • Loading branch information
andrewbredow committed Aug 8, 2011
2 parents d1069f7 + e6448a3 commit 1d82d22
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 36 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,11 @@
Changelog
=========

### 2.5
- Changing how version-less libraries are reported
- Tweaking the way multiple libraries are displayed
- Adding support for PhiloGL, CamanJS, yepnope, LABjs, Head JS, ControlJS, RequireJS, RightJS, jQuery Tools, Pusher, Paper.js, Swiffy, Move, and AmplifyJS

### 2.11
- Disabling jQuery Tools detection for now

Expand Down
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -35,7 +35,20 @@ supports:
- SproutCore
- Zepto.js
- three.js
- PhiloGL
- CamanJS
- yepnope
- LABjs
- Head JS
- ControlJS
- RequireJS
- RightJS
- jQuery Tools
- Pusher
- Paper.js
- Swiffy
- Move
- AmplifyJS


### To run the development version of the plugin
Expand Down
2 changes: 1 addition & 1 deletion background_scripts/main.js
Expand Up @@ -80,7 +80,7 @@ function dispatch(pixelData) {

chrome.pageAction.setTitle({
tabId: tabId,
title: libraries.length > 1 ? 'Multiple libraries' : library.name + ' ' + library.version
title: libraries.length > 1 ? libraries.length + ' libraries detected' : library.name + ' ' + library.version
});
chrome.pageAction.setPopup({
'tabId': tabId,
Expand Down
2 changes: 1 addition & 1 deletion content_scripts/lib_detect.js
Expand Up @@ -37,4 +37,4 @@
}
}

})();
})();
Binary file added icons/amplifyjs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/move.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/paperjs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/typekit.png
Binary file not shown.
99 changes: 71 additions & 28 deletions library/libraries.js
Expand Up @@ -75,7 +75,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://labs.adobe.com/technologies/spry',
test: function(win) {
if(win.Spry) {
return { version: 'none' };
return { version: '' };
}
return false;
}
Expand All @@ -97,7 +97,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://qooxdoo.org',
test: function(win) {
if(win.qx && win.qx.Bootstrap) {
return { version: 'none' };
return { version: '' };
}
return false;
}
Expand Down Expand Up @@ -133,7 +133,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://code.google.com/closure/library',
test: function(win) {
if(win.goog) {
return { version: 'none' };
return { version: '' };
}
return false;
}
Expand Down Expand Up @@ -176,7 +176,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'backbone',
url: 'http://documentcloud.github.com/backbone',
test: function(win) {
if (win.Backbone) {
if (win.Backbone && win.Backbone.Model.extend) {
return {version: win.Backbone.VERSION};
}
return false;
Expand All @@ -199,7 +199,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'sammy',
url: 'http://sammyjs.org',
test: function(win) {
if (win.Sammy && win.Sammy.VERSION) {
if (win.Sammy && win.Sammy.VERSION && win.Sammy.Application.curry) {
return {version: win.Sammy.VERSION};
}
return false;
Expand All @@ -221,8 +221,8 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'mochikit',
url: 'http://www.mochikit.com',
test: function(win) {
if (win.MochiKit) {
return {version: MochiKit.VERSION || MochiKit.Base.VERSION};
if (win.MochiKit && win.MochiKit.Base.module) {
return {version: MochiKit.VERSION};
}
return false;
}
Expand All @@ -233,7 +233,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://g.raphaeljs.com',
test: function(win) {
if (win.Raphael && win.Raphael.fn.g) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -244,7 +244,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://www.bbc.co.uk/glow',
test: function(win) {
if (win.gloader) {
return {version: 'none'};
return {version: ''};
}
else if (win.glow && win.glow.dom) {
return {version: win.glow.VERSION};
Expand All @@ -260,8 +260,8 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'icon_48', // currently has no icon
url: 'http://socket.io',
test: function(win) {
if (win.io && win.io.on) {
return {version: win.io.version};
if (win.io && win.io.sockets && win.io.version) { // fix! e.g. Google Reader currently shows up as using socket.io, which they are not doing
return {version: win.io.version};
}
return false;
}
Expand All @@ -271,7 +271,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'mustache',
url: 'http://mustache.github.com',
test: function(win) {
if (win.Mustache) {
if (win.Mustache && win.Mustache.to_html) {
return {version: win.Mustache.version};
}
return false;
Expand All @@ -282,7 +282,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'icon_48', // currently has no icon
url: 'https://github.com/kangax/fabric.js',
test: function(win) {
if (win.fabric && win.fabric.version) {
if (win.fabric && win.fabric.util) {
return {version: win.fabric.version};
}
return false;
Expand All @@ -305,8 +305,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'https://github.com/sole/tween.js',
test: function(win) {
if (win.TWEEN) {
console.log(win.TWEEN);
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -317,7 +316,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://www.sproutcore.com',
test: function(win) {
if (win.SC && win.SC.Application) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -328,7 +327,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://zeptojs.com',
test: function(win) {
if (win.Zepto && win.Zepto.fn) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -338,8 +337,8 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'icon_48', // currently has no icon
url: 'https://github.com/mrdoob/three.js',
test: function(win) {
if (win.THREE && win.THREE) {
return {version: 'none'};
if (win.THREE) {
return {version: ''};
}
return false;
}
Expand All @@ -358,10 +357,10 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {

'CamanJS': {
icon: 'camanjs',
url: 'http://camanjs.com',
url: 'http://camanjs.com/',
test: function(win) {
if (win.Caman) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -372,7 +371,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://yepnopejs.com/',
test: function(win) {
if (win.yepnope) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -383,7 +382,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://labjs.com/',
test: function(win) {
if (win.$LAB) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -394,7 +393,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://headjs.com/',
test: function(win) {
if (win.head && win.head.js) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -405,7 +404,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
url: 'http://stevesouders.com/controljs/',
test: function(win) {
if (win.CJS) {
return {version: 'none'};
return {version: ''};
}
return false;
}
Expand All @@ -415,7 +414,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'requirejs',
url: 'http://requirejs.org/',
test: function(win) {
if (win.require && win.require.version) {
if (win.require && win.require.def) {
return {version: win.require.version};
}
return false;
Expand All @@ -426,7 +425,7 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'rightjs',
url: 'http://rightjs.org/',
test: function(win) {
if (win.RightJS) {
if (win.RightJS && win.RightJS.isNode) {
return {version: win.RightJS.version};
}
return false;
Expand All @@ -449,11 +448,55 @@ var d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests = {
icon: 'pusher',
url: 'http://pusher.com/docs/pusher_js',
test: function(win) {
if(win.Pusher) {
if(win.Pusher && win.Pusher.Channel) {
return { version: win.Pusher.VERSION };
}
return false;
}
},

'Paper.js': {
icon: 'paperjs',
url: 'http://paperjs.org/',
test: function(win) {
if(win.paper && win.paper.Point) {
return { version: win.paper.version };
}
return false;
}
},

'Swiffy': {
icon: 'icon_48',
url: 'http://swiffy.googlelabs.com/',
test: function(win) {
if(win.swiffy) {
return { version: '' };
}
return false;
}
},

'Move': {
icon: 'move',
url: 'http://movelang.org/',
test: function(win) {
if(win.move && win.move.compile) {
return { version: win.move.version() };
}
return false;
}
},

'AmplifyJS': {
icon: 'amplifyjs',
url: 'http://amplifyjs.com/',
test: function(win) {
if(win.amplify && win.amplify.publish) {
return { version: '' };
}
return false;
}
}
// maybe include some of the other javascript loaders? - http://jhn.me/7aeW
};
2 changes: 1 addition & 1 deletion manifest.json
@@ -1,6 +1,6 @@
{
"name": "Library Detector",
"version": "2.1",
"version": "2.50",
"description": "Detects the Javascript libraries running on a page and displays their icons in the address bar.",
"icons": {
"48": "icons/icon_48.png",
Expand Down
12 changes: 7 additions & 5 deletions popups/libraries.js
Expand Up @@ -11,13 +11,15 @@ var addLibrary = function(library) {
link.innerHTML = library.name;
link.setAttribute('style', "background: transparent url('../icons/" + library.icon + ".png') no-repeat left center");
link.target = '_blank';

container.appendChild(link);

var version = document.createElement('span');
version.innerHTML = library.version !== 'none' ? (' ' + library.version) : '';
var version = document.createElement('span');
if (library.version !== undefined || library.version !== 'undefined' || library.version !== null || library.version !== '') {
version.innerHTML = ' ' + library.version;
container.appendChild(version);
}

container.appendChild(link);
container.appendChild(version);

document.getElementById('libraries').appendChild(container);
};

Expand Down

0 comments on commit 1d82d22

Please sign in to comment.