Sha256: 5edc219759ee96215dde79e52176934175d175fd510df2764ee3f957231c9698

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

$('.attachment_tile a').live("click",function(e){
	if(this.type ==""){
		return true;
	}
	e.preventDefault();
	
	var download_link = this;

	if($('.player').length > 0 && $('.attachment_tile.selected').length==1){
		removePlayers();
		return;
	}
	if(this.type == "Audio"){
		removePlayers();
		$(this).parent().parent().addClass("selected");
		$('body').append("<audio class='player' autoplay='autoplay' id='audio_player' src='"+this+"' controls='controls'></audio>");
		$('body').append("<a href='"+download_link+"'><img id='downloadButton' src='assets/formats/default.png' /></a>");
		return;
	}
	if(this.type == "Video"){
		removePlayers();
		$(this).parent().parent().addClass("selected");
		var show = (this+"").split('/download')[0];
		show = show.replace("documents","videos");
		$('body').append("<video class='player' autoplay='autoplay' id='video_player' src='"+show+"?style=webm' controls='controls'></video>");		
		$('body').append("<a href='"+download_link+"'><img id='downloadButton' src='assets/formats/default.png' /></a>");
		return;
	}
	if(this.type == "Picture"){
		removePlayers();
		$(this).parent().parent().addClass("selected");
		$('body').append("<img class='player' id='picture_player' src='"+download_link+"' />");		
		$('body').append("<a href='"+download_link+"'><img id='downloadButton' src='assets/formats/default.png' /></a>");
	}		
});

function removePlayers(){
	$('.attachment_tile').removeClass("selected");
	$('.player').remove();
	$('#downloadButton').remove();
}

$('#closeButton').live("click",function(){
	removePlayers();
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
social_stream-documents-0.1.6 app/assets/javascripts/documents.js