Update main.js

This is a size improvement over repeated document.querySelector calls, aiming to better shrink once passed through minifiers.
The script is small already but being a base reference, why not smaller, if it's possible keeping it clean?