embed images, and make sure they are activated on a new message is posted

This commit is contained in:
maxwell 2011-03-17 21:48:11 -07:00
parent 93f7f28b07
commit 275098a309

View file

@ -11,12 +11,9 @@ var Stream = {
Diaspora.widgets.timeago.updateTimeAgo();
$stream.not(".show").delegate("a.show_post_comments", "click", Stream.toggleComments);
//audio linx
$(".stream a[target='_blank']").each(function(){
if($(this).attr('href').match(/\.mp3$|\.ogg$/)) {
$(this).hide();
$(this).parent().append("<audio preload='none' src='" + this.href + "' controls='controls'>mom</audio>");}
});
//
Stream.setUpAudioLinks();
Stream.setUpImageLinks();
// comment link form focus
$stream.delegate(".focus_comment_textarea", "click", function(e){
@ -63,6 +60,8 @@ var Stream = {
//collapse publisher
Publisher.close();
Publisher.clear();
Stream.setUpImageLinks();
Stream.setUpAudioLinks();
});
$(".new_status_message").bind('ajax:failure', function(data, html , xhr) {
@ -87,6 +86,23 @@ var Stream = {
});
},
setUpAudioLinks: function(){
$(".stream a[target='_blank']").each(function(){
if($(this).attr('href').match(/\.gif$|\.jpg$|\.png$|\.jpeg$/)) {
$(this).hide();
$(this).parent().append("<img src='" + this.href + "'</img>");}
});
},
setUpImageLinks: function(){
$(".stream a[target='_blank']").each(function(){
if($(this).attr('href').match(/\.mp3$|\.ogg$/)) {
$(this).hide();
$(this).parent().append("<audio preload='none' src='" + this.href + "' controls='controls'>mom</audio>");}
});
},
toggleComments: function(evt) {
evt.preventDefault();
var $this = $(this),