Add javascript to open table of contents on click.
[worg.git] / preamble.html
1 <script type="text/javascript">
2
3   var _gaq = _gaq || [];
4   _gaq.push(['_setAccount', 'UA-7691209-1']);
5   _gaq.push(['_trackPageview']);
6
7   (function() {
8     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
9     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
10     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
11   })();
12
13   document.addEventListener('DOMContentLoaded',function() {
14       document.getElementById("table-of-contents").onclick = function() {
15           var elem = document.getElementById("text-table-of-contents");
16           elem.style.display = elem.style.display == "block" ? "none" : "block";
17       }
18   });
19 </script>