static/js/main.js (view raw)
1var expanders = document.getElementsByClassName('expander');
2for (var i = 0; i < expanders.length; i++) {
3 (function() {
4 var expander = expanders[i];
5 var content = expander.children[0];
6
7 var button = document.createElement('button');
8 button.appendChild(document.createTextNode('expand'));
9 expander.appendChild(button);
10
11 content.style.height = expander.dataset.height || '12.5em';
12 button.onclick = function() {
13 content.style.height = 'auto';
14 button.remove();
15 }
16 })();
17}