-
-
Notifications
You must be signed in to change notification settings - Fork 87
doc/template.html: make modules list closable (fixes #50) #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,5 +67,37 @@ <h3 class="date">$date$</h3> | |
$for(include-after)$ | ||
$include-after$ | ||
$endfor$ | ||
<script type="text/javascript"> | ||
(function() { | ||
// write out a basic 'dropdown_link' reference element | ||
var dropdown_link = document.createElement('a'); | ||
dropdown_link.className = 'dropdown_link'; | ||
dropdown_link.innerHTML = '<b>+</b> '; | ||
dropdown_link.style.color = "#212121"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. double quotes here (single quotes everywhere else) |
||
dropdown_link.style.cursor = 'pointer'; | ||
document.querySelectorAll('nav ul li > ul > li').forEach( | ||
function(element) { | ||
var dropdown_link_copy = dropdown_link.cloneNode(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this down below the early There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved |
||
var list = element.querySelector('ul'); | ||
if (!list) | ||
return; | ||
// add a clone of the node so the correct element is toggled | ||
list.style.display = 'none'; | ||
element.setAttribute('state', 'up'); | ||
dropdown_link_copy.onclick = function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it would make more sense to have an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same issue as |
||
if (element.getAttribute('state') == 'down') { | ||
element.setAttribute('state', 'up'); | ||
list.style.display = 'none'; | ||
dropdown_link_copy.querySelector('b').innerHTML = '+'; | ||
} else { | ||
element.setAttribute('state', 'down'); | ||
list.style.display = 'block'; | ||
dropdown_link_copy.querySelector('b').innerHTML = '-'; | ||
} | ||
} | ||
element.insertBefore(dropdown_link_copy, element.querySelector('a')); | ||
}); | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why an
a
link if it doesn't have ahref
? Should it just be abutton
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
button
elements add additional CSS. Using aa
tag accomplishes what we want with minimal CSS additions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay. I'm curious what the button css required would need to be; but don't worry about it :)