Skip to content
Permalink
Browse files

Fixed wiki TOC toggling

  • Loading branch information...
sagotch committed Aug 6, 2019
1 parent 7452258 commit 5ba6eeed5bf5a754b5fac47eba15efab3f18a545
Showing with 21 additions and 17 deletions.
  1. +18 −10 hd/etc/summary.txt
  2. +3 −7 lib/wiki.ml
@@ -3,23 +3,29 @@
<script>
<!--
function showTocToggle() {
show="[visualize/show/hide/summary]1";
hide="[visualize/show/hide/summary]2";
if (document.getElementById) {
show_disp=' style="display:none;"';
hide_disp='';
document.writeln('<span class="toctoggle">' +
'(<a href="javascript:toggleToc()" class="internal">' +
'<span id="showlink"' + show_disp + '>' + show + '</span>' +
'<span id="hidelink"' + hide_disp + '>' + hide + '</span>'
+ '</a>)</span>');
var anchor = document.getElementById('toctoggleanchor');
if (anchor) {
var show="[visualize/show/hide/summary]1";
var hide="[visualize/show/hide/summary]2";
var show_disp=' style="display:none;"';
var hide_disp='';
var d = document.createElement ('span') ;
d.className = 'toctoggle' ;
d.innerHTML =
' (<a href="javascript:toggleToc()" class="internal">'
+ '<span id="showlink"' + show_disp + '>' + show + '</span>'
+ '<span id="hidelink"' + hide_disp + '>' + hide + '</span>'
+ '</a>)</span>' ;
anchor.appendChild(d);
}
}

function setTocToggle() {
var cookiePos = document.cookie.indexOf("hidetoc=");
if (cookiePos > -1 && document.cookie.charAt(cookiePos + 8) == 1)
toggleToc();
}

function toggleToc() {
var toc = document.getElementById('tocinside');
var showlink = document.getElementById('showlink');
@@ -38,5 +44,7 @@ function toggleToc() {
document.cookie = "hidetoc=1";
}
}

document.addEventListener("DOMContentLoaded", (function(){showTocToggle();setTocToggle();}))
-->
</script>
@@ -325,15 +325,11 @@ let summary_of_tlsw_lines conf short lines =
let lines =
"<dl><dd>" :: "<table id=\"summary\" cellpadding=\"10\">" ::
("<tr><td align=\"" ^ conf.left ^ "\">") ::
("<div style=\"text-align:center\"><b>" ^
capitale (message_txt conf 3) ^ "</b>") ::
"<script type=\"text/javascript\">" :: "//<![CDATA[" ::
"showTocToggle()" :: "//]]>" :: "</script>" :: "</div>" ::
("<div style=\"text-align:center\" id=\"toctoggleanchor\"><b>" ^
capitale (message_txt conf 3) ^ "</b>") :: "</div>" ::
"<div class=\"summary\" id=\"tocinside\">" ::
List.rev_append rev_summary
["</div>"; "</td></tr></table>"; "</dd></dl>";
"<script type=\"text/javascript\">"; "//<![CDATA["; "setTocToggle()";
"//]]>"; "</script>"]
["</div>"; "</td></tr></table>"; "</dd></dl>"]
in
lines, sections_nums

0 comments on commit 5ba6eee

Please sign in to comment.
You can’t perform that action at this time.