Little code fixes for UglifyJS

Hi!
Congratulation for this directive, it works fine and it's really useful! I did a little code refactoring because it was not working with minified code (UglifyJS). I also added some missing semicolons.

Thank you again!