Permalink
Browse files

Breadcrumbs

  • Loading branch information...
1 parent 8d672f8 commit fa6ef51ebd8665b3204c4b38a1997b82f22b5db4 @antono antono committed Dec 25, 2010
Showing with 20 additions and 3 deletions.
  1. +1 −0 app.js
  2. +16 −0 js/breadcrumbs.js
  3. +3 −3 template.html
View
1 app.js
@@ -20,6 +20,7 @@ var Template = function (v) { return v};
var STATIC = {
'/js/code_highlighter.js': undefined,
'/js/javascript.js': undefined,
+ '/js/breadcrumbs.js': undefined,
'/css/main.css': undefined
};
View
@@ -0,0 +1,16 @@
+function Breadcrumbs(id) {
+ var container = document.getElementById(id)
+ var elements = container.innerHTML.split(".");
+ var output = [], el, url = '';
+
+ container.innerHTML = elements.shift();
+
+ for (var i = 0; i < elements.length; i++) {
+ url += ('/' + elements[i]);
+ el = document.createElement('a');
+ el.setAttribute('href', url);
+ el.innerHTML += elements[i];
+ container.innerHTML += '.'
+ container.appendChild(el);
+ }
+}
View
@@ -12,15 +12,16 @@
<link rel="stylesheet" href="/css/main.css" type="text/css" media="screen">
<script type="text/javascript" src="/js/code_highlighter.js"></script>
<script type="text/javascript" src="/js/javascript.js"></script>
+ <script type="text/javascript" src="/js/breadcrumbs.js"></script>
</head>
- <body>
+ <body onload="Breadcrumbs('breadcrumbs');">
<header>
<h1><a href="/">Beam.js</a></h1>
</header>
<div class="content-wrapper">
<section class="content">
- <h2><em>${ this.obj, typeOf }</em> ${ this.key }</h2>
+ <h2><em>${ this.obj, typeOf }</em> <span id="breadcrumbs">${ this.key }</span></h2>
${ this.doc, showdown }
@@ -41,6 +42,5 @@ <h3 id="${ topic }"><em>${ obj, typeOf }</em> <a href="${ this.path }${ topic }"
</footer>
</section>
</div>
-
</body>
</html>

0 comments on commit fa6ef51

Please sign in to comment.