(function(){var a;a=(function(){function b(){this.root=$("#root");this.goDirectoryList();this.currentDirectoryId=1;this.goBrowse("/home/eugeny/source/P2-dvcpro25/CONTENTS/VIDEO/000000.MXF ")}b.prototype.replace_view=function(c){return this.root.html(c)};b.prototype.go=function(c,e){var d=this;return $.get("/media/ajax/"+c,function(f){d.replace_view(f);return e()})};b.prototype.goDirectory=function(d){var c=this;this.currentDirectoryId=d;this.goBrowse("/");return;return this.go("directory/"+d,function(){c.root.find("#go-back").click(function(){return c.goDirectoryList()});return c.root.find("#go-browse").click(function(){return c.goBrowse("/")})})};b.prototype.goDirectoryList=function(){var c=this;return this.go("directory-list",function(){return c.root.find("a").each(function(d,f){return $(f).click(function(){return c.goDirectory($(f).attr("data-id"))})})})};b.prototype.reloadComments=function(){var c=this;return $.get("/media/ajax/browse/"+this.currentDirectoryId+"/"+this.currentPath+"?comments",function(d){return $("#comments").html(d)})};b.prototype.goBrowse=function(c){var d=this;this.currentPath=c;return this.go("browse/"+this.currentDirectoryId+"/"+c,function(){var e;if(c==="/"){d.root.find("#go-up").hide();c=""}else{d.root.find("#go-up").click(function(){var f;f=c.split("/");f=f.splice(0,f.length-1);c=f.join("/");return d.goBrowse(c)})}d.root.find("a.browse-item").each(function(f,g){return $(g).click(function(){c=c+"/"+$(g).attr("data-id");return d.goBrowse(c)})});if($("video")){e=$("video")[0];e.addEventListener("timeupdate",function(){var j,f,g,i,k;k=e.currentTime;j=Math.floor(k/3600);f=Math.floor(k/60%60);i=Math.floor(k%60);g=Math.floor(k*1000%1000);k=j+":"+(f<10?"0":"")+f+":"+(i<10?"0":"")+i+"."+(g<100?"0":"")+(g<10?"0":"")+g;return $(".timestamp").text(k)});$("a[data-time]").click(function(){var f;f=parseFloat($(this).attr("data-time"));return e.currentTime=f});d.reloadComments();return $(".comment-form a").click(function(){var f;f=$(".comment-form input").val();$(".comment-form input").val("");return $.post("/media/ajax/browse/"+d.currentDirectoryId+"/"+c,{comment:f,time:e.currentTime},function(g){d.reloadComments();return g.preventDefault()})})}})};return b})();$(function(){return new a()})}).call(this);