Created
April 11, 2012 23:00
-
-
Save drnikki/2363348 to your computer and use it in GitHub Desktop.
Mustachifyit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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