mirror of
https://github.com/caddyserver/website.git
synced 2025-04-26 23:16:16 -04:00
Introduce tabbed sections in Markdown, Docker docs (#310)
This commit is contained in:
parent
ed0ea7c6ff
commit
1197a29dd2
5 changed files with 178 additions and 48 deletions
|
@ -789,7 +789,49 @@ td code {
|
|||
|
||||
|
||||
|
||||
.tabs .tab-buttons {
|
||||
display: flex;
|
||||
font-size: 0;
|
||||
border-bottom: 2px solid #ccc;
|
||||
border-radius: 0.5em;
|
||||
margin: 0 16px 0 16px;
|
||||
}
|
||||
.tabs .tab-buttons button {
|
||||
font-family: inherit;
|
||||
border-radius: 0.5em 0.5em 0 0;
|
||||
background-color: transparent;
|
||||
border: 2px solid;
|
||||
border-color: transparent;
|
||||
font-size: 16px;
|
||||
margin-bottom: 0;
|
||||
margin-right: 8px;
|
||||
margin-bottom: -2px;
|
||||
transition: unset;
|
||||
transform: unset;
|
||||
}
|
||||
.tabs .tab-buttons button:hover {
|
||||
border-color: #ddd;
|
||||
border-bottom-color: #ccc;
|
||||
}
|
||||
.tabs .tab-buttons button.active {
|
||||
border-color: #ccc;
|
||||
border-bottom-color: white;
|
||||
}
|
||||
|
||||
.tabs .tab {
|
||||
border-style: solid;
|
||||
border-color: #ccc;
|
||||
border-width: 0;
|
||||
padding: 1.5rem 16px 0 20px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
.tabs .tab pre {
|
||||
padding: 0;
|
||||
}
|
||||
.tabs .tab.bordered {
|
||||
border-width: 2px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1027,4 +1069,22 @@ td code {
|
|||
td {
|
||||
border-bottom-color: #233444;
|
||||
}
|
||||
|
||||
.tabs .tab-buttons {
|
||||
border-color: #33659a;
|
||||
}
|
||||
.tabs .tab-buttons button {
|
||||
color: #bdd6f7;
|
||||
}
|
||||
.tabs .tab-buttons button:hover {
|
||||
border-color: #284c71;
|
||||
border-bottom-color: #33659a;
|
||||
}
|
||||
.tabs .tab-buttons button.active {
|
||||
border-color: #33659a;
|
||||
border-bottom-color: #051628;
|
||||
}
|
||||
.tabs .tab {
|
||||
border-color: #33659a;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,3 +34,48 @@ function moduleDocsPreview(mod, maxLen) {
|
|||
}
|
||||
return short;
|
||||
}
|
||||
|
||||
function detectPlatform() {
|
||||
// assume 32-bit linux, then change OS and architecture if justified
|
||||
var os = "linux", arch = "amd64";
|
||||
|
||||
// change os
|
||||
if (/Macintosh/i.test(navigator.userAgent)) {
|
||||
os = "darwin";
|
||||
} else if (/Windows/i.test(navigator.userAgent)) {
|
||||
os = "windows";
|
||||
} else if (/FreeBSD/i.test(navigator.userAgent)) {
|
||||
os = "freebsd";
|
||||
} else if (/OpenBSD/i.test(navigator.userAgent)) {
|
||||
os = "openbsd";
|
||||
}
|
||||
|
||||
// change architecture
|
||||
if (os == "darwin" || /amd64|x64|x86_64|Win64|WOW64|i686|64-bit/i.test(navigator.userAgent)) {
|
||||
arch = "amd64";
|
||||
} else if (/arm64/.test(navigator.userAgent)) {
|
||||
arch = "arm64";
|
||||
} else if (/ ARM| armv/.test(navigator.userAgent)) {
|
||||
arch = "arm";
|
||||
}
|
||||
|
||||
// change arm version
|
||||
if (arch == "arm") {
|
||||
var arm = "7"; // assume version 7 by default
|
||||
if (/armv6/.test(navigator.userAgent)) {
|
||||
arm = "6";
|
||||
} else if (/armv5/.test(navigator.userAgent)) {
|
||||
arm = "5";
|
||||
}
|
||||
arch += arm;
|
||||
}
|
||||
|
||||
return [os, arch];
|
||||
}
|
||||
|
||||
// Detect the platform OS, but with an allow-list of values
|
||||
// and if the value is not allowed, return the default.
|
||||
function defaultOS(allowed, def) {
|
||||
var [os] = detectPlatform();
|
||||
return allowed.includes(os) ? os : def;
|
||||
}
|
||||
|
|
|
@ -174,45 +174,8 @@ $(function() {
|
|||
// autoPlatform chooses the platform in the list that best
|
||||
// matches the user's browser, if it's available.
|
||||
function autoPlatform() {
|
||||
// assume 32-bit linux, then change OS and architecture if justified
|
||||
var os = "linux", arch = "amd64", arm = "";
|
||||
|
||||
// change os
|
||||
if (/Macintosh/i.test(navigator.userAgent)) {
|
||||
os = "darwin";
|
||||
} else if (/Windows/i.test(navigator.userAgent)) {
|
||||
os = "windows";
|
||||
} else if (/FreeBSD/i.test(navigator.userAgent)) {
|
||||
os = "freebsd";
|
||||
} else if (/OpenBSD/i.test(navigator.userAgent)) {
|
||||
os = "openbsd";
|
||||
}
|
||||
|
||||
// change architecture
|
||||
if (os == "darwin" || /amd64|x64|x86_64|Win64|WOW64|i686|64-bit/i.test(navigator.userAgent)) {
|
||||
arch = "amd64";
|
||||
} else if (/arm64/.test(navigator.userAgent)) {
|
||||
arch = "arm64";
|
||||
} else if (/ ARM| armv/.test(navigator.userAgent)) {
|
||||
arch = "arm";
|
||||
}
|
||||
|
||||
// change arm version
|
||||
if (arch == "arm") {
|
||||
arm = "7"; // assume version 7 by default
|
||||
if (/armv6/.test(navigator.userAgent)) {
|
||||
arm = "6";
|
||||
} else if (/armv5/.test(navigator.userAgent)) {
|
||||
arm = "5";
|
||||
}
|
||||
}
|
||||
|
||||
var selString = os+"-"+arch;
|
||||
if (arm != "") {
|
||||
selString += "-"+arm;
|
||||
}
|
||||
|
||||
$('#platform').val(selString);
|
||||
var [os, arch] = detectPlatform();
|
||||
$('#platform').val(os+"-"+arch);
|
||||
updatePage();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue