Sha256: 6a5f0254710e6118a6de437eacdb5098f6eb0182c1ce40b9aace36ad7983b855
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 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='<%= asset_path "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='<%= asset_path "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='<%= asset_path "formats/default.png" %>' /></a>"); } }); function removePlayers(){ $('.attachment_tile').removeClass("selected"); $('.player').remove(); $('#downloadButton').remove(); } $('#closeButton').live("click",function(){ removePlayers(); });
Version data entries
4 entries across 4 versions & 1 rubygems