Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust left nav expand level #5031

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions assets/js/developer_nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ $(document).ready(function () {
if (site_language != 'en') {
url_selected = (location.pathname.split("/")[5] || "").replace(/_/g, "");
}
var dev_selected = url_selected
var dev_selected = (url_selected
? `parent_nav_top_platformintegrationguides_${url_selected}`
: Cookies.get("__dev_selected") || "";
: Cookies.get("__dev_selected") || "").toLowerCase();
var platform_objects = $("#nav_top_platformintegrationguides > div.nav-item");
var platform_list = [];
var hide_list = [];
var show_list = [];
var select_html =
'<div id="dev_select_div"><select id="dev_select"><option value="">Select Platform</option>';
platform_objects.each(function (k) {
Expand All @@ -30,21 +32,40 @@ $(document).ready(function () {
select_html += `>${$this.text().trim()}</option>`;
if (exclusion_list.indexOf(dev_selected) === -1) {
if (dev_selected !== obj_id) {
hide(obj_id);
} else {
show(obj_id);
hide_list.push(obj_id);
}
else {
show_list.push(obj_id);
}
}
}
});

// if no platform is selected, or in the discolure menu, show all platforms
if ( !dev_selected && !url_selected || (location.pathname.indexOf('disclosures') > -1) || (location.pathname.indexOf('platform_wide') > -1) ) {
platform_objects.each(function () {
var id = $(this).attr('id');
show(id);
});
// if no platform is selected, or in the discolure menu, show all platforms
if ( !dev_selected && !url_selected || (location.pathname.indexOf('disclosures') > -1) || (location.pathname.indexOf('platform_wide') > -1) ) {
platform_objects.each(function (nav_index,nav_item) {
// var id = $(this).attr('id');
var cur_nav = $(nav_item);
if (cur_nav.length) {
var id = cur_nav.first().attr('id');
var navigation_item = $("#" + id + " a");
if (navigation_item.attr("aria-expanded") === "true"){
$('#' + navigation_item.attr('id')).trigger("click");
}
}
});
}
else {
for (let hl = 0; hl < hide_list.length; hl++) {
hide(hide_list[hl]);
}
});
for (let sl = 0; sl < show_list.length; sl++) {
show(show_list[sl]);
}
}



$("#parent_nav_top").css("width", "100%");
select_html += "</select></div>";
$("#parent_nav_home div .nav_block").append(select_html);
Expand Down Expand Up @@ -94,4 +115,5 @@ $(document).ready(function () {
navigation_id.trigger("click");
}
}

});