Move js donc into function themselves.

Then it is possible in the browser js console to get the documentation
interactively.
Merge pull request #7057 from Carreau/jsdoc

Move js doc into function themselves.