added media detection function and cleaned up code
new error: at Object.<anonymous> (file:///home/mike/Documents/Workspace/reddit/js/tests.js:145:3)