Hexagrams from the Yijing (Book of Changes) randomized

5 Jan. 2022: UPDATE!

New Script! This one includes a hexagram image of 150pixel width, perfect for your blog sidebar. The old one (text only) still works perfectly fine.

<script type="text/javascript"> var display = " " </script><script type="text/javascript" src="https://hacks.tinekedhaeseleer.net/yijing-150.js"></script>

You can use this little script to display on your site a random Yijing (Book of Changes) hexagram, that is linked to the James Legge translation from the ctext.org website. If you refresh the page, you get a new hexagram. How cool is that?

<script type="text/javascript"> var display = " " </script><script type="text/javascript" src="https://hacks.tinekedhaeseleer.net/random-hexagrams.js"></script>

It is a Custom HTML widget in the sidebar of my website for the Magical Creatures course, in which we discuss the Book of Changes– have a look! You can also load it in its own webpage, or even inside Canvas or any other LMS (#elemess) The .js file (javascript) it uses is hosted on my bergbuilds webspace.

The “magic” behind all this comes courtesy of the one and only Laura Gibbs, aka @OnlineCrsLady and past master of randomized web content, with her handy guide on how to set up a RotateContent template spreadsheet. Once I had the spreadsheet up, I transformed the HTML table (copy-pasted from the spreadsheet) to a .js file using the RotateContent tool‘s step 4. Then I uploaded the .js file to my webspace, and copied the address into the script I already had from the Growth Mindset Cats widget. (thanks @floatingtim for guiding me through the last bits!)

The next step for me is to add a larger picture of the hexagram itself for each item. The images are available on wikimedia so if I get some time I will update the table to include a larger image of the hexagram, and some additional info in the widget itself.

My spreadsheet to generate the HTML table can be found here (Google Sheets). I would love to hear if/how you use this little piece of code, and if you make any updates to the HTML table. You can find me on twitter as @tinebeest, please @ me!

64 hexagrams 1701 text owned by Leibniz
Sixty-four hexagrams, from a book owned by Leibniz. Source: Wikipedia