fisharebest/webtrees — pull request #234 by ddrury (2014-09-04 11:57:08+00:00)
Title: Remove JS assoc with pedigree & fanchart charts from global scope

Function togglechildrenbox() is only used by pedigree.php.
Functions family_box_timeout(), clear_family_box_timeout() & show_family_box() are only used by WT/Controller/fanchart.php.
Functions MM_showHideLayers() & hide_family_box() are utility functions called by the above.

Upon inspection there were large areas of unused or unreachable code in these functions - maybe a hangover from an earlier webtrees incarnation? (e.g - show_family_box was always called with pboxid set to "relatives" therefore most of that function became redundant)

Further investigation indicated that currently their only purpose is to show/hide popup menus.

For pedigree.php it was a simple matter to replace the embedded onclick functionality with a simple bit of jQuery.

For WT/Controller/fanchart.php, this change allowed for the removal of a large number of embedded onclick, onmouseover & onmouseout events and their replacement with a bit of jQuery in fanchart.php. I also shifted some embedded css to the theme css file.

The original code enabled a menu to appear when a map segment was clicked and for that menu to disappear after a 2.5 second timeout unless the mouse remained on the map segment or hovered over the menu - this never seemed reliable to me - the menu sometimes timed out almost immediately and my replacement code didn't alter things, so I've changed the functionality. It now works as follows:-

Click on a map segment and its menu appears, click on the same map segment again and it disappears or click on another map segment for it's menu to appear, finally click on any other part of the page to remove any visible menu.