summaryrefslogtreecommitdiff
path: root/share/www/_sidebar.html
blob: 9bddda37238ad262575bcce760176874ca2ff4cb (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<div id="sidebar">
  <a href="index.html">
    <img id="logo" src="image/logo.png" width="175" height="150" alt="Apache CouchDB: Relax">
  </a>
  <ul id="nav">
    <li><span>Tools</span><ul>
      <li><a href="index.html">Overview</a></li>
      <li><a href="replicator.html">Replicator</a></li>
      <li><a href="config.html">Configuration</a></li>
      <li><a href="couch_tests.html?script/couch_tests.js">Test Suite</a></li>
    </ul></li>
    <li><span>Recent Databases</span>
      <ul id="dbs"></ul>
    </li>
  </ul>
  <div id="footer">
    Futon on <a href="http://couchdb.apache.org/">Apache CouchDB</a>
    <span id="version">?</span>
  </div>
</div>
<script type="text/javascript">
  function updateNavigation(path, queryString) {
    function fixupPath(path) { // hack for IE/Win
      return (path.charAt(0) != "/") ? ("/" + path) : path;
    }
    if (!path) {
      path = location.pathname;
      if (!queryString) {
        queryString = location.search;
      }
    } else if (!queryString) {
      queryString = "";
    }
    var href = fixupPath(path + queryString);
    $("#nav li").removeClass("selected");
    $("#nav li a").each(function() {
      if (fixupPath(this.pathname) + this.search != href) return;
      $(this).parent("li").addClass("selected").parents("li").addClass("selected");
    });
  }

  function updateRecentDatabasesList() {
    $("#dbs").empty();
    var recentDbs = $.cookies.get("recent", "").split(",");
    recentDbs.sort();
    $.each(recentDbs, function(idx, name) {
      if (name) {
        $("#dbs").append("<li><a href='database.html?" +
          encodeURIComponent(name) + "'>" + name +
          "</a></li>");
      }
    });
  }

  $(function() {
    document.title = "Apache CouchDB - Futon: " + document.title;
    $.couch.info({
      success: function(info, status) {
        $("#version").text(info.version);
      }
    });
    updateRecentDatabasesList();
    updateNavigation();
  });
</script>