Created
August 25, 2011 22:48
-
-
Save paul/1172227 to your computer and use it in GitHub Desktop.
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
$(function() { | |
callbacks = []; | |
inlineImages = function(content) { | |
content.find('a').each(function() { | |
if (/\.(gif|jpe?g|png)/i.test($(this).text())) | |
$(this).html('<img src="'+$(this).text()+'"/>') | |
}); | |
} | |
callbacks.push(inlineImages) | |
$(document).delegate('#js-chat li', 'DOMNodeInserted', function(e) { | |
$(e.target).find('.content').each(function() { | |
var els = $(this); | |
if(!els.length == 0) | |
$.each(callbacks, function(i, cb) { cb(els) }); | |
}); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment