fix possible NPE
encapsulate js, store in namespace
Merge pull request #62 from dennishendriksen/master

Protocol viewer: small bug fix + encapsulate js