Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add redirect by path for segment switch#1305

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
alinashklyar merged 4 commits intomasterfromsegment-switch-2.0
May 12, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
35 changes: 26 additions & 9 deletions_includes/scripts.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,12 +83,12 @@
</script>

<script>
window.toggleSegmentDropdown = function() {
toggleSegmentDropdown = function() {
const select = document.querySelector('.custom-select');
select.classList.toggle('open');
};

window.handleDropdownKeydown = function (event) {
handleDropdownKeydown = function (event) {
const select = document.querySelector('.custom-select');
const options = select.querySelectorAll('.option');
const isOpen = select.classList.contains('open');
Expand All@@ -110,7 +110,7 @@
}
};

window.handleOptionKeydown = function (event, option, selectedValue) {
handleOptionKeydown = function (event, option, selectedValue) {
const select = document.querySelector('.custom-select');
const options = select.querySelectorAll('.option');
const currentIndex = Array.from(options).indexOf(option);
Expand DownExpand Up@@ -140,22 +140,39 @@
}
};

window.selectSegmentOption = function(option, selectedValue) {
selectSegmentOption =asyncfunction(option, selectedValue) {
const selectDisplay = document.querySelector('.select-display');
const options = document.querySelectorAll('.option');

// Update the display text
selectDisplay.textContent = option.textContent;

const redirectMap = await fetchRedirectMap();

const currentPath = window.location.pathname;

if (selectedValue === 'enterprise') {
localStorage.setItem(enterpriseDocTypeLockKey, 'true');
location.href = `${SITE_BASE_URL}/?ent`;

const enterprisePath = Object.keys(redirectMap).find(
key => redirectMap[key] === currentPath
);

if (enterprisePath) {
window.location.href = `${SITE_BASE_URL}${enterprisePath}`;
} else {
window.location.href = `${SITE_BASE_URL}/`;
}
} else if (selectedValue === 'gitops') {
localStorage.setItem(enterpriseDocTypeLockKey, 'false');
location.href = `${SITE_BASE_URL}/${SITE_GITOPS_COLLECTION}/`;

const gitOpsPath = redirectMap[currentPath];

if (gitOpsPath) {
window.location.href = `${SITE_BASE_URL}${gitOpsPath}`;
} else {
window.location.href = `${SITE_BASE_URL}/${SITE_GITOPS_COLLECTION}/`;
}
}
};

// Close dropdown when clicking outside
document.addEventListener('click', (e) => {
const select = document.querySelector('.custom-select');
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp