mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 05:53:43 +00:00
hashchange: Add hash_util.get_hash_category().
This replaces hashchange.get_main_hash(), which had a slightly misleading name. Also, moving this to hash_util forces us to keep 100% coverage on it.
This commit is contained in:
@@ -2,6 +2,11 @@ var hash_util = (function () {
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.get_hash_category = function (hash) {
|
||||
// given "#streams/subscribed", returns "streams"
|
||||
return hash ? hash.replace(/^#/, "").split(/\//)[0] : "";
|
||||
};
|
||||
|
||||
// Some browsers zealously URI-decode the contents of
|
||||
// window.location.hash. So we hide our URI-encoding
|
||||
// by replacing % with . (like MediaWiki).
|
||||
|
||||
Reference in New Issue
Block a user