hints: use `window.location.href` to change current URL
authorPatrick Steinhardt <ps@pks.im>
Sat, 20 May 2017 16:49:08 +0000 (18:49 +0200)
committerPatrick Steinhardt <ps@pks.im>
Sat, 20 May 2017 16:49:08 +0000 (18:49 +0200)
commit841cb5f34af269264a755ee35d7a372e17807526
tree3388b892a17f4aaf907dfac9cf6a91af1f5c5196
parent6ff33e957e309f916a39ccb7af49e797125f01e0
hints: use `window.location.href` to change current URL

When opening a hint in the current window, we do so by emulating a
`click()` on the element that we want to switch to. This enables us to
open hints when there is no href set, e.g. when the element executes
JavaScript to change the page. Unfortunately, this method of opening
links does not work when JavaScript is disabled in the client.

If the element has a `href` attribute, we can work around this problem
by directly setting `window.location.href` to the element's reference.
Next to being a more obvious method of setting the current URL, this
also fixes hints with JavaScript disabled. Note that we still have to
keep around the old method of using `click()` on the element in case it
has no href attribute.
src/scripts/hints.js