diff options
author | Marc Abramowitz <marc@marc-abramowitz.com> | 2015-04-30 16:42:17 -0700 |
---|---|---|
committer | Marc Abramowitz <marc@marc-abramowitz.com> | 2015-04-30 16:42:17 -0700 |
commit | 12a3f1f4cfa7f88478dc1b0e949fcc095b9fc804 (patch) | |
tree | ddb8079523d846f0b074437fc33fa5e28b508183 /docs/web/site.js | |
download | paste-git-eliminate_cgi_parse_qsl.tar.gz |
Replace cgi.parse_qsl w/ six.moves.urllib.parse.parse_sqleliminate_cgi_parse_qsl_2eliminate_cgi_parse_qsl
because `cgi.parse_qsl` is deprecated, according to
https://docs.python.org/2/library/cgi.html#cgi.parse_qsl
Diffstat (limited to 'docs/web/site.js')
-rw-r--r-- | docs/web/site.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/docs/web/site.js b/docs/web/site.js new file mode 100644 index 0000000..ed23575 --- /dev/null +++ b/docs/web/site.js @@ -0,0 +1,69 @@ +function setup_dropdowns() { + var els = document.getElementsByTagName('UL'); + for (var i = 0; i < els.length; i++) { + var el = els[i]; + if (el.className.search(/\bcontents\b/) > -1) { + enable_dropdown(el); + } + } +} + +function enable_dropdown(el) { + var title = el.getElementsByTagName('LI')[0]; + var plus_minus = document.createTextNode(' [-]'); + if (title.childNodes[0].tagName != 'A') { + anchor = document.createElement('A'); + while (title.childNodes.length) { + anchor.appendChild(title.childNodes[0]); + } + anchor.setAttribute('href', '#'); + anchor.style.padding = '1px'; + title.appendChild(anchor); + } else { + anchor = title.childNodes[0]; + } + anchor.appendChild(plus_minus); + function show_hide() { + if (el.sub_hidden) { + set_sub_li(el, ''); + anchor.removeChild(plus_minus); + plus_minus = document.createTextNode(' [-]'); + anchor.appendChild(plus_minus); + } else { + set_sub_li(el, 'none'); + anchor.removeChild(plus_minus); + plus_minus = document.createTextNode(' [+]'); + anchor.appendChild(plus_minus); + } + el.sub_hidden = ! el.sub_hidden; + return false; + } + anchor.onclick = show_hide; + show_hide(); +} + +function set_sub_li(list, display) { + var sub = list.getElementsByTagName('LI'); + for (var i = 1; i < sub.length; i++) { + sub[i].style.display = display; + } +} + +function add_onload(func) { + if (window.onload) { + var old_onload = window.onload; + function new_onload() { + old_onload(); + func(); + } + window.onload = new_onload; + } else { + window.onload = func; + } +} + +add_onload(setup_dropdowns); + + + + |