Thanks for editing my original post. Unfortunately wordpress stripped out certain code, at minimum the ids of links, at the time of posting. So whatever magic you performed to restore the links has not saved the script.
You will need to add id attributes to the links. Maybe more. You could get these from the event functions but what a drag. I’ll post the full script somewhere else later and put a link here.