Added proper cleanup for the script and made bootstrap.js more generic

This has the same problems with e10s as the previous revision. Also, I
haven't tested either on mobile, so there might be some hidden
surprises there.