Optimize permalink control

The 'configureLayers' method has been called multiple times. These
changes make the map loading faster and prevent some side effects.
Fix 'tools' menu click and parmalink handling

Fixes #22
Refresh download layer based on its visibility