Looking at https://commons.wikimedia.org/wiki/MediaWiki:Gadget-HotCat.js, it probably could also be vastly simplified by jQuery-fying everything, and dropping support for ancient MW versions.
Perhaps there is already an extension that does this?
-- Yuvi Panda T http://yuvi.in/blog