Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/browse/browse-utils.js
/** | /** | ||||
* Copyright (C) 2018-2019 The Software Heritage developers | * Copyright (C) 2018-2020 The Software Heritage developers | ||||
* See the AUTHORS file at the top-level directory of this distribution | * See the AUTHORS file at the top-level directory of this distribution | ||||
* License: GNU Affero General Public License version 3, or any later version | * License: GNU Affero General Public License version 3, or any later version | ||||
* See top-level LICENSE file for more information | * See top-level LICENSE file for more information | ||||
*/ | */ | ||||
import {BREAKPOINT_SM} from 'utils/constants'; | import {BREAKPOINT_SM} from 'utils/constants'; | ||||
$(document).ready(() => { | $(document).ready(() => { | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | $(document).ready(() => { | ||||
$('body').on('click', e => { | $('body').on('click', e => { | ||||
if ($(e.target).parents('.swh-popover').length) { | if ($(e.target).parents('.swh-popover').length) { | ||||
e.stopPropagation(); | e.stopPropagation(); | ||||
} | } | ||||
}); | }); | ||||
}); | }); | ||||
export function initBrowseNavbar() { | |||||
if (window.location.pathname === Urls.browse_origin_visits()) { | |||||
$('#swh-browse-origin-visits-nav-link').addClass('active'); | |||||
} else if (window.location.pathname === Urls.browse_origin_branches() || | |||||
window.location.pathname === Urls.browse_snapshot_branches()) { | |||||
$('#swh-browse-snapshot-branches-nav-link').addClass('active'); | |||||
} else if (window.location.pathname === Urls.browse_origin_releases() || | |||||
window.location.pathname === Urls.browse_snapshot_releases()) { | |||||
$('#swh-browse-snapshot-releases-nav-link').addClass('active'); | |||||
} else { | |||||
$('#swh-browse-code-nav-link').addClass('active'); | |||||
} | |||||
} |