fixing click/toggle behaviour

This commit is contained in:
Philip Sargent 2020-04-13 12:46:57 +01:00
parent 0b90ebdd4e
commit 234f4234bb
2 changed files with 137 additions and 104 deletions

View File

@ -21,8 +21,9 @@
<h2>How this works</h2>
<p><b>Click twice on a sub-heading to reveal</b> the individual to-do items. Click again to hide.<br />
<p><b>Click on a sub-heading to reveal</b> the individual to-do items. Click again to hide.<br />
If a heading is in italics, then there are hidden items.
<p><b>Click on the main "How this works" heading</b> to toggle reveal/hide <b>everything.</b>
<p>Printing this page uses a much smaller font. Complain to <a href="mailto:expo-tech@lists.wookware.org">the nerd list</a> if you don't like this behaviour.
<p>Edit this page by clicking on the big blue button. It uses the same "Edit this page" function that you may have used before. Just be careful not to touch the code at the top and bottom of the page.
@ -40,12 +41,18 @@ If a heading is in italics, then there are hidden items.
<dd><!--2020-03-26 psargent-->Explain how to link a new cave into the other caves in
troggle filesystem</dd>
<dd><!--2020-03-26 psargent-->Explain how to add photos with the correct URL format to sub-HTML files attached to New Caves</dd>
<dt><!--2020-04-11 psargent-->svx check</dt>
<dt><!--2020-04-13 psargent-->svx check</dt>
<dd>explain command line to run on newly typed survex file to check for format errors '$cavern xxxx.svx'
<dd>explain when to use svxtrace.py <a href="troggle/scriptscurrent.html">current scripts</a>
<dt><!--2020-04-13 psargent-->QMs check</dt>
<dd>explain when to use svx2qm.py -> qms.csv-> tablize-qms.pl <a href="troggle/scriptscurrent.html">current scripts</a>
<dd>explain when to use find-dead-qms.py and qmreader.pl <a href="troggle/scriptscurrent.html">current scripts</a>
</dl>
<h3>Surveys data entry</h3>
<dl>
<dt><!--2020-04-13 psargent-->QMs check</dt>
<dd>Collect together the old "to do" and "readme" notes and put them in a standard place: expoweb/[year]/TODO.html(with self-edit instructionslike this page)
<dt>Write code to automatically extract ref info about wallets from tunnel xml files
<dd><!--2020-04-03 psargent-->This will replace :drawings:chk-xml.txt as used by :drawings:check-xml.sh
<dd><!--2020-04-03 psargent-->Do similar for Therion files when people start using #REF comments
@ -245,6 +252,11 @@ the original file from disc. So storing changes done by js will mean working dir
// TO DO - make the <dt> italic when any of the <dd> following it are hidden.
// Set up the click handlers:
var itemlist = document.getElementsByTagName('h2');
for (i = 0; i < itemlist.length; i++) {
itemlist[i].onclick = h2toggle;
}
var itemlist = document.getElementsByTagName('dd');
for (i = 0; i < itemlist.length; i++) {
itemlist[i].onclick = hideable;
@ -256,14 +268,14 @@ for (i = 0; i < itemlist.length; i++) {
}
function showable () {
// When clicking on a <dt> item, show or not all the following <dd> elements
if (this.style.fontStyle !== "italic") {
if (this.style.fontStyle != "italic") {
this.style.fontStyle = "italic";
} else {
this.style.fontStyle = "normal";
}
var ddO = this.nextElementSibling;
while((ddO !== null) && (ddO.nodeName.toLowerCase() == 'dd')){
if (this.style.fontStyle === "italic") {
if (this.style.fontStyle != "normal") {
ddO.style.display = 'none';
} else {
ddO.style.display = 'block';
@ -276,13 +288,34 @@ function showable () {
function hideable () {
// When clicking on a <dd> item, show or not itself
var x = this;
if (x.style.display === "none") {
if (x.style.display != "block") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
function h2toggle () {
// When clicking on a <h2> item, toggle the display of absolutely everything
var itemlist = document.getElementsByTagName('dd');
for (i = 0; i < itemlist.length; i++) {
x = itemlist[i]
if (x.style.display != "block") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
var dtlist = document.getElementsByTagName('dt');
for (i = 0; i < dtlist.length; i++) {
x = dtlist[i]
if (x.style.fontStyle != "normal") {
x.style.fontStyle = "normal";
} else {
x.style.fontStyle = "italic";
}
}
}
</script>
<hr /></body>
</html>

View File

@ -19,7 +19,7 @@
<li><a href="scriptscurrent.html#area">make-areaindices.py</a> (unmaintained?)
<li><a href="scriptscurrent.html#prosp">make-prospectingguide-new.py</a> and <a href="">prospecting_guide_short.py</a> - (unmaintained?)</li><br />
<li><a href="../bankofexpo.html">boe</a> Bank of Expo (perl) runs the accounts preceding and during expo
<li><a href="scriptscurrent.html#wallets">bierbook.tex</a> LaTeX script for generating the bierbook - a new list of names and dates each year
<li><a href="scriptscurrent.html#latex">bierbook.tex</a> LaTeX script for generating the bierbook - a new list of names and dates each year
<li><a href="scriptscurrent.html#latex">seshbook.tex</a> LaTeX script for generating the seshbook - works from the same list of names
<li><a href="scriptscurrent.html#latex">therionpage.tex</a> LaTeX script anbd makefile for generating therion-style protractors</li><br />
<li><a href="scriptscurrent.html#latex">wallets.py</a> generates statuspages and to-do list pages for survey data production.