I would like to develop responsive ebooks, and lucky me I found that iBook Author allows to include javascript in the books. This works through inserting the HTML widget in a small box to the text.
What is the best practice when one uses the same javascript code again and again inside the book? What if I would like to use e.g. d3.js several times to create figures? Do I need to insert it every single time to the given page, inside the given widget? Can I reuse parts of the code, store d3.js in some place, so all the widgets can use that piece of code several times on different pages?