mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Merge pull request #107 from radarhere/docs-activate-tab
This commit is contained in:
commit
6d90f987d1
|
@ -166,6 +166,8 @@ html_static_path = ["resources"]
|
||||||
# directly to the root of the documentation.
|
# directly to the root of the documentation.
|
||||||
# html_extra_path = []
|
# html_extra_path = []
|
||||||
|
|
||||||
|
html_css_files = ["css/dark.css"]
|
||||||
|
|
||||||
html_js_files = [
|
html_js_files = [
|
||||||
"js/activate_tab.js",
|
"js/activate_tab.js",
|
||||||
]
|
]
|
||||||
|
@ -317,10 +319,6 @@ texinfo_documents = [
|
||||||
# texinfo_no_detailmenu = False
|
# texinfo_no_detailmenu = False
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
|
||||||
app.add_css_file("css/dark.css")
|
|
||||||
|
|
||||||
|
|
||||||
linkcheck_allowed_redirects = {
|
linkcheck_allowed_redirects = {
|
||||||
r"https://www.bestpractices.dev/projects/6331": r"https://www.bestpractices.dev/en/.*",
|
r"https://www.bestpractices.dev/projects/6331": r"https://www.bestpractices.dev/en/.*",
|
||||||
r"https://badges.gitter.im/python-pillow/Pillow.svg": r"https://badges.gitter.im/repo.svg",
|
r"https://badges.gitter.im/python-pillow/Pillow.svg": r"https://badges.gitter.im/repo.svg",
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
// Based on https://stackoverflow.com/a/38241481/724176
|
// Based on https://stackoverflow.com/a/38241481/724176
|
||||||
function getOS() {
|
function getOS() {
|
||||||
const userAgent = window.navigator.userAgent,
|
const userAgent = window.navigator.userAgent,
|
||||||
platform =
|
platform = window.navigator.userAgentData?.platform || window.navigator.platform,
|
||||||
window.navigator?.userAgentData?.platform || window.navigator.platform,
|
|
||||||
macosPlatforms = ["macOS", "Macintosh", "MacIntel", "MacPPC", "Mac68K"],
|
macosPlatforms = ["macOS", "Macintosh", "MacIntel", "MacPPC", "Mac68K"],
|
||||||
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"],
|
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"];
|
||||||
iosPlatforms = ["iPhone", "iPad", "iPod"];
|
|
||||||
|
|
||||||
if (macosPlatforms.includes(platform)) {
|
if (macosPlatforms.includes(platform)) {
|
||||||
return "macOS";
|
return "macOS";
|
||||||
} else if (iosPlatforms.includes(platform)) {
|
|
||||||
return "iOS";
|
|
||||||
} else if (windowsPlatforms.includes(platform)) {
|
} else if (windowsPlatforms.includes(platform)) {
|
||||||
return "Windows";
|
return "Windows";
|
||||||
} else if (/Android/.test(userAgent)) {
|
} else if (/Android/.test(userAgent)) {
|
||||||
|
@ -18,17 +14,15 @@ function getOS() {
|
||||||
} else if (/Linux/.test(platform)) {
|
} else if (/Linux/.test(platform)) {
|
||||||
return "Linux";
|
return "Linux";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "unknown";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function activateTab(tabName) {
|
function activateTab(tabName) {
|
||||||
// Find all label elements containing the specified tab name
|
// Find all label elements with the specified tab name
|
||||||
const labels = document.querySelectorAll(".tab-label");
|
const labels = document.querySelectorAll(".tab-label");
|
||||||
|
|
||||||
labels.forEach((label) => {
|
labels.forEach((label) => {
|
||||||
if (label.textContent == tabName) {
|
if (label.textContent == tabName) {
|
||||||
// Find the associated input element using the 'for' attribute
|
// Find the associated input element using the "for" attribute
|
||||||
const tabInputId = label.getAttribute("for");
|
const tabInputId = label.getAttribute("for");
|
||||||
const tabInput = document.getElementById(tabInputId);
|
const tabInput = document.getElementById(tabInputId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user