Skip to content

Instantly share code, notes, and snippets.

@drnikki
Created April 11, 2012 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drnikki/2363348 to your computer and use it in GitHub Desktop.
Save drnikki/2363348 to your computer and use it in GitHub Desktop.
Mustachifyit
/**
* MUSTACHES FOR EVERYONE... kind of.
*/
(function($) {
Drupal.behaviors.mustache = {
attach: function() {
$("img")
.mouseover(function() {
var mustache = 'http://mustachify.me/?src=';
var src = $(this).attr("src");
if (src.indexOf('headshot') != -1 ) {
/* got a dev environment that mustachify can't reach? replace here */
src = src.replace(/(local:8888|dev)/g, 'com');
$(this).attr("src", mustache + src);
}
})
.mouseout(function() {
var src = $(this).attr("src");
if (src.indexOf('headshot') != -1 ) {
src = src.replace('http://mustachify.me/?src=', '');
$(this).attr("src", src);
}
})
}
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment