Gallery clickfix

- move ancestor function to $ (and some fixes to it)
- allow event bubbling in the gallery lightbox info panel (fixes #6025)
test