summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/tree.js
blob: 3b47f81c223dacb04ed419646ffa4436fca5b124 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Tree slider for code browse
 *
 */
var Tree = { 
  init: 
    function() { 
      (new Image).src = "/assets/ajax-loader-facebook.gif";

      $('#tree-slider .tree-item-file-name a, .breadcrumb a').live("click", function() {
        history.pushState({ path: this.path }, '', this.href)
        $("#tree-content-holder").hide("slide", { direction: "left" }, 150)
      })

      $("#tree-slider .tree-item").live('click', function(e){
        if(e.target.nodeName != "A") {
          link = $(this).find(".tree-item-file-name a");
          link.trigger("click");
        }
      });

      $('#tree-slider td.tree-item-file-name a, .breadcrumb a').live({ 
        "ajax:beforeSend": function() { $('.tree_progress').addClass("loading"); },
        "ajax:complete": function() { $('.tree_progress').removeClass("loading"); } 
      });
    }
}