Added a conditional for if the script is included in a page

This way, the script could still run via ajax and nothing really breaks. Just don't know where it'll end up down the road.