Merge pull request #129 from neon-ninja/dt-ids
[rnaseq-cwl-training.git] / _includes / javascript.html
1 {% comment %}
2   Javascript used in lesson and workshop pages.
3 {% endcomment %}
4 <script src="{{ page.root }}/assets/js/jquery.min.js"></script>
5 <script src="{{ page.root }}/assets/js/bootstrap.min.js"></script>
6 <script src="{{ page.root }}/assets/js/lesson.js"></script>
7 <script>
8   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
9   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
10   m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
11   })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
12   ga('create', 'UA-37305346-2', 'auto');
13   ga('send', 'pageview');
14 </script>
15 <script>
16   // This snippet fixes a bug caused by Github's pages-gem using kramdown v1.11.1.
17   // In order for anchor links to point to the correct place in the glossary, they must have an id
18   // This snippet ensures every definition term has an id
19   // See https://github.com/swcarpentry/styles/pull/129
20   $('dt').each(function () {
21     if (!this.id) {
22       var id = $(this).text();
23       // If there's a ( in the name (e.g., "comma-separated values (CSV)") - just take everything up to the first (
24       var index = id.indexOf('(');
25       if (index > 0) {
26         id = id.substring(0, index);
27       }
28       // Strip leading and trailing whitespace, convert spaces to dashes and convert everything to lowercase
29       id = id.trim().replace(/ /g, '-').toLowerCase();
30       this.id = id;
31     }
32   });
33 </script>