Rewrite the DOM to use CSS grids

This also rewrites the CSS to use CSS variables. Currently this isn't
done to codeblocks however.
This commit is contained in:
Rapptz committed 2020-05-27 23:43:58 -04:00
1 parent 0a8b87cae7
commit 4e9fdc6e4f
3 files changed
+519 -424

No files matched your search

+31 -1
View File
@@ -4,6 +4,8 @@ let activeModal = null;
let activeLink = null; let activeLink = null;
let bottomHeightThreshold, sections; let bottomHeightThreshold, sections;
let settingsModal; let settingsModal;
let hamburgerToggle;
let sidebar;
function closeModal(modal) { function closeModal(modal) {
activeModal = null; activeModal = null;
@@ -41,7 +43,35 @@ document.addEventListener('DOMContentLoaded', () => {
bottomHeightThreshold = document.documentElement.scrollHeight - 30; bottomHeightThreshold = document.documentElement.scrollHeight - 30;
sections = document.querySelectorAll('div.section'); sections = document.querySelectorAll('div.section');
settingsModal = document.querySelector('div#settings.modal') settingsModal = document.querySelector('div#settings.modal');
hamburgerToggle = document.getElementById("hamburger-toggle");
sidebar = document.getElementById("sidebar");
sidebar.addEventListener("click", (e) => {
// If we click a navigation, close the hamburger menu
if (e.target.tagName == "A" && sidebar.classList.contains("sidebar-toggle")) {
sidebar.classList.remove("sidebar-toggle");
let button = hamburgerToggle.firstElementChild;
button.classList.remove("fa-times");
button.classList.add("fa-bars");
// Scroll a little up to actually see the header
// Note: this is generally around ~55px
// A proper solution is getComputedStyle but it can be slow
// Instead let's just rely on this quirk and call it a day
// This has to be done after the browser actually processes
// the section movement
setTimeout(() => window.scrollBy(0, -100), 75);
}
})
hamburgerToggle.addEventListener("click", (e) => {
sidebar.classList.toggle("sidebar-toggle");
let button = hamburgerToggle.firstElementChild;
const isHamburger = button.classList.contains("fa-bars");
button.classList.toggle("fa-bars", !isHamburger);
button.classList.toggle("fa-times", isHamburger);
});
const tables = document.querySelectorAll('.py-attribute-table[data-move-to-id]'); const tables = document.querySelectorAll('.py-attribute-table[data-move-to-id]');
tables.forEach(table => { tables.forEach(table => {
+375 -370
View File
@@ -1,64 +1,220 @@
/* this stuff uses a couple of themes as a base with some custom stuff added /*
In particular thanks to: This theme was created from scratch.
Historically however, thanks to:
- Alabaster for being a good base - Alabaster for being a good base
- Which thanks Flask + KR theme - Which thanks Flask + KR theme
- Sphinx Readable Theme - Sphinx Readable Theme
- Which also proved to be a great base - Which also proved to be a great base
*/ */
@import url('basic.css'); /*
note: this CSS is "mobile first"
The desktop implementation is near the bottom
*/
* {
box-sizing: border-box;
}
/* CSS variables would go here */
:root {
--main-background: #fff;
--link-text: #2591c4;
--link-hover-text: #0b3a44;
--text-normal: #3e4349;
--mobile-nav-background: #000;
--mobile-nav-text: #fff;
--mobile-nav-hover-text: #fff;
--mobile-nav-header-text: #fff;
--nav-background: #fff;
--nav-text: #444;
--nav-hover-text: #444;
--nav-header-text: #333;
--search-border: #ccc;
--footer-text: #555;
--footer-link: #444;
--hr-border: #b1b4b6;
--main-big-headers-text: #212224;
--main-big-headers-border: #ddd;
--main-h5-header-text: #000;
--main-h6-header-text: #777;
--main-h4-header-border: #e5e5e5;
--header-link: #3e4349;
--header-link-hover-text: #fff;
--note-background: #eee;
--note-border: #ccc;
--warning-background: #fef9e9;
--warning-border: #fbe091;
--error-background: #ffe4e4;
--error-border: #f66;
--helpful-background: #e4f2ff;
--helpful-border: #66beff;
--codeblock-background: #f5f5f5;
--codeblock-border: #c6c9cb;
--codeblock-text: #222;
--inline-code-background: #ecf0f3;
--xref-code-background: transparent;
--api-entry-background: #f5f5f5;
--table-header-background: #f5f5f5;
--table-text: #000;
--table-border: #ddd;
--mobile-active-toc: ;
--active-toc: #dbdbdb;
}
body { body {
font-family: 'Georgia', 'Yu Gothic', 'Noto Sans CJK JP Regular', serif; font-family: 'Georgia', 'Yu Gothic', 'Noto Sans CJK JP Regular', serif;
font-size: 16px; font-size: 16px;
margin: 0; margin: 0;
padding: 0; padding: 0;
height: 100%;
background-color: var(--main-background);
color: var(--text-normal);
} }
body.sans { body.sans {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
} }
/* grid related */
.main-grid {
display: grid;
min-height: 100%;
grid-auto-rows: min-content auto min-content;
grid-template-areas:
"h"
"s"
"c"
"f";
}
.grid-item {
max-width: 100vw;
padding: 0.8em;
}
/* all URLs only show underline on hover */
a {
text-decoration: none;
color: var(--link-text);
}
a:hover {
text-decoration: underline;
color: var(--link-hover-text);
}
/* headers */
header {
grid-area: h;
font-size: 90%;
/* does not show up on mobile */
display: none;
}
/* footer stuff */
footer {
grid-area: f;
font-size: 14px;
text-align: right;
color: var(--footer-text);
}
footer a {
text-decoration: underline;
color: var(--footer-link);
}
/* sidebar stuff */
aside {
grid-area: s;
font-size: 14px;
line-height: 1.5em;
top: 0;
position: -webkit-sticky; /* safari */
position: sticky;
background-color: var(--mobile-nav-background);
color: var(--mobile-nav-text);
}
aside h3 {
color: var(--mobile-nav-header-text);
font-size: 24px;
font-weight: normal;
}
.fa-bars, .fa-times {
font-size: 2em;
}
.sidebar-toggle {
display: initial !important;
}
#sidebar {
display: none;
}
#sidebar a {
color: var(--mobile-nav-text);
}
#sidebar a:hover {
color: var(--mobile-nav-hover-text);
}
#sidebar h3 {
font-size: 24px;
margin: 0;
margin-top: 1em;
}
#sidebar ul {
list-style: none;
margin: 1em 1em 2em 0;
padding: 0;
}
#sidebar ul ul {
list-style: square;
margin: 0em;
margin-left: 1.5em;
}
#sidebar form {
margin: 1em 0;
display: flex;
align-items: baseline;
}
/* search button stuff */
.searchformwrapper > form input {
border: 1px solid var(--search-border);
padding: 0.25em;
flex-grow: 2;
}
.searchformwrapper > form input[type="submit"] {
border-left: none;
margin-right: 0.5em;
flex-grow: 8;
}
/* main content area */
main {
grid-area: c;
}
p { p {
margin-bottom: 8px; margin-bottom: 8px;
} }
div.document { /* modal stuff */
margin: 46px auto 0 auto;
max-width: 62.5%; /* page width */
}
div.body {
max-width: 960px;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 240px; /* sidebar width */
}
div.body {
background-color: #ffffff;
color: #3e4349;
padding: 0 30px 30px 30px;
}
div.footer {
color: #555;
font-size: 14px;
margin: 20px auto 30px auto;
text-align: right;
max-width: 1200px; /* page width */
}
div.footer a {
color: #444;
text-decoration: underline;
}
div.modal { div.modal {
position: fixed; position: fixed;
@@ -67,13 +223,13 @@ div.modal {
top: 0; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: auto;
background-color: rgba(0,0,0,0.4); background-color: rgba(0,0,0,0.4);
cursor: pointer; cursor: pointer;
} }
div.modal-content { div.modal-content {
background-color: #ffffff; background-color: var(--main-background);
box-shadow: 0 2px 8px rgba(0,0,0,0.54); box-shadow: 0 2px 8px rgba(0,0,0,0.54);
padding: 24px; padding: 24px;
border-radius: 4px; border-radius: 4px;
@@ -97,253 +253,156 @@ div.modal-content > span.close:focus {
color: #444; color: #444;
} }
label.toggle { /* copy button */
.relative-copy {
position: relative; position: relative;
float: right;
width: 42px;
height: 24px;
} }
label.toggle input { .copy {
opacity: 0;
width: 0;
height: 0;
}
span.toggle-slider {
position: absolute;
cursor: pointer; cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
border-radius: 12px;
transition: .4s;
}
span.toggle-slider:before {
content: "";
position: absolute; position: absolute;
left: 3px; width: 16px;
top: 3px; height: 16px;
width: 18px; top: 0px;
height: 18px; right: 0px;
border-radius: 50%; border: 1px solid var(--codeblock-border);
transition: .4s; line-height: 0.8em;
background-color: #fff; font-size: 0.9em;
box-shadow: 0px 2px 4px rgba(0,0,0,0.54); font-family: monospace;
padding-left: 0.2em;
padding-right: 0.2em;
border-radius: 0px 3px 0px 0px;
text-align: center;
} }
label.toggle input:checked + span.toggle-slider { .copy i {
background-color: #2591c4; display: inline;
} vertical-align: middle;
label.toggle input:checked + span.toggle-slider:before {
transform: translateX(18px);
}
div.related {
padding: 10px 10px;
width: 100%;
position: fixed;
top: 0;
}
div.related li.right:nth-of-type(1) {
padding-right: 13px;
}
.py-attribute-table {
flex-wrap: wrap;
}
div.sphinxsidebar {
float: left;
font-size: 14px;
line-height: 1.5em;
margin-left: -100%;
width: 240px; /* sidebar width */
}
div.sphinxsidebarwrapper {
font-size: 14px;
line-height: 1.5em;
padding: 10px 0 10px 10px;
/* sticky sidebar */
position: fixed;
width: 240px; /* sidebar width */
height: 90%;
overflow: hidden;
}
/* show scrollbar on hover */
div.sphinxsidebarwrapper:hover {
overflow: auto;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
color: #333;
font-size: 24px;
font-weight: normal;
margin: 0 0 5px 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 1.1em;
}
div.sphinxsidebar h3 a {
color: #333;
}
div.sphinxsidebar p {
color: #888;
}
div.sphinxsidebar p.searchtip {
line-height: 1.4em;
}
div.sphinxsidebar ul {
color: #000;
margin: 10px 0 20px;
padding: 0;
}
div.sphinxsidebar a {
color: #444;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: sans-serif;
font-size: 1em;
margin-top: 10px;
} }
/* -- body styles --------------------------------------------------------- */ /* -- body styles --------------------------------------------------------- */
a {
color: #2591c4;
text-decoration: none;
}
a:hover {
color: #0b3a44;
text-decoration: underline;
}
hr { hr {
border: 1px solid #b1b4b6; border: 1px solid var(--hr-border);
} }
div.body h1, main h1,
div.body h2, main h2,
div.body h3, main h3,
div.body h4, main h4,
div.body h5, main h5,
div.body h6 { font-weight: normal; } main h6 { font-weight: normal; }
div.body h1, main h1,
div.body h2, main h2,
div.body h3, main h3,
div.body h4 { color: #212224; } main h4 { color: var(--main-big-headers-text); }
div.body h5 { color: #000; } main h5 { color: var(--main-h5-header-text); }
div.body h6 { color: #777; } main h6 { color: var(--main-h6-header-text); }
div.body h1 { margin: 0 0 10px 0; } main h1 { margin: 0 0 10px 0; }
div.body h2, main h2,
div.body h3 { margin: 10px 0px 10px 0px; } main h3 { margin: 10px 0px 10px 0px; }
div.body h4, main h4,
div.body h5, main h5,
div.body h6 { margin: 20px 0px 10px 0px; } main h6 { margin: 20px 0px 10px 0px; }
div.body h1 { padding: 0 0 10px 0; } main h1 { padding: 0 0 10px 0; }
div.body h2, main h2,
div.body h3 { padding: 10px 0 10px 0; } main h3 { padding: 10px 0 10px 0; }
div.body h4 { padding: 10px 0 10px 0; } main h4 { padding: 10px 0 10px 0; }
div.body h5, main h5,
div.body h6 { padding: 10px 0 0 0; } main h6 { padding: 10px 0 0 0; }
div.body h1, main h1,
div.body h2, main h2,
div.body h3 { border-bottom: 1px solid #ddd; } main h3 { border-bottom: 1px solid var(--main-big-headers-border); }
div.body h4 { border-bottom: 1px solid #e5e5e5; } main h4 { border-bottom: 1px solid var(--main-h4-header-border); }
div.body h1 { font-size: 230%; } main h1 { font-size: 2.3em; }
div.body h2 { font-size: 180%; } main h2 { font-size: 1.8em; }
div.body h3 { font-size: 130%; } main h3 { font-size: 1.3em; }
div.body h4 { font-size: 110%; } main h4 { font-size: 1.1em; }
div.body h5 { font-size: 105%; } main h5 { font-size: 1.05em; }
div.body h6 { font-size: 100%; } main h6 { font-size: 1em; }
a.headerlink { a.headerlink {
color: #3e4349; color: var(--header-link);
font-size: 0.8em; font-size: 0.8em;
padding: 0 4px 0 4px; padding: 0 4px 0 4px;
text-decoration: none; text-decoration: none;
visibility: hidden;
} }
a.headerlink:hover { a.headerlink:hover {
background-color: #3e4349; background-color: var(--header-link);
color: #fff; color: var(--header-link-hover-text);
} }
div.body ul { h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}
main ul {
list-style: disc; list-style: disc;
margin: 1em 0; margin: 1em 0;
padding-left: 1.3em; padding-left: 1.3em;
} }
div.body ul ul, div.body ol ul { main ul ul, main ol ul {
margin: .2em 0; margin: .2em 0;
padding-left: 1.2em; padding-left: 1.2em;
} }
div.body ul li { main ul li {
padding: 2px 0; padding: 2px 0;
} }
div.body ul.search li { main ul.search li {
padding: 5px 0 5px 20px; padding: 5px 0 5px 20px;
} }
div.body ol { main ol {
counter-reset: li; counter-reset: li;
margin-left: 0; margin-left: 0;
padding-left: 0; padding-left: 0;
} }
div.body ol ol { main ol ol {
margin: .2em 0; margin: .2em 0;
} }
div.body ol > li { main ol > li {
list-style: none; list-style: none;
margin: 0 0 0 1.9em; margin: 0 0 0 1.9em;
padding: 2px 1px; padding: 2px 1px;
position: relative; position: relative;
} }
div.body ol > li:before { main ol > li::before {
content: counter(li) "."; content: counter(li) ".";
counter-increment: li; counter-increment: li;
top: -2px; top: -2px;
left: -1.9em; left: -1.1em;
width: 1.9em; width: 1.1em;
padding: 4px 0; padding: 4px 0;
position: absolute; position: absolute;
text-align: left; text-align: left;
} }
div.body p, main p,
div.body dd, main dd,
div.body li { main li {
line-height: 1.4em; line-height: 1.4em;
} }
@@ -356,22 +415,34 @@ li > blockquote {
margin: 10px; margin: 10px;
} }
/* admonitions */
div.admonition {
padding: 0.8em;
margin: 0.8em 0;
}
p.admonition-title {
display: inline;
font-weight: bold;
margin-right: 0.5em;
}
p.admonition-title::after {
content: ':';
}
div.admonition p.admonition-title + p { div.admonition p.admonition-title + p {
display: inline; display: inline;
} }
div.highlight {
background-color: #fff;
}
div.important, div.note, div.hint, div.tip { div.important, div.note, div.hint, div.tip {
background-color: #eee; background-color: var(--note-background);
border: 1px solid #ccc; border: 1px solid var(--note-border);
} }
div.attention, div.warning, div.caution, div.seealso { div.attention, div.warning, div.caution, div.seealso {
background-color: #fef9e9; background-color: var(--warning-background);
border: 1px solid #fbe091; border: 1px solid var(--warning-border);
} }
dl.field-list > dd { dl.field-list > dd {
@@ -389,7 +460,7 @@ div.topic {
/* don't link-ify the FAQ page */ /* don't link-ify the FAQ page */
a.toc-backref { a.toc-backref {
text-decoration: none; text-decoration: none;
color: #3e4349; color: var(--text-normal);
} }
/* bold and fix the Parameter, Raises, etc. */ /* bold and fix the Parameter, Raises, etc. */
@@ -409,33 +480,21 @@ a.reference.internal > strong {
} }
div.danger, div.error { div.danger, div.error {
background-color: #ffe4e4; background-color: var(--error-background);
border: 1px solid #f66; border: 1px solid var(--error-border);
}
div.admonition {
padding: 10px;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ':';
} }
/* helpful admonitions */ /* helpful admonitions */
div.helpful { div.helpful {
background-color: #e4f2ff; background-color: var(--helpful-background);
border: 1px solid #66b3ff; border: 1px solid var(--helpful-border);
} }
div.helpful > p.admonition-title { div.helpful > p.admonition-title {
display: block; display: block;
} }
div.helpful > p.admonition-title:after { div.helpful > p.admonition-title::after {
content: unset; content: unset;
} }
@@ -457,6 +516,7 @@ div.helpful > p.admonition-title:after {
/* attribute tables */ /* attribute tables */
.py-attribute-table { .py-attribute-table {
display: flex; display: flex;
flex-wrap: wrap;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
margin: 0 2em; margin: 0 2em;
@@ -467,37 +527,44 @@ div.helpful > p.admonition-title:after {
font-weight: bold; font-weight: bold;
} }
div.body .py-attribute-table-column > ul { main .py-attribute-table-column > ul {
list-style: none; list-style: none;
margin: 4px 0px; margin: 4px 0px;
padding-left: 12px; padding-left: 12px;
} }
pre { pre {
background-color: #f5f5f5; background-color: var(--codeblock-background);
border: 1px solid #C6C9CB; border: 1px solid var(--codeblock-border);
color: #222; color: var(--codeblock-text);
font-size: 0.75em; font-size: 0.75em;
line-height: 1.5em; line-height: 1.5em;
margin: 1.5em 0 1.5em 0; margin: 1.5em 0 1.5em 0;
padding: 10px; padding: 10px;
} }
pre, tt, code { pre, code {
font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.9em; font-size: 0.9em;
} }
tt, code { code {
background-color: #ecf0f3; background-color: var(--inline-code-background);
} }
tt.descname, code.descname { code.descname {
background-color: transparent;
font-weight: bold;
font-size: 0.95em; font-size: 0.95em;
} }
tt.xref, a tt, code.xref, a code { code.descclassname {
background-color: transparent;
}
code.xref, a code {
font-weight: normal; font-weight: normal;
background-color: var(--xref-code-background);
} }
span.pre { span.pre {
@@ -515,30 +582,32 @@ dl.classmethod > dt,
dl.method > dt, dl.method > dt,
dl.class > dt, dl.class > dt,
dl.exception > dt { dl.exception > dt {
background-color: #f5f5f5; background-color: var(--api-entry-background);
padding: 1px 10px; padding: 1px 10px;
} }
dd { dd {
margin-top: 10px; margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: 1.5em;
} }
.container.operations { .container.operations {
padding: 10px; padding: 10px;
border: 1px solid #ddd; border: 1px solid var(--codeblock-border);
margin-bottom: 20px; margin-bottom: 20px;
} }
.container.operations::before { .container.operations::before {
content: 'Supported Operations'; content: 'Supported Operations';
color: #212224; color: var(--main-big-headers-text);
display: block; display: block;
padding-bottom: 5px; padding-bottom: 0.5em;
} }
.container.operations > dl.describe > dt { .container.operations > dl.describe > dt {
background-color: #f8f8f8; background-color: var(--api-entry-background);
} }
table.docutils { table.docutils {
@@ -551,11 +620,11 @@ table.docutils.footnote {
table.docutils thead, table.docutils thead,
table.docutils tfoot { table.docutils tfoot {
background: #f5f5f5; background: var(--table-header-background);
} }
table.docutils thead tr th { table.docutils thead tr th {
color: #000; color: var(--table-text);
font-weight: normal; font-weight: normal;
padding: 7px 5px; padding: 7px 5px;
vertical-align: middle; vertical-align: middle;
@@ -564,13 +633,13 @@ table.docutils thead tr th {
table.docutils tbody tr th, table.docutils tbody tr th,
table.docutils tbody tr td { table.docutils tbody tr td {
border-bottom: 0; border-bottom: 0;
border-top: solid 1px #ddd; border-top: solid 1px var(--table-border);
padding: 7px 5px; padding: 7px 5px;
vertical-align: top; vertical-align: top;
} }
table.docutils tbody tr:last-child th, table.docutils tbody tr:last-child th,
table.docutils tbody tr:last-child td { table.docutils tbody tr:last-child td {
border-bottom: solid 1px #ddd; border-bottom: solid 1px var(--table-border);
} }
table.docutils thead tr td p, table.docutils thead tr td p,
@@ -596,24 +665,14 @@ table.docutils tbody tr td ol.last {
margin-bottom: 0; margin-bottom: 0;
} }
.viewcode-back {
font-family: Arial, sans-serif;
}
div.viewcode-block:target {
background-color: #fef9e9;
border-top: 1px solid #fbe091;
border-bottom: 1px solid #fbe091;
}
/* hide the welcome text */ /* hide the welcome text */
div#welcome-to-discord-py > h1 { div#welcome-to-discord-py > h1 {
display: none; display: none;
} }
.active { .active {
background-color: #dbdbdb; background-color: var(--mobile-active-toc);
border-left: 5px solid #dbdbdb; border-left: 5px solid var(--mobile-active-toc);
} }
div.code-block-caption { div.code-block-caption {
@@ -621,112 +680,58 @@ div.code-block-caption {
font-weight: bold; font-weight: bold;
} }
@media screen and (max-width: 870px) {
div.related { /* desktop stuff */
position: relative;
@media screen and (min-width: 600px) {
.main-grid {
grid-template-areas:
"h h h h h h"
"s c c c c c"
"s f f f f f";
} }
div.document { header {
margin: 10px 0 0 0; display: unset;
width: auto;
max-width: none;
} }
div.documentwrapper { aside {
float: none; top: initial;
position: initial;
background-color: var(--nav-background);
color: var(--nav-text);
} }
div.bodywrapper { aside h3 {
margin: 0; color: var(--nav-header-text);
} }
div.body { header > nav {
min-height: 0; float: right;
padding: 0 0 30px 10px;
} }
div.footer { #sidebar {
background-color: #333; display: inline-block;
color: #888; position: sticky;
margin: 0; top: 1em;
padding: 10px 20px 20px; height: calc(100vh - 1em);
text-align: left; overflow-y: auto;
width: auto;
} }
div.footer a { #sidebar a {
color: #bbb; color: var(--nav-text);
}
div.footer a:hover {
color: #fff;
}
table.docutils td {
word-break: break-all;
}
div.sphinxsidebar {
background-color: #333;
color: #fff;
float: none;
margin: 0;
padding: 10px 20px;
width: auto;
}
/* sticky sidebar */
div.sphinxsidebarwrapper {
position: relative;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4,
div.sphinxsidebar p,
div.sphinxsidebar h3 a {
color: #fff;
}
div.sphinxsidebar ul {
color: #999;
}
div.sphinxsidebar a {
color: #aaa;
}
div.sphinxsidebar a:hover {
color: #fff;
} }
.active { .active {
background-color: transparent; color: var(--active-toc);
border-left: none; }
#sidebar a:hover {
color: var(--nav-hover-text);
}
#hamburger-toggle {
display: none;
} }
} }
.relative-copy {
position: relative;
}
.copy {
cursor: pointer;
position: absolute;
width: 16px;
height: 16px;
top: 0px;
right: 0px;
border: 1px solid #C6C9CB;
line-height: 0.8em;
font-size: 0.9em;
font-family: monospace;
padding-left: 0.2em;
padding-right: 0.2em;
border-radius: 0px 3px 0px 0px;
text-align: center;
}
.copy i {
display: inline;
vertical-align: middle;
}
+113 -53
View File
@@ -1,59 +1,118 @@
{%- extends "basic/layout.html" %} <!DOCTYPE html>
<html>
{% set show_source = False %} <head>
{% set style = 'style.css' %} <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{%- block extrahead %} <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
{{ super() }} <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="{{ pathto('_static/style.css', 1)|e }}" type="text/css" />
{% endblock %} <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
{%- block css %}
{%- block relbar2 %}{% endblock %} {%- for css in css_files %}
{%- if css|attr("filename") %}
{%- block rootrellink %} {{ css_tag(css) }}
{# Perhaps override the relbar() macro to place this on the right side of the link list? #} {%- else %}
<li class="right"{% if not rellinks %} style="margin-right: 10px"{% endif %}> <link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" />
<a title="settings" accesskey="S" onclick="openModal(settingsModal);">settings</a>{{ reldelim2 }}</li> {%- endif %}
{{ super() }} {%- endfor %}
{% endblock %} {%- endblock %}
{%- block scripts %}
{% block header %} <script id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
{{ super() }} {%- for js in script_files %}
{% if pagename == 'index' %} {{ js_tag(js) }}
<div class="indexwrapper"> {%- endfor %}
{% endif %} {%- endblock %}
{% endblock %} {%- if pageurl %}
<link rel="canonical" href="{{ pageurl|e }}" />
{%- block content %} {%- endif %}
<div id="settings" class="modal" style="display: none;" onclick="if (event.target == this){ closeModal(settingsModal); }"> {%- if favicon %}
<div class="modal-content"> <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1)|e }}"/>
<span class="close" onclick="closeModal(settingsModal);" title="Close">&times;</span> {%- endif %}
<h1>Settings</h1> {%- block linktags %}
{%- if hasdoc('about') %}
<div class='setting'> <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
<h3>Use a sans-serif font: {%- endif %}
<label class="toggle" title="Use a sans serif font? Your system font will be used, falling back to `sans-serif`."> {%- if hasdoc('genindex') %}
<input type="checkbox" name="useSansFont" onclick="updateSetting(this);"> <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
<span class="toggle-slider"></span> {%- endif %}
</label> {%- if hasdoc('search') %}
</h3> <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
{%- endif %}
{%- if hasdoc('copyright') %}
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
{%- endif %}
{%- if next %}
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
{%- endif %}
{%- if prev %}
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
{%- endif %}
{%- endblock %}
{%- block extrahead %} {% endblock %}
</head>
<body>
{%- block header %}{% endblock %}
<div class="main-grid">
{#- The relative links component #}
<header class="grid-item">
<nav>
{%- for rellink in rellinks %}
<a href="{{ pathto(rellink[0])|e }}" title="{{ rellink[1]|striptags|e }}"
{{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> |
{%- endfor %}
<a title="settings" accesskey="S" onclick="openModal(settingsModal);">settings</a>
{#- No breadcrumbs. But if they're gonna appear they'll be here #}
</nav>
</header>
{#- The sidebar component #}
<aside class="grid-item">
<div id="hamburger-toggle">
<i class="fa fa-bars"></i>
</div> </div>
<div id="sidebar">
{#- This is manually unrolled from the original layout #}
{%- include "localtoc.html" %}
{%- include "searchbox.html" %}
</div>
</aside>
{#- The actual body of the contents #}
<main class="grid-item">
<div id="settings" class="modal" style="display: none;" onclick="if (event.target == this){ closeModal(settingsModal); }">
<div class="modal-content">
<span class="close" onclick="closeModal(settingsModal);" title="Close">&times;</span>
<h1>Settings</h1>
</div> <div class='setting'>
</div> <h3>Use a sans-serif font:
{{ super() }} <label class="toggle" title="Use a sans serif font? Your system font will be used, falling back to `sans-serif`.">
{% endblock %} <input type="checkbox" name="useSansFont" onclick="updateSetting(this);">
<span class="toggle-slider"></span>
</label>
</h3>
</div>
</div>
</div>
{% block body %} {% endblock %}
</main>
{%- block footer %} {%- block footer %}
<div class="footer"> <footer class="grid-item">
&copy; Copyright {{ copyright }}. {%- if show_copyright %}
{% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %} {%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- else %}
{% trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
{%- endif %}
{%- if last_updated %}
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
{%- endif %}
{%- if show_sphinx %}
{% trans sphinx_version=sphinx_version|e %}Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
{%- endif %}
</footer>
{%- endblock %}
</div> </div>
{% if pagename == 'index' %}
</div>
{% endif %}
{%- if READTHEDOCS %} {%- if READTHEDOCS %}
<script> <script>
if (typeof READTHEDOCS_DATA !== 'undefined') { if (typeof READTHEDOCS_DATA !== 'undefined') {
@@ -62,6 +121,7 @@
} }
READTHEDOCS_DATA.features.docsearch_disabled = true; READTHEDOCS_DATA.features.docsearch_disabled = true;
} }
</script> </script>
{%- endif %} {%- endif %}
{%- endblock %} </body>
</html>