|
9 | 9 | link(href='landing.css', rel='stylesheet') |
10 | 10 | link(rel="shortcut icon", href="img/favicon.png") |
11 | 11 | script(type='text/javascript', src='//cdn.auth0.com/web-header/latest/standalone.min.js') |
| 12 | + script(src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js") |
12 | 13 |
|
13 | 14 | body |
14 | 15 | include includes/utils/mixins |
15 | 16 |
|
16 | 17 | .container-styleguide |
17 | 18 | include includes/sidebar |
18 | 19 |
|
19 | | - main.main-content-styleguide(role='main') |
| 20 | + div.main-content-styleguide(role='main') |
20 | 21 | include includes/getting-started |
21 | 22 | include includes/design |
22 | 23 | include includes/components |
23 | 24 | include includes/resources |
24 | 25 |
|
25 | 26 | script(src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js") |
26 | | - script(src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js") |
27 | 27 | script(src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js") |
| 28 | + script(src="//cdn.rawgit.com/vctrfrnndz/jquery-accordion/master/js/jquery.accordion.js") |
| 29 | + |
28 | 30 | script. |
| 31 | + function navigation() { |
| 32 | + |
| 33 | + $(window).on('hashchange', setSelected); |
| 34 | + |
| 35 | + function buildNav() { |
| 36 | + var $nav = $('.nav-styleguide ul'); |
| 37 | + |
| 38 | + $nav.html(''); |
| 39 | + |
| 40 | + $('[data-group]').each(function(i) { |
| 41 | + var $group = $(this); |
| 42 | + var name = $group.attr('data-group'); |
| 43 | + var id = $group.attr('id'); |
| 44 | + var tpl = [ |
| 45 | + '<li data-accordion class="'+ ((i === 0) ? 'open' : '') +'"><a class="'+ ((i === 0) ? 'is-current' : '') +'" href="#'+ id +'">', |
| 46 | + name, |
| 47 | + '</a></li>' |
| 48 | + ].join(''); |
| 49 | + |
| 50 | + var $item = $(tpl); |
| 51 | + |
| 52 | + if($group.find('h2[id]').length) { |
| 53 | + var $list = $('<ul></ul>'); |
| 54 | + |
| 55 | + $group.find('h2[id]').each(function(i) { |
| 56 | + var name = $(this).text(); |
| 57 | + var id = $(this).attr('id') || 'foo'; |
| 58 | + |
| 59 | + $list.append('<li><a href="#'+ id + '">' + name + '</li>'); |
| 60 | + |
| 61 | + $item.append($list); |
| 62 | + }); |
| 63 | + } |
| 64 | + |
| 65 | + return $nav.append($item); |
| 66 | + }); |
| 67 | + } |
| 68 | + |
| 69 | + function setSelected(hash) { |
| 70 | + var hash = location.hash || hash; |
| 71 | + var activeClass = 'is-current'; |
| 72 | + var $section = $(hash + '[data-group]'); |
| 73 | + var $subSection = $(hash).closest('[data-group]'); |
| 74 | + var $navItem = $('.nav-styleguide a[href="' + hash + '"]'); |
| 75 | + |
| 76 | + $('[data-group], .nav-styleguide a').removeClass(activeClass); |
| 77 | + |
| 78 | + if(hash.length) { |
| 79 | + $('[data-accordion]').removeClass('open'); |
| 80 | + } |
| 81 | + |
| 82 | + if($section.length) { |
| 83 | + $section.addClass(activeClass); |
| 84 | + } else if ($subSection.length) { |
| 85 | + $subSection.addClass(activeClass); |
| 86 | + } |
| 87 | + |
| 88 | + $navItem.addClass(activeClass); |
| 89 | + $navItem.closest('[data-accordion]').addClass('open'); |
| 90 | + } |
| 91 | + |
| 92 | + buildNav(); |
| 93 | + setSelected(location.hash); |
| 94 | + } |
| 95 | + |
| 96 | + navigation(); |
| 97 | + |
| 98 | + function accordions() { |
| 99 | + $('[data-accordion]').accordion({ |
| 100 | + controlElement: 'a', |
| 101 | + contentElement: 'ul' |
| 102 | + }); |
| 103 | + } |
| 104 | + |
| 105 | + accordions(); |
| 106 | + |
29 | 107 | function playground() { |
30 | 108 | var $module = $('.js-playground'); |
31 | 109 |
|
|
0 commit comments