Title photo
frugal technology, simple living and guerrilla large-appliance repair
Sun, 15 Jan 2017

Check out the Categories feature in the right column

I originally coded the categories listing as part of the overall Counter addin to Ode early last year, and Ode project leader Rob Reed lent his expertise to the addin, optimizing the code and squashing a few bugs in the process.

I had the categories listing in my right-hand column for a while, but since this Ode site has a LOT of directories/folders in it, that display made the right side of the page super long.

So I wanted the ability for readers to show/hide that listing. I didn't want to use jQuery, but I was very open to using vanilla JavaScript to make it happen.

And so I did. I looked at a lot of tutorials on how to hide the content of HTML divs (i.e. the stuff between a <div> and a </div>), and this one struck me as both simple and effective (meaning it's short and it works).

So now you can click Show / hide categories on the right to see the entire structure of the documents directory and drill down into topics that may be of interest.

Rob did a lot of work on my code, and I looked back at our e-mail thread from March 2016 and realized that I'm not even running the most recent version of the Counter addin on this site. Once I get that up and running, I will work on expanding the documentation on how to use the addin and then make it available to all.

Thanks go to Will Master for the JavaScript and Rob Reed for the Perl.

Once I figured out the concept of an addin (or, at any rate, my addin), I was off to the races. It was basically, "figure out what you want to display, figure out how to pull the information using Perl and the Ode addin structure, then drop tags into my Ode template to display the information."

Of course you can also say, "Here are things I can do in Perl, maybe it will be cool to put that on the web site." I guess I did a little of that, too.

However you slice it up, writing code and seeing results on a live web site is fun. In the Ode world, you can do that with HTML and CSS just like with any web site, and you can also write Perl addins. With this most recent hack (the show/hide), it was a matter of "appropriating" some vanilla JavaScript to add a feature I've been wanting for some time.