Skip to content

Commit a07d567

Browse files
authored
Merge pull request #520 from windsonsea/style
Add css and js files
2 parents fe18041 + ca214d6 commit a07d567

File tree

5 files changed

+306
-1
lines changed

5 files changed

+306
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#imgBaseDiv > img {
2+
position: absolute;
3+
top: 50%;
4+
left: 50%;
5+
transform: translate(-50%, -50%);
6+
max-width: 99%;
7+
max-height: 99%;
8+
}
9+
10+
#imgBaseDiv {
11+
width: 100%;
12+
height: 100%;
13+
position: fixed;
14+
background: rgba(0, 0, 0, 0.9);
15+
top: 0;
16+
left: 0;
17+
z-index: 1050;
18+
}
19+
20+
.responsive-video-container {
21+
position: relative;
22+
margin-bottom: 1em;
23+
padding-bottom: 62.50%;
24+
height: 0;
25+
overflow: hidden;
26+
max-width: 100%;
27+
}
28+
29+
iframe:not(.giscus-frame):not(.swagger-ui-iframe),
30+
object,
31+
embed {
32+
position: absolute;
33+
top: 0;
34+
left: 0;
35+
width: 100% !important;
36+
height: 100%;
37+
}
38+
39+
.md-footer__inner {
40+
display: none
41+
}
42+
43+
/* Maximum space for text block */
44+
.md-grid {
45+
max-width: 94%; /* or 100%, if you want to stretch to full-width */
46+
}
47+
48+
49+
/*
50+
img {
51+
height: auto;
52+
width: auto;
53+
border: 1px solid #ddd;
54+
border-radius: 6px;
55+
padding: 4px;
56+
background-color: #fff;
57+
}
58+
*/
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
.tx-container {
2+
background:
3+
linear-gradient(to bottom, var(--md-primary-fg-color), #2196f3 100%, var(--md-default-bg-color) 100%)
4+
}
5+
6+
[data-md-color-scheme=slate] .tx-container {
7+
background:
8+
linear-gradient(to bottom, var(--md-primary-fg-color), #2196f3 100%, var(--md-default-bg-color) 100%)
9+
}
10+
11+
@media screen and (min-width: 60em) {
12+
.tx-container {
13+
background:
14+
url("/assets/images/wave-regular.svg") no-repeat bottom,
15+
linear-gradient(to bottom, var(--md-primary-fg-color), #2196f3 99%, var(--md-default-bg-color) 99%)
16+
}
17+
18+
[data-md-color-scheme=slate] .tx-container {
19+
background:
20+
url("/assets/images/wave-slate.svg") no-repeat bottom,
21+
linear-gradient(to bottom, var(--md-primary-fg-color), #2196f3 99%, var(--md-default-bg-color) 99%)
22+
}
23+
}
24+
25+
.tx-landing {
26+
margin: 0 .8rem;
27+
color: var(--md-primary-bg-color)
28+
}
29+
30+
.tx-landing h1 {
31+
margin-bottom: 1rem;
32+
color: currentColor;
33+
font-weight: 700
34+
}
35+
36+
@media screen and (max-width: 30em) {
37+
.tx-landing h1 {
38+
font-size: 1.4rem
39+
}
40+
}
41+
42+
.tx-landing__content p a {
43+
color: inherit;
44+
text-decoration: underline;
45+
}
46+
47+
.tx-landing__testimonials {
48+
width: 100%;
49+
text-align: center;
50+
}
51+
52+
.tx-landing__content p a:hover {
53+
color: darkblue;
54+
text-decoration: underline;
55+
}
56+
57+
.tx-landing__logos {
58+
display: flex;
59+
flex-direction: row;
60+
flex-wrap: wrap;
61+
justify-content: center;
62+
}
63+
64+
.tx-landing__logos img {
65+
height: 8vh;
66+
max-height: 81px; /* max height of images */
67+
width: auto;
68+
margin: 2vh;
69+
vertical-align: middle;
70+
}
71+
72+
.tx-landing__quotes {
73+
padding-bottom: 5em;
74+
text-align: center;
75+
}
76+
77+
@media screen and (min-width: 60em) {
78+
.tx-landing__quotes {
79+
margin: 1em 5em;
80+
}
81+
}
82+
83+
.tx-landing__quotes figure {
84+
margin: 2em auto 2em auto;
85+
}
86+
87+
.tx-landing__quote {
88+
display: flex;
89+
border-radius: 1em;
90+
padding: 1em 1em 0 1em;
91+
background: var(--md-primary-fg-color);
92+
}
93+
94+
.tx-landing__quote blockquote {
95+
border: 0;
96+
color: #fff;
97+
}
98+
99+
.tx-landing__quote a img {
100+
height: 6vh;
101+
max-height: 81px; /* max height of images */
102+
display: block;
103+
margin-left: auto;
104+
margin-right: auto;
105+
}
106+
107+
@media screen and (min-width: 60em) {
108+
.tx-container {
109+
padding-bottom: 14vw
110+
}
111+
112+
.tx-landing {
113+
display: flex;
114+
align-items: stretch
115+
}
116+
117+
.tx-landing__content {
118+
max-width: 19rem;
119+
margin-top: 3.5rem;
120+
}
121+
122+
.tx-landing__image {
123+
order: 1;
124+
width: 38rem;
125+
transform: translateX(4rem)
126+
}
127+
}
128+
129+
@media screen and (min-width: 77em) {
130+
.tx-landing__image {
131+
transform: translateX(8rem)
132+
}
133+
}
134+
135+
.tx-landing .md-button {
136+
margin-top: .5rem;
137+
margin-right: .5rem;
138+
color: var(--md-primary-bg-color)
139+
}
140+
141+
.tx-landing .md-button:hover, .tx-landing .md-button:focus {
142+
color: var(--md-default-bg-color);
143+
background-color: #8bc34a;
144+
border-color: #8bc34a
145+
}
146+
147+
.md-typeset lottie-player {
148+
max-width: 100%;
149+
height: auto;
150+
}
151+
152+
.md-announce a {
153+
color: var(--md-primary-bg-color);
154+
}
155+
156+
.md-banner a {
157+
color: var(--md-primary-bg-color);
158+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
(function () {
2+
const userSelectedLang = localStorage.getItem("userSelectedLang");
3+
const currentPath = window.location.pathname;
4+
5+
if (userSelectedLang) {
6+
if (userSelectedLang === "en" && !currentPath.startsWith("/en/")) {
7+
const newPath = "/en" + (currentPath === "/" ? "" : currentPath);
8+
window.location.replace(newPath);
9+
return;
10+
} else if (userSelectedLang === "zh" && currentPath.startsWith("/en/")) {
11+
const newPath = currentPath.replace(/^\/en/, "") || "/";
12+
window.location.replace(newPath);
13+
return;
14+
}
15+
return;
16+
}
17+
18+
const userLang = (
19+
navigator.language ||
20+
navigator.userLanguage ||
21+
"en"
22+
).toLowerCase();
23+
const langPrefix = userLang.split("-")[0];
24+
25+
if (langPrefix === "zh") {
26+
if (currentPath.startsWith("/en/")) {
27+
const newPath = currentPath.replace(/^\/en/, "") || "/";
28+
window.location.replace(newPath);
29+
}
30+
} else {
31+
if (!currentPath.startsWith("/en/")) {
32+
const newPath = "/en" + (currentPath === "/" ? "" : currentPath);
33+
window.location.replace(newPath);
34+
}
35+
}
36+
})();
37+
38+
document.addEventListener("click", function (event) {
39+
const langSwitcher = event.target.closest(".md-select__link[hreflang]");
40+
if (langSwitcher) {
41+
event.preventDefault();
42+
43+
const newLang = langSwitcher.getAttribute("hreflang");
44+
localStorage.setItem("userSelectedLang", newLang);
45+
46+
const currentPath = window.location.pathname;
47+
let newPath;
48+
49+
if (newLang === "en") {
50+
newPath = currentPath.startsWith("/en/")
51+
? currentPath
52+
: "/en" + (currentPath === "/" ? "" : currentPath);
53+
} else {
54+
newPath = currentPath.startsWith("/en/")
55+
? currentPath.replace(/^\/en/, "") || "/"
56+
: currentPath;
57+
}
58+
59+
const queryAndHash = window.location.search + window.location.hash;
60+
61+
window.location.href = newPath + queryAndHash;
62+
}
63+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
window.onload = function () {
2+
for (let item of document.getElementsByTagName("img")) {
3+
if (item.classList.contains("pass") === false) {
4+
item.setAttribute("onclick", "clickAction(this)");
5+
}
6+
}
7+
};
8+
9+
function clickAction(img) {
10+
let medusa = document.createElement("div");
11+
medusa.setAttribute("id", "imgBaseDiv");
12+
medusa.setAttribute("onclick", "closeImg()");
13+
let image = document.createElement("img");
14+
image.setAttribute("src", img.src);
15+
medusa.appendChild(image);
16+
document.body.appendChild(medusa);
17+
}
18+
19+
function closeImg() {
20+
document.getElementById("imgBaseDiv").remove();
21+
}

docs/zh/mkdocs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ plugins:
110110
extra:
111111
homepage: /
112112

113+
analytics:
114+
provider: google
115+
property: G-WDCH551J9C
116+
113117
# comments
114118
comments:
115119
enabled: true
@@ -132,7 +136,8 @@ extra:
132136

133137
# Customization Javascript
134138
extra_javascript:
135-
- static/stylesheets/zoom_image.js
139+
- stylesheets/zoom_image.js
140+
- stylesheets/language-redirect.js
136141
# - https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js # disable fix mermaid not working
137142

138143
# Customization css

0 commit comments

Comments
 (0)