Refactored machine token creation and rendering code to remove duplication.
Fixed disabled links still working due to events not attached properly.
Merge pull request #549 from huwshimi/disable-destroy-links

Disable destroy links

Fixes bug #1368592: disabled links were still working due to events being attached to click instead of listening for the fired event.

The machine token creation and rendering code has also been refactored to remove duplication and allow the event attaching code to only be added once.