Topicmaps module: refactor plugin.js (#656).

In preparation of "Client-side Topicmaps API should have an add_topicmap() method".

See #656