Change from checking landing page by href to pathname.

Checking by href is a flawed approach due to the fact that hashes
are included in the href and will throw off the results of
returning the last block in a path. The window.location.pathname
property is a much better indicator of the current path.
This commit is contained in:
Brock Whittaker 2017-03-20 17:41:50 -07:00 committed by Tim Abbott
parent 2d4ba0fde5
commit 4b64ff3752
1 changed files with 1 additions and 1 deletions

View File

@ -111,7 +111,7 @@ var events = function () {
// get the location url like `zulipchat.com/features/`, cut off the trailing
// `/` and then split by `/` to get ["zulipchat.com", "features"], then
// pop the last element to get the current section (eg. `features`).
var location = window.location.href.replace(/\/#*$/, "").split(/\//).pop();
var location = window.location.pathname.replace(/\/#*$/, "").split(/\//).pop();
$("[on-page='" + location + "']").addClass("active");