8000 Doc: Render version/language selector on Read the Docs by humitos · Pull Request #116966 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Doc: Render version/language selector on Read the Docs #116966

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

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Doc: add version/language selectors in all the placeholders
  • Loading branch information
humitos committed Apr 9, 2024
commit 893054939e98a62b4c96eb32a396778809587e7d
19 changes: 13 additions & 6 deletions Doc/tools/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,20 @@
</select>
`;

const selectVersionElement = document.querySelector("li.switchers div.version_switcher_placeholder");
selectVersionElement.innerHTML = versionSelect;
document.querySelector("li.switchers div.version_switcher_placeholder").addEventListener("change", onSwitch);
// Query all the placeholders because there are different ones for Desktop/Mobile
let placeholders = document.querySelectorAll(".version_switcher_placeholder");
for (placeholder of placeholders) {
placeholder.innerHTML = versionSelect;
let selectElement = placeholder.querySelector("select");
selectElement.addEventListener("change", onSwitch);
}

const selectLanguageElement = document.querySelector("li.switchers div.language_switcher_placeholder");
selectLanguageElement.innerHTML = languageSelect;
document.querySelector("li.switchers div.language_switcher_placeholder select").addEventListener("change", onSwitch);
placeholders = document.querySelectorAll(".language_switcher_placeholder");
for (placeholder of placeholders) {
placeholder.innerHTML = languageSelect;
let selectElement = placeholder.querySelector("select");
selectElement.addEventListener("change", onSwitch);
}
});
});
</script>
Expand Down
0