just do the same with an external js
build entire webpage in js
load scripts dynamically. Not optimal yet. Suggesting switch to require.js
make a seperate css and load css dynamically
forgot to include css
start Javascript in the Javascript
using fixed link for epubviewer's css