Skip to content

Instantly share code, notes, and snippets.

@tzi
Created December 29, 2011 13:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzi/1534085 to your computer and use it in GitHub Desktop.
Save tzi/1534085 to your computer and use it in GitHub Desktop.
A #javascript #bookmarklet : Find which javascript Framework is used on the current page
(function () {
if ( typeof( bm_popin ) == 'undefined' ) {
alert( 'Please update your Bookmarklet here: http://zilliox.me/bm' );
} else {
// Instanciate a generic bookmarklet popin
var popin = new bm_popin( 1534085 );
popin.title( 'What JS ?' );
var no_framework = true;
// jQuery : http://jquery.com/
if ( typeof ( jQuery ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'jQuery ' + jQuery(document).jquery );
// jQuery UI : http://jqueryui.com/
if ( typeof ( jQuery.ui ) !== 'undefined' ) {
popin.add_text( 'jQuery UI ' + jQuery.ui.version );
}
// markItUp! : http://markitup.jaysalvat.com
if ( typeof ( jQuery.markItUp ) !== 'undefined' ) {
popin.add_text( 'jQuery markItUp! ' );
}
}
// MooTools : http://mootools.net/
if ( typeof ( MooTools ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'MooTools ' + MooTools.version );
}
// Prototype : http://www.prototypejs.org/
if ( typeof ( Prototype ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'Prototype ' + Prototype.Version );
}
// Underscore.js : http://documentcloud.github.com/underscore/
if ( typeof ( _ ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'Underscore ' + _.VERSION );
}
// YUI 2 : http://developer.yahoo.com/yui/2/
if ( typeof ( YAHOO ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'YUI ' + YAHOO.VERSION );
}
// YUI 3 : http://yuilibrary.com/
if ( typeof ( YUI ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'YUI ' + YUI.version );
}
// Dojo : http://dojotoolkit.org/
if ( typeof ( dojo ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'Dojo ' + dojo.version.major + '.' + dojo.version.minor + '.' + dojo.version.patch );
}
// Backbone.js : http://documentcloud.github.com/backbone/
if ( typeof ( Backbone ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'Backbone ' + Backbone.VERSION );
}
// Popcorn : http://popcornjs.org/
if ( typeof ( Popcorn ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'Popcorn.js ' + Popcorn.version );
}
// RequireJs : http://requirejs.org/
if ( typeof ( requirejs ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'RequireJs ' + requirejs.version );
}
// yepnope.js : http://yepnopejs.com/
if ( typeof ( yepnope ) !== 'undefined' ) {
no_framework = false;
popin.add_text( 'yepnope' );
}
// No Framework
if ( no_framework ) {
popin.add_text( 'No JS framework found' );
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment