Refactored jsPlumb gadget (works with one instance of jsPlumb per gadget)