mirror of https://github.com/zulip/zulip.git
hashchange: Extract hashchanged_overlay().
This is mostly extracting the code within the `if` block, as well as setting `base`, which wasn't used elsewhere. Also, the `else` no longer calls `is_overlay_hash`, which was a redundant check.
This commit is contained in:
parent
20bbc375a5
commit
cee29483cf
|
@ -222,16 +222,9 @@ function is_overlay_hash(hash) {
|
|||
return overlay_list.indexOf(main_hash) > -1;
|
||||
}
|
||||
|
||||
function hashchanged(from_reload, e) {
|
||||
var old_hash;
|
||||
if (e) {
|
||||
old_hash = "#" + (e.oldURL || ignore.old_hash).split(/#/).slice(1).join("");
|
||||
ignore.old_hash = window.location.hash;
|
||||
}
|
||||
|
||||
function hashchanged_overlay(old_hash) {
|
||||
var base = get_main_hash(window.location.hash);
|
||||
|
||||
if (is_overlay_hash(window.location.hash)) {
|
||||
// if the old has was a standard non-ignore hash OR the ignore hash
|
||||
// base has changed, something needs to run again.
|
||||
|
||||
|
@ -260,7 +253,18 @@ function hashchanged(from_reload, e) {
|
|||
} else {
|
||||
subs.change_state(get_hash_components());
|
||||
}
|
||||
} else if (!is_overlay_hash(window.location.hash) && !ignore.flag) {
|
||||
}
|
||||
|
||||
function hashchanged(from_reload, e) {
|
||||
var old_hash;
|
||||
if (e) {
|
||||
old_hash = "#" + (e.oldURL || ignore.old_hash).split(/#/).slice(1).join("");
|
||||
ignore.old_hash = window.location.hash;
|
||||
}
|
||||
|
||||
if (is_overlay_hash(window.location.hash)) {
|
||||
hashchanged_overlay(old_hash);
|
||||
} else if (!ignore.flag) {
|
||||
overlays.close_for_hash_change();
|
||||
changing_hash = true;
|
||||
var ret = do_hashchange(from_reload);
|
||||
|
|
Loading…
Reference in New Issue