I fixed the way that Glasseye handles sidenotes and margin notes, so that they auto-hide (with a pop-up link) when the screen is too narrow to accomodate them. Job well done.
At this point my "Glasseye" implementation is not really similar to the original code, so I've created a GitHub project for this site. In case you wanted to see how the magic happens.
I imagine that at some point I may even break that plugin out into yet another repository, because there are still some tweaks I want to make…we shall see.