Update popup.js

late night code that won't work and has to be simplified a lot, but hey it's code right?