I've built a similar piece of javascript crypto: PasswordProtectMyFile.com. It's a single HTML page that can work with internet turned off. The ciphertext is another HTML page with all the javascript needed to decrypt itself.
It's open source: https://github.com/louissobel/ppmf