References click backend: detect link clicks and send data over bridge

* fixed URI encoding in bridge communication
* copied refs extraction JS code from Android patch in progress
  at https://gerrit.wikimedia.org/r/#/c/146086/4
* sends array of HTML strings for adjacent items, and index of clicked one
* now with refs.js actually added
* added linkId and linkText arrays with the id and text of the link
* fixed link encoding bug that was hidden by old bridge bug;
  was causing all non-ASCII links to fail due to suddenly being
  given the URL-encoded data when expecting raw string!

Change-Id: I0e4ec802e7e493a2d0caa759affa8e7ed3eaa8b6
Work in progress.

Change-Id: Ie3ad35d6065c874eca0d7289cf190bc3e2bc8156