EmberThis bookmarklet


#1

If you want to play with Ember on any side, use the following bookmarklet.

For instance, this may be useful for you to quickly fiddle with Ember sample code on the Ember API pages. To do so, run the bookmarklet and copy-and-paste sample code to the console.

Also, you may augment any of your favorite websites with :sparkles: Ember :sparkles:

EmberThis

javascript:(function(){urlJQuery='https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.js';urlHandlebars='https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js';urlEmber='https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.2/ember.js';urlEmberData='https://s3.amazonaws.com/builds.emberjs.com/ember-data-latest.js';document.body.appendChild(document.createElement('script')).src=urlJQuery;document.body.appendChild(document.createElement('script')).src=urlHandlebars;document.body.appendChild(document.createElement('script')).src=urlEmber;document.body.appendChild(document.createElement('script')).src=urlEmberData;console.log('EmberedThis!');})();

prettierprinted

javascript:
(function(){

urlJQuery='https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.js';
	urlHandlebars='https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js';
	urlEmber='https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.2/ember.js';
	urlEmberData='https://s3.amazonaws.com/builds.emberjs.com/ember-data-latest.js';
	
	document.body.appendChild(document.createElement('script')).src=urlJQuery;
	document.body.appendChild(document.createElement('script')).src=urlHandlebars;
	document.body.appendChild(document.createElement('script')).src=urlEmber;
	document.body.appendChild(document.createElement('script')).src=urlEmberData;
	
console.log('EmberedThis!');
})();

Caveats

  • :bug: To have Ember Data working, run the EmberThis bookmarklet twice. (lol, dunno why)
  • :skull: Some websites prohibit loading other scripts (e.g. facebook.com shows this behavior)

#2

Here is an update to the EmberThis bookmarklet. It now uses

EmberThis bookmarklet

~~~~~~~~~~~~~~~~~begin longstring~~~~~~~~~~~~~~~~~~

javascript:(function(){urlJQuery='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.js';urlHandlebars='https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js';urlEmber='https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.3/ember.js';   urlEmberData='https://s3.amazonaws.com/builds.emberjs.com/ember-data-latest.js';document.body.appendChild(document.createElement('script')).src=urlJQuery;document.body.appendChild(document.createElement('script')).src=urlHandlebars;document.body.appendChild(document.createElement('script')).src=urlEmber;document.body.appendChild(document.createElement('script')).src=urlEmberData;console.log('EmberedThis_rc.3!');})();

~~~~~~~~~~~~~~~~~end longstring~~~~~~~~~~~~~~~~~~

prettierprinted

javascript:
(function(){

    urlJQuery='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.js';
    urlHandlebars='https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js';
    urlEmber='https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.3/ember.js';
    urlEmberData='https://s3.amazonaws.com/builds.emberjs.com/ember-data-latest.js';

    document.body.appendChild(document.createElement('script')).src=urlJQuery;
    document.body.appendChild(document.createElement('script')).src=urlHandlebars;
    document.body.appendChild(document.createElement('script')).src=urlEmber;
    document.body.appendChild(document.createElement('script')).src=urlEmberData;

    console.log('EmberedThis_rc.3!');
})();

Installation instructions

Open the “add bookmark” dialog in your browser. There, as the URL, provide the long string from above which is delimited by longstring.

Alternatively: selecting, dragging and dropping that long string to your bookmarks bar should also work.


#3

About the caveats : it’s not working the first time you click because the librairies are not loaded yet. This can be fixed with something like here : http://coding.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/