Catch events only once. Remove dead code. Simplify addGadget.
Attach a file by drag & drop or click to upload