Updated for Firefox

The js function ‘add_class’ now works in Firefox. The bug was related
to Firefox not being able to read the innerText property.

Other small minor improvements.