Skip to content

Commit 6378778

Browse files
Jerry LiJerry Li
authored andcommitted
Merge commit 'fc506d0e2199786868a044cb984700771a11c998' as 'common'
2 parents a30d91a + fc506d0 commit 6378778

3 files changed

Lines changed: 360 additions & 0 deletions

File tree

common/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

common/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# website-common

common/templates/layout.html

Lines changed: 358 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,358 @@
1+
<!--
2+
Author: Jerry Li
3+
-->
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
8+
<head>
9+
<meta charset="UTF-8">
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11+
<meta name="color-scheme" content="light dark">
12+
<meta name="algolia-site-verification" content="9A311D0F6B2164C8" />
13+
<title>so I have this website...</title>
14+
<script src="{{ url_for('static', filename='scripts/jquery-3.7.1.min.js') }}"></script>
15+
<link rel="stylesheet" href="https://media.jerryly.cn/general.css">
16+
<link rel="stylesheet" href="{{ url_for('static', filename='styles/style.css') }}">
17+
<link rel="preconnect" href="https://rsms.me/">
18+
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
19+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@8.16.1/themes/satellite-min.css">
20+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght@100..700" />
21+
<link rel="preconnect" href="https://fonts.googleapis.com">
22+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
23+
</head>
24+
25+
<body>
26+
<header id="apostrophe">
27+
<div id="counter">
28+
<div id="counter-buttons">
29+
<span class="material-symbols-outlined counter-button" id="counter-search-button">
30+
search
31+
</span>
32+
<span class="counter-button" data-counter="home">Home</span>
33+
<span class="counter-button" data-counter="live">Live</span>
34+
<span class="counter-button" data-counter="archive">Archive</span>
35+
<span class="counter-button" data-counter="blog">Blog</span>
36+
<span class="counter-button" data-counter="demo">Demo</span>
37+
<span></span>
38+
<span class="counter-i" id="counter-i-home">Main site</span>
39+
<span class="counter-i" id="counter-i-live">News and updates</span>
40+
<span class="counter-i" id="counter-i-archive">Archived site</span>
41+
<span class="counter-i" id="counter-i-blog">Docs and notes</span>
42+
<span class="counter-i" id="counter-i-demo">Ongoing project</span>
43+
<span></span>
44+
<div class="counter-list" id="counter-list-home">
45+
<ul>
46+
<a href="https://jerryly.cn/pages/gallery">
47+
<li>
48+
Gallery
49+
</li>
50+
</a>
51+
</ul>
52+
<ul class="counter-list-main-domain">
53+
<a href="https://jerryly.cn/">
54+
<li>Go to site</li>
55+
</a>
56+
</ul>
57+
</div>
58+
<div class="counter-list" id="counter-list-live">
59+
<ul>
60+
<a href="https://live.jerryly.cn/pages/calculator">
61+
<li>
62+
Calculator
63+
</li>
64+
</a>
65+
<a href="https://live.jerryly.cn/pages/news">
66+
<li>
67+
News
68+
</li>
69+
</a>
70+
<a href="https://live.jerryly.cn/pages/site-status">
71+
<li>
72+
Site status
73+
</li>
74+
</a>
75+
</ul>
76+
<ul class="counter-list-main-domain">
77+
<a href="https://live.jerryly.cn/">
78+
<li>Go to site</li>
79+
</a>
80+
</ul>
81+
</div>
82+
<div class="counter-list" id="counter-list-archive">
83+
<ul>
84+
<a href="https://old.jerryly.cn/pages/about">
85+
<li>
86+
About
87+
</li>
88+
</a>
89+
<a href="https://old.jerryly.cn/pages/apple">
90+
<li>
91+
9:41
92+
</li>
93+
</a>
94+
<a href="https://old.jerryly.cn/pages/christmas">
95+
<li>
96+
Christmas
97+
</li>
98+
</a>
99+
<a href="https://old.jerryly.cn/pages/classical_ch">
100+
<li>
101+
Classical Chinese (Middle School)
102+
</li>
103+
</a>
104+
<a href="https://old.jerryly.cn/pages/classical_ch_sh">
105+
<li>
106+
Classical Chinese (High School)
107+
</li>
108+
</a>
109+
<a href="https://old.jerryly.cn/pages/contact">
110+
<li>
111+
Contact
112+
</li>
113+
</a>
114+
<a href="https://old.jerryly.cn/pages/develop">
115+
<li>
116+
Experiments
117+
</li>
118+
</a>
119+
<a href="https://old.jerryly.cn/pages/flashback">
120+
<li>
121+
Flashback
122+
</li>
123+
</a>
124+
<a href="https://old.jerryly.cn/pages/friends">
125+
<li>
126+
Friends
127+
</li>
128+
</a>
129+
<a href="https://old.jerryly.cn/pages/gallery">
130+
<li>
131+
Gallery
132+
</li>
133+
</a>
134+
<a href="https://old.jerryly.cn/pages/homemade_giftcard">
135+
<li>
136+
Homemade Giftcard
137+
</li>
138+
</a>
139+
<a href="https://old.jerryly.cn/pages/music">
140+
<li>
141+
Music
142+
</li>
143+
</a>
144+
<a href="https://old.jerryly.cn/pages/noticeboard">
145+
<li>
146+
Noticeboard
147+
</li>
148+
</a>
149+
<a href="https://old.jerryly.cn/pages/search">
150+
<li>
151+
Search (deprecated)
152+
</li>
153+
</a>
154+
<a href="https://old.jerryly.cn/pages/survey">
155+
<li>
156+
Survey
157+
</li>
158+
</a>
159+
<a href="https://old.jerryly.cn/pages/taylorswift">
160+
<li>
161+
Taylor Swift
162+
</li>
163+
</a>
164+
</ul>
165+
<ul class="counter-list-main-domain">
166+
<a href="https://old.jerryly.cn/">
167+
<li>Go to site</li>
168+
</a>
169+
</ul>
170+
</div>
171+
<div class="counter-list" id="counter-list-blog">
172+
<ul class="counter-list-main-domain">
173+
<a href="https://blog.jerryly.cn/">
174+
<li>Go to site</li>
175+
</a>
176+
</ul>
177+
</div>
178+
<div class="counter-list" id="counter-list-demo">
179+
<ul>
180+
<a href="https://jerrylimes.github.io/">
181+
<li>
182+
GitHub Repositories
183+
</li>
184+
</a>
185+
<a href="https://jerrylimes.github.io/shsbnu">
186+
<li>
187+
High School 70th
188+
</li>
189+
</a>
190+
</ul>
191+
<ul class="counter-list-main-domain">
192+
<a href="https://demo.jerryly.cn/">
193+
<li>Go to site</li>
194+
</a>
195+
</ul>
196+
</div>
197+
</div>
198+
</div>
199+
200+
<div id="counter-search">
201+
<div id="search"></div>
202+
<div id="hits"></div>
203+
</div>
204+
</header>
205+
<main>
206+
{% block content %}{% endblock %}
207+
</main>
208+
209+
<div id="copyright-info">
210+
<div id="watermark"></div>
211+
<div id="copyright-text">
212+
<p class="copyright-info">
213+
版权所有 © 2026 Jerry Li. All rights reserved.
214+
</p>
215+
<p class="copyright-info">
216+
网站及其全部内容使用知识共享许可协议署名-禁止演绎 4.0 国际证书。
217+
</p>
218+
<p class="copyright-info" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
219+
<a property="dct:title" rel="cc:attributionURL" href="https://jerryly.top">
220+
The website https://jerryly.top
221+
</a>
222+
by
223+
<a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://jerryly.top">
224+
Jerry Li
225+
</a>
226+
is licensed under
227+
<a href="https://creativecommons.org/licenses/by-nd/4.0/?ref=chooser-v1" target="_blank"
228+
rel="license noopener noreferrer" style="display:inline-block;">
229+
CC BY-ND 4.0.
230+
</a>
231+
</p>
232+
</div>
233+
<div>
234+
<img style="height:1.2em!important;vertical-align:text-bottom;"
235+
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" alt="">
236+
<img style="height:1.2em!important;margin-left:3px;vertical-align:text-bottom;"
237+
src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" alt="">
238+
<img style="height:1.2em!important;margin-left:3px;vertical-align:text-bottom;"
239+
src="https://mirrors.creativecommons.org/presskit/icons/nd.svg?ref=chooser-v1" alt="">
240+
<p class="copyright-info" id="footer-links">
241+
<a href="mailto:jerrylovesapple@icloud.com">
242+
<span class="material-symbols-outlined">alternate_email</span>
243+
</a>
244+
<a href="javascript:;" onclick="alert('Currently no items in test. Stay tuned!')">
245+
<span class="material-symbols-outlined">science</span>
246+
</a>
247+
<a href="https://blog.jerryly.cn/20240404.html">
248+
<span class="material-symbols-outlined">gavel</span>
249+
</a>
250+
</p>
251+
</div>
252+
</div>
253+
254+
<script src="https://cdn.jsdelivr.net/npm/algoliasearch@5.52.1/dist/lite/builds/browser.umd.js"></script>
255+
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4.96.2/dist/instantsearch.production.min.js"></script>
256+
<script>
257+
const counterNames = ["home", "live", "archive", "blog", "demo"]
258+
const mobileCounterQuery = window.matchMedia("(max-width: 1024px)");
259+
$("[data-counter]").on("click", function (event) {
260+
event.stopPropagation();
261+
const counterName = $(this).data("counter");
262+
$("#counter").addClass("expand");
263+
if (counterName === "archive") {
264+
$("#counter").addClass("further");
265+
} else {
266+
$("#counter").removeClass("further");
267+
}
268+
$("#counter-buttons").addClass("called");
269+
$(".counter-button, .counter-i, .counter-list").removeClass("called");
270+
$(this).addClass("called");
271+
$(`#counter-i-${counterName}`).addClass("called");
272+
$(`#counter-list-${counterName}`).addClass("called");
273+
if (mobileCounterQuery.matches) {
274+
counterNames.forEach((name) => {
275+
const displayValue = name === counterName ? "" : "none";
276+
$(`#counter-i-${name}`).css("display", displayValue);
277+
$(`#counter-list-${name}`).css("display", displayValue);
278+
});
279+
}
280+
});
281+
mobileCounterQuery.addEventListener("change", (event) => {
282+
if (!event.matches) {
283+
$(".counter-i, .counter-list").css("display", "");
284+
}
285+
});
286+
$(document).on("click", (event) => {
287+
const clickedInsideButton = $(event.target).closest(
288+
"#counter-buttons, .counter-button, .counter-i, .counter-list"
289+
).length > 0;
290+
if (!clickedInsideButton) {
291+
$("#counter").removeClass("expand");
292+
$("#counter").removeClass("further");
293+
$("#counter-buttons, .counter-button, .counter-i, .counter-list").removeClass("called");
294+
$(".counter-i, .counter-list").css("display", "");
295+
}
296+
});
297+
const $counterSearch = $("#counter-search");
298+
const $counterSearchButton = $("#counter-search-button");
299+
$counterSearchButton.on("click", (event) => {
300+
event.stopPropagation();
301+
$counterSearch.toggleClass("expanded");
302+
});
303+
$("#hits, #search").on("click", (event) => {
304+
event.stopPropagation();
305+
});
306+
$(document).on("click", () => {
307+
$counterSearch.removeClass("expanded");
308+
});
309+
$(document).on("keydown", (event) => {
310+
if (event.key === "Escape") {
311+
$counterSearch.removeClass("expanded");
312+
}
313+
});
314+
315+
// Algolia search
316+
const { liteClient: algoliasearch } = window["algoliasearch/lite"];
317+
const searchClient = algoliasearch(
318+
"KX9DZYTWEQ",
319+
"96c5fee5982c80cab33a0cb9f793ec7a"
320+
);
321+
const search = instantsearch({
322+
indexName: "my_crawler_pages",
323+
searchClient
324+
});
325+
search.addWidgets([
326+
instantsearch.widgets.searchBox({
327+
container: "#search",
328+
}),
329+
instantsearch.widgets.hits({
330+
container: "#hits",
331+
templates: {
332+
item(hit) {
333+
return `
334+
<a href="${hit.url}">
335+
<h3>${hit.title}</h3>
336+
<p>${hit.content || "No results."}</p>
337+
</a>
338+
`;
339+
}
340+
}
341+
})
342+
]);
343+
344+
search.on('render', () => {
345+
try {
346+
const query = search.mainIndex.getHelper().state.query || '';
347+
document.getElementById('hits').style.display = query.trim() ? 'block' : 'none';
348+
} catch (e) {
349+
// fallback: show hits
350+
document.getElementById('hits').style.display = 'block';
351+
}
352+
});
353+
354+
search.start();
355+
</script>
356+
</body>
357+
358+
</html>

0 commit comments

Comments
 (0)