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

Restore create_placeholders_if_missing()#296

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
AA-Turner merged 1 commit intomainfromswitchers/placeholders
Apr 16, 2025
Merged
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
26 changes: 26 additions & 0 deletionstemplates/switchers.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,30 @@ const _CURRENT_PREFIX = (() => {
const _ALL_VERSIONS = new Map($VERSIONS);
const _ALL_LANGUAGES = new Map($LANGUAGES);

/**
* Required for Python 3.7 and earlier.
* @returns {void}
* @private
*/
const _create_placeholders_if_missing = () => {
if (document.querySelectorAll(".version_switcher_placeholder").length) return;

const items = document.querySelectorAll("body>div.related>ul>li:not(.right)");
for (const item of items) {
if (item.innerText.toLowerCase().includes("documentation")) {
const container = document.createElement("li");
container.className = "switchers";
for (const placeholder_name of ["language", "version"]) {
const placeholder = document.createElement("div");
placeholder.className = `${placeholder_name}_switcher_placeholder`;
container.appendChild(placeholder);
}
item.parentElement.insertBefore(container, item);
return;
}
}
};

/**
* @param {Map<string, string>} versions
* @returns {HTMLSelectElement}
Expand DownExpand Up@@ -175,6 +199,8 @@ const _initialise_switchers = () => {
const versions = _ALL_VERSIONS;
const languages = _ALL_LANGUAGES;

_create_placeholders_if_missing();

document
.querySelectorAll(".version_switcher_placeholder")
.forEach((placeholder) => {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp