Skip to content
Extraits de code Groupes Projets
Valider 275098a3 rédigé par maxwell's avatar maxwell
Parcourir les fichiers

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

parent 93f7f28b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -11,12 +11,9 @@ var Stream = { ...@@ -11,12 +11,9 @@ var Stream = {
Diaspora.widgets.timeago.updateTimeAgo(); Diaspora.widgets.timeago.updateTimeAgo();
$stream.not(".show").delegate("a.show_post_comments", "click", Stream.toggleComments); $stream.not(".show").delegate("a.show_post_comments", "click", Stream.toggleComments);
//audio linx //audio linx
$(".stream a[target='_blank']").each(function(){ //
if($(this).attr('href').match(/\.mp3$|\.ogg$/)) { Stream.setUpAudioLinks();
$(this).hide(); Stream.setUpImageLinks();
$(this).parent().append("<audio preload='none' src='" + this.href + "' controls='controls'>mom</audio>");}
});
// comment link form focus // comment link form focus
$stream.delegate(".focus_comment_textarea", "click", function(e){ $stream.delegate(".focus_comment_textarea", "click", function(e){
...@@ -63,6 +60,8 @@ var Stream = { ...@@ -63,6 +60,8 @@ var Stream = {
//collapse publisher //collapse publisher
Publisher.close(); Publisher.close();
Publisher.clear(); Publisher.clear();
Stream.setUpImageLinks();
Stream.setUpAudioLinks();
}); });
$(".new_status_message").bind('ajax:failure', function(data, html , xhr) { $(".new_status_message").bind('ajax:failure', function(data, html , xhr) {
...@@ -87,6 +86,23 @@ var Stream = { ...@@ -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) { toggleComments: function(evt) {
evt.preventDefault(); evt.preventDefault();
var $this = $(this), var $this = $(this),
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter