Added .reinit() function for rebuilding click listeners

reinit() can be used to rebuild click listeners, after new links were added
or link targets changed.

The script now keeps track of assigned event listeners and removes them
prior to assigning new ones, to avoid listener stacking.