mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-09 11:20:30 +00:00
Add jump to top button to docs
This commit is contained in:
parent
b83b6decd2
commit
c6e85d5cc0
1 changed files with 25 additions and 0 deletions
25
third_party/chibicc/dox2.c
vendored
25
third_party/chibicc/dox2.c
vendored
|
@ -588,6 +588,18 @@ static void PrintDox(struct Dox *dox, FILE *f) {
|
|||
margin-bottom: .5em;\n\
|
||||
margin-left: 1em;\n\
|
||||
}\n\
|
||||
#top {\n\
|
||||
position: fixed;\n\
|
||||
left: max(0.5rem, calc(50vw - 56ch));\n\
|
||||
bottom: 0.5rem;\n\
|
||||
width: 2rem;\n\
|
||||
height: 2rem;\n\
|
||||
opacity: 0.45;\n\
|
||||
transition: opacity 0.4s;\n\
|
||||
}\n\
|
||||
#top:hover {\n\
|
||||
opacity: 0.9;\n\
|
||||
}\n\
|
||||
#search {\n\
|
||||
top: 1ch;\n\
|
||||
right: 1ch;\n\
|
||||
|
@ -600,6 +612,11 @@ static void PrintDox(struct Dox *dox, FILE *f) {
|
|||
display: none;\n\
|
||||
}\n\
|
||||
}\n\
|
||||
@media print {\n\
|
||||
#top, #search, nav, nav.toc { \n\
|
||||
display: none;\n\
|
||||
}\n\
|
||||
}\n\
|
||||
</style>\n\
|
||||
<noscript><style>\n\
|
||||
.toc { display: block; }\n\
|
||||
|
@ -676,7 +693,15 @@ static void PrintDox(struct Dox *dox, FILE *f) {
|
|||
}
|
||||
fprintf(f, "</p></nav>\n\n");
|
||||
|
||||
// jump to top button
|
||||
fprintf(f, "\
|
||||
<a href=\"#\" id=\"top\"><svg viewBox=\"-60 -60 120 120\" stroke=\"#404040\" stroke-width=\"10\">\n\
|
||||
<title>Top of the page</title>\n\
|
||||
<circle r=\"50\" fill=\"#f6f6f6\" />\n\
|
||||
<path d=\"M-25,18l25,-40l25,40\" fill=\"none\" stroke-linecap=\"round\" />\n\
|
||||
</svg></a>");
|
||||
|
||||
// right hand column
|
||||
fprintf(f, "<main>\n");
|
||||
|
||||
// search bar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue