hexo-theme-linen 1.0.51 → 1.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/layout/post.ejs +2 -1
- package/package.json +1 -1
- package/scripts/custom.js +333 -0
- package/source/linen-theme/css/linen.scss +607 -0
- package/source/linen-theme/js/linen.js +321 -1
package/layout/post.ejs
CHANGED
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
</div>
|
|
40
40
|
<% } %>
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
<% const isTravelSeries = ['旅行', 'Travel'].includes(page.series); %>
|
|
43
|
+
<article id="post" class="article<%= isTravelSeries ? ' travel-post' : '' %>">
|
|
43
44
|
<h1 class="post-title"><%=page.title%><% if (page.subTitle) { %><span class="sub-title"><%=page.subTitle%></span><% } %></h1>
|
|
44
45
|
<div class="post-meta">
|
|
45
46
|
<% if (page.date && !date(page.date).startsWith('1970')) { %>
|
package/package.json
CHANGED
package/scripts/custom.js
CHANGED
|
@@ -1,3 +1,335 @@
|
|
|
1
|
+
const TRAVEL_SERIES_NAMES = ["旅行", "Travel"];
|
|
2
|
+
const TRAVEL_ROUTE_HEADING_REGEX = /^(?:路线|路线规划|Route|Route Planning)$/i;
|
|
3
|
+
const TRAVEL_ROUTE_PALETTE = [
|
|
4
|
+
"#c97a63",
|
|
5
|
+
"#a8452e",
|
|
6
|
+
"#8a9a86",
|
|
7
|
+
"#c4b7a6",
|
|
8
|
+
"#b87d56",
|
|
9
|
+
"#6d8b74",
|
|
10
|
+
"#d49a79",
|
|
11
|
+
"#9c8f84",
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
function stripHtmlTags(str) {
|
|
15
|
+
return String(str || "")
|
|
16
|
+
.replace(/<[^>]*>/g, "")
|
|
17
|
+
.trim();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function stripHeadingText(str) {
|
|
21
|
+
return stripHtmlTags(
|
|
22
|
+
String(str || "").replace(
|
|
23
|
+
/<a[^>]*class="[^"]*(?:headerlink|header-anchor)[^"]*"[^>]*>[\s\S]*?<\/a>/gi,
|
|
24
|
+
"",
|
|
25
|
+
),
|
|
26
|
+
)
|
|
27
|
+
.replace(/^[#¶\s]+|[#¶\s]+$/g, "")
|
|
28
|
+
.trim();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function escapeAttr(str) {
|
|
32
|
+
return String(str || "").replace(/[&<>"']/g, (ch) => ({
|
|
33
|
+
"&": "&",
|
|
34
|
+
"<": "<",
|
|
35
|
+
">": ">",
|
|
36
|
+
'"': """,
|
|
37
|
+
"'": "'",
|
|
38
|
+
})[ch]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function parseChineseNumeral(str) {
|
|
42
|
+
const map = {
|
|
43
|
+
半: 0.5,
|
|
44
|
+
一: 1,
|
|
45
|
+
二: 2,
|
|
46
|
+
两: 2,
|
|
47
|
+
三: 3,
|
|
48
|
+
四: 4,
|
|
49
|
+
五: 5,
|
|
50
|
+
六: 6,
|
|
51
|
+
七: 7,
|
|
52
|
+
八: 8,
|
|
53
|
+
九: 9,
|
|
54
|
+
十: 10,
|
|
55
|
+
};
|
|
56
|
+
if (str in map) return map[str];
|
|
57
|
+
if (/^十[一二三四五六七八九]$/.test(str)) {
|
|
58
|
+
return 10 + map[str[1]];
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function parseDurationFragment(text) {
|
|
64
|
+
const trimmed = String(text || "").trim();
|
|
65
|
+
if (!trimmed) return null;
|
|
66
|
+
|
|
67
|
+
// Compound: e.g. "2天1晚", "3 日 2 晚"
|
|
68
|
+
const compoundMatch = trimmed.match(
|
|
69
|
+
/^(\d+(?:\.\d+)?)\s*(日|天)\s*\d+(?:\.\d+)?\s*(?:晚|夜)$/,
|
|
70
|
+
);
|
|
71
|
+
if (compoundMatch) {
|
|
72
|
+
const value = Number(compoundMatch[1]);
|
|
73
|
+
if (Number.isFinite(value) && value > 0) {
|
|
74
|
+
return {
|
|
75
|
+
label: trimmed,
|
|
76
|
+
weight: value,
|
|
77
|
+
unitKind: "day",
|
|
78
|
+
unitText: compoundMatch[2],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Half-day forms: "半日", "半天", "half day"
|
|
84
|
+
if (/^(半日|半天|half\s+day)$/i.test(trimmed)) {
|
|
85
|
+
const isEn = /day/i.test(trimmed);
|
|
86
|
+
return {
|
|
87
|
+
label: trimmed,
|
|
88
|
+
weight: 0.5,
|
|
89
|
+
unitKind: "day",
|
|
90
|
+
unitText: isEn ? "days" : trimmed.endsWith("日") ? "日" : "天",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Chinese numeral forms: "一日", "两天", "一天半", "三日半"
|
|
95
|
+
const zhNumMatch = trimmed.match(
|
|
96
|
+
/^(十?[一二两三四五六七八九]|十)\s*(日|天|晚|夜)(半)?$/,
|
|
97
|
+
);
|
|
98
|
+
if (zhNumMatch) {
|
|
99
|
+
const base = parseChineseNumeral(zhNumMatch[1]);
|
|
100
|
+
if (base) {
|
|
101
|
+
const value = base + (zhNumMatch[3] ? 0.5 : 0);
|
|
102
|
+
const unitChar = zhNumMatch[2];
|
|
103
|
+
return {
|
|
104
|
+
label: trimmed,
|
|
105
|
+
weight: value,
|
|
106
|
+
unitKind: unitChar === "晚" || unitChar === "夜" ? "night" : "day",
|
|
107
|
+
unitText: unitChar,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Numeric forms: "2 日", "0.5 天", "5 days", "2d", "3 nights", "4 小时", "3h"
|
|
113
|
+
const numMatch = trimmed.match(
|
|
114
|
+
/^(\d+(?:\.\d+)?)\s*(日|天|晚|夜|小时|days?|nights?|hours?|hrs?|d|h)$/i,
|
|
115
|
+
);
|
|
116
|
+
if (numMatch) {
|
|
117
|
+
const value = Number(numMatch[1]);
|
|
118
|
+
const unitRaw = numMatch[2];
|
|
119
|
+
if (Number.isFinite(value) && value > 0) {
|
|
120
|
+
const lower = unitRaw.toLowerCase();
|
|
121
|
+
let unitKind = "day";
|
|
122
|
+
let unitText = unitRaw;
|
|
123
|
+
if (lower === "晚" || lower === "夜" || lower.startsWith("night")) {
|
|
124
|
+
unitKind = "night";
|
|
125
|
+
unitText = lower.startsWith("night") ? "nights" : unitRaw;
|
|
126
|
+
} else if (
|
|
127
|
+
lower === "小时" ||
|
|
128
|
+
lower.startsWith("hour") ||
|
|
129
|
+
lower.startsWith("hr") ||
|
|
130
|
+
lower === "h"
|
|
131
|
+
) {
|
|
132
|
+
unitKind = "hour";
|
|
133
|
+
unitText = lower === "小时" ? "小时" : "hours";
|
|
134
|
+
} else if (lower.startsWith("day") || lower === "d") {
|
|
135
|
+
unitKind = "day";
|
|
136
|
+
unitText = "days";
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
label: trimmed,
|
|
140
|
+
weight: value,
|
|
141
|
+
unitKind,
|
|
142
|
+
unitText,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function parseTravelRouteItem(rawHtml) {
|
|
151
|
+
let content = String(rawHtml || "").trim();
|
|
152
|
+
if (/^<p>[\s\S]*<\/p>$/i.test(content) && !/<\/p>\s*<p>/i.test(content)) {
|
|
153
|
+
content = content.replace(/^<p>|<\/p>$/gi, "").trim();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let note = "";
|
|
157
|
+
let duration = null;
|
|
158
|
+
|
|
159
|
+
// Check for trailing parenthetical: either a pure duration like "大阪(2日)" or a note like "大阪 2 日(心斋桥)"
|
|
160
|
+
const trailingParenMatch = content.match(
|
|
161
|
+
/^(.*?)[\s]*(?:(([^()]+))|\(([^()]+)\))\s*$/,
|
|
162
|
+
);
|
|
163
|
+
if (trailingParenMatch && trailingParenMatch[1].trim()) {
|
|
164
|
+
const parenInner = (
|
|
165
|
+
trailingParenMatch[2] ||
|
|
166
|
+
trailingParenMatch[3] ||
|
|
167
|
+
""
|
|
168
|
+
).trim();
|
|
169
|
+
const parenDuration = parseDurationFragment(parenInner);
|
|
170
|
+
if (parenDuration) {
|
|
171
|
+
duration = parenDuration;
|
|
172
|
+
content = trailingParenMatch[1].trim();
|
|
173
|
+
} else {
|
|
174
|
+
note = parenInner;
|
|
175
|
+
content = trailingParenMatch[1].trim();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Extract trailing duration from the remaining content if not yet parsed
|
|
180
|
+
if (!duration) {
|
|
181
|
+
const tailMatch = content.match(
|
|
182
|
+
/^(.*?)(?:[\s·•\-—::,,/]+)(\d+(?:\.\d+)?\s*(?:日|天)\s*\d+(?:\.\d+)?\s*(?:晚|夜)|\d+(?:\.\d+)?\s*(?:日|天|晚|夜|小时|days?|nights?|hours?|hrs?|d|h)|(?:半日|半天|half\s+day)|(?:十?[一二两三四五六七八九]|十)\s*(?:日|天|晚|夜)(?:半)?)\s*$/i,
|
|
183
|
+
);
|
|
184
|
+
if (tailMatch && tailMatch[1].trim()) {
|
|
185
|
+
const parsed = parseDurationFragment(tailMatch[2]);
|
|
186
|
+
if (parsed) {
|
|
187
|
+
duration = parsed;
|
|
188
|
+
content = tailMatch[1].trim();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Fallback for no-space CJK place + duration, e.g. "大阪2日", "京都5天", "宇治半日"
|
|
194
|
+
if (!duration) {
|
|
195
|
+
const compactMatch = content.match(
|
|
196
|
+
/^(.*?)(\d+(?:\.\d+)?\s*(?:日|天)\s*\d+(?:\.\d+)?\s*(?:晚|夜)|\d+(?:\.\d+)?\s*(?:日|天|晚|夜|小时)|半日|半天)$/,
|
|
197
|
+
);
|
|
198
|
+
if (compactMatch && compactMatch[1].trim()) {
|
|
199
|
+
const parsed = parseDurationFragment(compactMatch[2]);
|
|
200
|
+
if (parsed) {
|
|
201
|
+
duration = parsed;
|
|
202
|
+
content = compactMatch[1].trim();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const place = content.replace(/[\s·•\-—::,,/]+$/, "").trim();
|
|
208
|
+
if (!place) {
|
|
209
|
+
return {
|
|
210
|
+
place: rawHtml.trim(),
|
|
211
|
+
duration: null,
|
|
212
|
+
note: "",
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return { place, duration, note };
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function getRouteGridCols(count) {
|
|
220
|
+
if (count <= 2) return 2;
|
|
221
|
+
if (count === 3 || count === 5 || count === 6 || count === 9) return 3;
|
|
222
|
+
return 4;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function buildTravelRouteBlock(listHtml, isEnglishPost) {
|
|
226
|
+
const innerListHtml = listHtml
|
|
227
|
+
.replace(/^<(?:ul|ol)[^>]*>/i, "")
|
|
228
|
+
.replace(/<\/(?:ul|ol)>\s*$/i, "");
|
|
229
|
+
|
|
230
|
+
// Skip lists containing nested lists or block-level media/containers
|
|
231
|
+
if (
|
|
232
|
+
/<(?:ul|ol|img|iframe|table|pre|blockquote|figure)\b/i.test(innerListHtml)
|
|
233
|
+
) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const liMatches = [...innerListHtml.matchAll(/<li[^>]*>([\s\S]*?)<\/li>/gi)];
|
|
238
|
+
if (liMatches.length < 2) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const stops = liMatches.map((m) => parseTravelRouteItem(m[1]));
|
|
243
|
+
const stopsWithDuration = stops.filter((s) => s.duration);
|
|
244
|
+
const showBar = stopsWithDuration.length >= 2;
|
|
245
|
+
const cols = getRouteGridCols(stops.length);
|
|
246
|
+
|
|
247
|
+
// Build proportion bar (only segments with parsed durations)
|
|
248
|
+
let barHtml = "";
|
|
249
|
+
let summaryHtml = "";
|
|
250
|
+
|
|
251
|
+
if (showBar) {
|
|
252
|
+
const unitKinds = new Set(stopsWithDuration.map((s) => s.duration.unitKind));
|
|
253
|
+
const segmentsHtml = stops
|
|
254
|
+
.map((stop, idx) => {
|
|
255
|
+
if (!stop.duration) return "";
|
|
256
|
+
const color = TRAVEL_ROUTE_PALETTE[idx % TRAVEL_ROUTE_PALETTE.length];
|
|
257
|
+
let flexWeight = stop.duration.weight;
|
|
258
|
+
if (unitKinds.size > 1 && stop.duration.unitKind === "hour") {
|
|
259
|
+
flexWeight = Math.max(stop.duration.weight / 24, 0.25);
|
|
260
|
+
}
|
|
261
|
+
const tip = escapeAttr(
|
|
262
|
+
`${stripHtmlTags(stop.place)} · ${stop.duration.label}`,
|
|
263
|
+
);
|
|
264
|
+
return `<span class="travel-route-seg" style="flex:${flexWeight};--stop-color:${color};" title="${tip}"></span>`;
|
|
265
|
+
})
|
|
266
|
+
.join("");
|
|
267
|
+
|
|
268
|
+
barHtml = `<div class="travel-route-bar" aria-hidden="true">${segmentsHtml}</div>`;
|
|
269
|
+
|
|
270
|
+
// Build subtle summary when all durations share the same unit kind (day or night)
|
|
271
|
+
if (
|
|
272
|
+
stopsWithDuration.length === stops.length &&
|
|
273
|
+
unitKinds.size === 1 &&
|
|
274
|
+
(unitKinds.has("day") || unitKinds.has("night"))
|
|
275
|
+
) {
|
|
276
|
+
const total = Number(
|
|
277
|
+
stopsWithDuration
|
|
278
|
+
.reduce((sum, s) => sum + s.duration.weight, 0)
|
|
279
|
+
.toFixed(2),
|
|
280
|
+
);
|
|
281
|
+
const firstUnit = stopsWithDuration[0].duration.unitText;
|
|
282
|
+
const useEnglish = isEnglishPost || /^[a-z]+$/i.test(firstUnit);
|
|
283
|
+
const summaryText = useEnglish
|
|
284
|
+
? `${stops.length} STOPS · ${total} ${firstUnit.toUpperCase()}`
|
|
285
|
+
: `${stops.length} 站 · 共 ${total} ${firstUnit}`;
|
|
286
|
+
summaryHtml = `<div class="travel-route-summary">${summaryText}</div>`;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const itemsHtml = stops
|
|
291
|
+
.map((stop, idx) => {
|
|
292
|
+
const color = TRAVEL_ROUTE_PALETTE[idx % TRAVEL_ROUTE_PALETTE.length];
|
|
293
|
+
const num = String(idx + 1).padStart(2, "0");
|
|
294
|
+
const durationHtml = stop.duration
|
|
295
|
+
? `<span class="travel-route-days">${stop.duration.label}</span>`
|
|
296
|
+
: "";
|
|
297
|
+
const noteHtml = stop.note
|
|
298
|
+
? `<span class="travel-route-note">${stop.note}</span>`
|
|
299
|
+
: "";
|
|
300
|
+
|
|
301
|
+
return `<li class="travel-route-item" style="--stop-color:${color};"><div class="travel-route-item-top"><span class="travel-route-index">${num}</span><span class="travel-route-dot" aria-hidden="true"></span></div><div class="travel-route-place">${stop.place}</div>${durationHtml}${noteHtml}</li>`;
|
|
302
|
+
})
|
|
303
|
+
.join("");
|
|
304
|
+
|
|
305
|
+
return `<div class="travel-route-block${showBar ? " has-bar" : ""}" style="--route-cols:${cols};">${summaryHtml}${barHtml}<ul class="travel-route-grid">${itemsHtml}</ul></div>`;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function processTravelRoute(content, data) {
|
|
309
|
+
if (!content || !TRAVEL_SERIES_NAMES.includes(data?.series)) {
|
|
310
|
+
return content;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const isEnglishPost =
|
|
314
|
+
data?.series === "Travel" ||
|
|
315
|
+
String(data?.language || data?.lang || "").startsWith("en");
|
|
316
|
+
|
|
317
|
+
return content.replace(
|
|
318
|
+
/(<h([23])[^>]*>([\s\S]*?)<\/h\2>)((?:\s|<!--[\s\S]*?-->|<div\s+id="gitalk-initiator"[^>]*><\/div>)*)(<(ul|ol)[^>]*>[\s\S]*?<\/\6>)/gi,
|
|
319
|
+
(fullMatch, headingHtml, _level, headingInner, betweenHtml, listHtml) => {
|
|
320
|
+
const headingText = stripHeadingText(headingInner);
|
|
321
|
+
if (!TRAVEL_ROUTE_HEADING_REGEX.test(headingText)) {
|
|
322
|
+
return fullMatch;
|
|
323
|
+
}
|
|
324
|
+
const routeBlock = buildTravelRouteBlock(listHtml, isEnglishPost);
|
|
325
|
+
if (!routeBlock) {
|
|
326
|
+
return fullMatch;
|
|
327
|
+
}
|
|
328
|
+
return `${headingHtml}${betweenHtml}${routeBlock}`;
|
|
329
|
+
},
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
|
|
1
333
|
function processCodeBlock(content) {
|
|
2
334
|
return content.replace(
|
|
3
335
|
/<\/figure>/g,
|
|
@@ -32,6 +364,7 @@ hexo.extend.filter.register(
|
|
|
32
364
|
"after_post_render",
|
|
33
365
|
function (data) {
|
|
34
366
|
data.content = processCodeBlock(data.content);
|
|
367
|
+
data.content = processTravelRoute(data.content, data);
|
|
35
368
|
data.content = process.call(this, data.content);
|
|
36
369
|
return data;
|
|
37
370
|
},
|
|
@@ -39,6 +39,22 @@
|
|
|
39
39
|
font-display: swap;
|
|
40
40
|
unicode-range: U+4E00-9FFF, U+3000-303F, U+FF00-FFEF;
|
|
41
41
|
}
|
|
42
|
+
@font-face {
|
|
43
|
+
font-family: "source han serif cn";
|
|
44
|
+
src:
|
|
45
|
+
local("STSongti-SC-Black"),
|
|
46
|
+
local("Songti SC Black"),
|
|
47
|
+
local("SongtiSC-Black"),
|
|
48
|
+
local("Source Han Serif SC Heavy"),
|
|
49
|
+
local("Source Han Serif SC Bold"),
|
|
50
|
+
local("Source Han Serif CN Bold"),
|
|
51
|
+
url("../fonts/SourceHanSerifSC-Bold.woff2?v=#{$font-version}") format("woff2");
|
|
52
|
+
|
|
53
|
+
font-weight: 800 900;
|
|
54
|
+
font-style: normal;
|
|
55
|
+
font-display: swap;
|
|
56
|
+
unicode-range: U+4E00-9FFF, U+3000-303F, U+FF00-FFEF;
|
|
57
|
+
}
|
|
42
58
|
@font-face {
|
|
43
59
|
font-family: "LXGWWenKai";
|
|
44
60
|
font-display: swap;
|
|
@@ -640,6 +656,597 @@ body {
|
|
|
640
656
|
color: #000;
|
|
641
657
|
}
|
|
642
658
|
}
|
|
659
|
+
&.travel-post {
|
|
660
|
+
#page-content {
|
|
661
|
+
counter-reset: travel-h2;
|
|
662
|
+
|
|
663
|
+
h2#to-page-top,
|
|
664
|
+
h2.to-page-top {
|
|
665
|
+
height: 0;
|
|
666
|
+
min-height: 0;
|
|
667
|
+
margin: 0;
|
|
668
|
+
padding: 0;
|
|
669
|
+
overflow: hidden;
|
|
670
|
+
font-size: 0;
|
|
671
|
+
line-height: 0;
|
|
672
|
+
border: none;
|
|
673
|
+
pointer-events: none;
|
|
674
|
+
|
|
675
|
+
&::before,
|
|
676
|
+
&::after {
|
|
677
|
+
content: none;
|
|
678
|
+
display: none;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
h2:not(#to-page-top):not(.to-page-top):not(.hidden) {
|
|
683
|
+
@include sourceSerifFont;
|
|
684
|
+
counter-increment: travel-h2;
|
|
685
|
+
display: block;
|
|
686
|
+
width: 100%;
|
|
687
|
+
box-sizing: border-box;
|
|
688
|
+
position: relative;
|
|
689
|
+
margin: 2.5em auto 1.35em;
|
|
690
|
+
padding: 0.25em 0.5em;
|
|
691
|
+
text-align: center;
|
|
692
|
+
font-size: 1.53em;
|
|
693
|
+
font-weight: 900;
|
|
694
|
+
line-height: 1.35;
|
|
695
|
+
letter-spacing: 0.08em;
|
|
696
|
+
color: #1d1d1d;
|
|
697
|
+
word-break: normal;
|
|
698
|
+
overflow-wrap: break-word;
|
|
699
|
+
text-wrap: balance;
|
|
700
|
+
border-radius: 4px;
|
|
701
|
+
scroll-margin-top: 1.4em;
|
|
702
|
+
transition: opacity 0.2s ease;
|
|
703
|
+
|
|
704
|
+
&:first-child {
|
|
705
|
+
margin-top: 1.4em;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
&::before {
|
|
709
|
+
content: "✦ " counter(travel-h2, decimal-leading-zero);
|
|
710
|
+
position: static;
|
|
711
|
+
left: auto;
|
|
712
|
+
top: auto;
|
|
713
|
+
transform: none;
|
|
714
|
+
display: block;
|
|
715
|
+
width: fit-content;
|
|
716
|
+
height: auto;
|
|
717
|
+
margin: 0 auto 10px;
|
|
718
|
+
padding: 0 calc(34px - 0.16em) 0 34px;
|
|
719
|
+
font-family: $linkFontFamily;
|
|
720
|
+
font-size: 11px;
|
|
721
|
+
font-weight: 500;
|
|
722
|
+
line-height: 1;
|
|
723
|
+
letter-spacing: 0.16em;
|
|
724
|
+
color: #a8452e;
|
|
725
|
+
opacity: 1;
|
|
726
|
+
background:
|
|
727
|
+
linear-gradient(rgba(168, 69, 46, 0.35), rgba(168, 69, 46, 0.35))
|
|
728
|
+
left center / 24px 1px no-repeat,
|
|
729
|
+
linear-gradient(rgba(168, 69, 46, 0.35), rgba(168, 69, 46, 0.35))
|
|
730
|
+
right center / 24px 1px no-repeat;
|
|
731
|
+
transition:
|
|
732
|
+
background-size 0.3s ease,
|
|
733
|
+
opacity 0.25s ease;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
&::after {
|
|
737
|
+
content: "";
|
|
738
|
+
display: block;
|
|
739
|
+
width: 22px;
|
|
740
|
+
height: 1.5px;
|
|
741
|
+
margin: 12px auto 0;
|
|
742
|
+
background-color: rgba(35, 35, 35, 0.22);
|
|
743
|
+
transition:
|
|
744
|
+
width 0.3s ease,
|
|
745
|
+
background-color 0.3s ease;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
&:hover {
|
|
749
|
+
opacity: 0.78;
|
|
750
|
+
|
|
751
|
+
&::before {
|
|
752
|
+
opacity: 1;
|
|
753
|
+
transform: none;
|
|
754
|
+
background-size:
|
|
755
|
+
28px 1px,
|
|
756
|
+
28px 1px;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
&::after {
|
|
760
|
+
width: 32px;
|
|
761
|
+
background-color: rgba(168, 69, 46, 0.55);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
h2#to-page-top + h2:not(#to-page-top):not(.to-page-top):not(.hidden),
|
|
767
|
+
h2.to-page-top + h2:not(#to-page-top):not(.to-page-top):not(.hidden) {
|
|
768
|
+
margin-top: 1.4em;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
p:has(.image-grid, .lazyload-outer-wrap, img)
|
|
772
|
+
+ h2:not(#to-page-top):not(.to-page-top):not(.hidden),
|
|
773
|
+
.image-grid + h2:not(#to-page-top):not(.to-page-top):not(.hidden),
|
|
774
|
+
figure + h2:not(#to-page-top):not(.to-page-top):not(.hidden) {
|
|
775
|
+
margin-top: 2.9em;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
h3 {
|
|
779
|
+
@include sourceSerifFont;
|
|
780
|
+
position: relative;
|
|
781
|
+
display: flex;
|
|
782
|
+
align-items: center;
|
|
783
|
+
width: 100%;
|
|
784
|
+
box-sizing: border-box;
|
|
785
|
+
margin: 1.9em 0 0.85em;
|
|
786
|
+
padding: 0;
|
|
787
|
+
font-size: 1.18em;
|
|
788
|
+
font-weight: 900;
|
|
789
|
+
line-height: 1.45;
|
|
790
|
+
letter-spacing: 0.04em;
|
|
791
|
+
color: $darkText;
|
|
792
|
+
word-break: normal;
|
|
793
|
+
overflow-wrap: break-word;
|
|
794
|
+
border-radius: 3px;
|
|
795
|
+
scroll-margin-top: 1.2em;
|
|
796
|
+
transition: opacity 0.2s ease;
|
|
797
|
+
|
|
798
|
+
&::before {
|
|
799
|
+
content: "✦";
|
|
800
|
+
position: static;
|
|
801
|
+
left: auto;
|
|
802
|
+
top: auto;
|
|
803
|
+
transform: none;
|
|
804
|
+
display: inline-block;
|
|
805
|
+
width: auto;
|
|
806
|
+
height: auto;
|
|
807
|
+
margin-right: 9px;
|
|
808
|
+
font-size: 10px;
|
|
809
|
+
font-weight: 400;
|
|
810
|
+
line-height: 1;
|
|
811
|
+
color: rgba(168, 69, 46, 0.78);
|
|
812
|
+
background-image: none;
|
|
813
|
+
background-color: transparent;
|
|
814
|
+
opacity: 1;
|
|
815
|
+
flex-shrink: 0;
|
|
816
|
+
transition:
|
|
817
|
+
color 0.25s ease,
|
|
818
|
+
transform 0.25s ease,
|
|
819
|
+
opacity 0.25s ease;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
&::after {
|
|
823
|
+
content: "";
|
|
824
|
+
flex: 1;
|
|
825
|
+
min-width: 0;
|
|
826
|
+
height: 1px;
|
|
827
|
+
margin-left: 12px;
|
|
828
|
+
background: linear-gradient(
|
|
829
|
+
to right,
|
|
830
|
+
rgba(0, 0, 0, 0.08),
|
|
831
|
+
transparent 65%
|
|
832
|
+
);
|
|
833
|
+
transition: background 0.25s ease;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
&:hover {
|
|
837
|
+
opacity: 0.78;
|
|
838
|
+
|
|
839
|
+
&::before {
|
|
840
|
+
opacity: 1;
|
|
841
|
+
transform: scale(1.15);
|
|
842
|
+
color: #a8452e;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
&::after {
|
|
846
|
+
background: linear-gradient(
|
|
847
|
+
to right,
|
|
848
|
+
rgba(168, 69, 46, 0.25),
|
|
849
|
+
transparent 75%
|
|
850
|
+
);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
p:has(.image-grid, .lazyload-outer-wrap, img) + h3,
|
|
856
|
+
.image-grid + h3,
|
|
857
|
+
figure + h3 {
|
|
858
|
+
margin-top: 2.2em;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
h4 {
|
|
862
|
+
@include sourceSerifFont;
|
|
863
|
+
display: flex;
|
|
864
|
+
align-items: center;
|
|
865
|
+
width: 100%;
|
|
866
|
+
box-sizing: border-box;
|
|
867
|
+
margin: 1.55em 0 0.7em;
|
|
868
|
+
font-size: 1.04em;
|
|
869
|
+
font-weight: 900;
|
|
870
|
+
line-height: 1.5;
|
|
871
|
+
letter-spacing: 0.03em;
|
|
872
|
+
color: #2c2c2c;
|
|
873
|
+
word-break: normal;
|
|
874
|
+
overflow-wrap: break-word;
|
|
875
|
+
|
|
876
|
+
&::before {
|
|
877
|
+
content: "✦";
|
|
878
|
+
display: inline-block;
|
|
879
|
+
margin-right: 8px;
|
|
880
|
+
font-size: 8.5px;
|
|
881
|
+
font-weight: 400;
|
|
882
|
+
line-height: 1;
|
|
883
|
+
color: rgba(168, 69, 46, 0.55);
|
|
884
|
+
flex-shrink: 0;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
&::after {
|
|
888
|
+
content: "";
|
|
889
|
+
flex: 1;
|
|
890
|
+
min-width: 0;
|
|
891
|
+
height: 1px;
|
|
892
|
+
margin-left: 10px;
|
|
893
|
+
background: linear-gradient(
|
|
894
|
+
to right,
|
|
895
|
+
rgba(0, 0, 0, 0.06),
|
|
896
|
+
transparent 48%
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
p:has(.image-grid, .lazyload-outer-wrap, img) + h4,
|
|
902
|
+
.image-grid + h4,
|
|
903
|
+
figure + h4 {
|
|
904
|
+
margin-top: 1.85em;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
h5,
|
|
908
|
+
h6 {
|
|
909
|
+
@include sourceSerifFont;
|
|
910
|
+
letter-spacing: 0.03em;
|
|
911
|
+
color: $darkText;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
table:not(:where(.highlight table)) {
|
|
915
|
+
width: 100%;
|
|
916
|
+
margin: 1.6em 0;
|
|
917
|
+
border: none;
|
|
918
|
+
border-top: 1px dashed rgba(168, 69, 46, 0.42);
|
|
919
|
+
border-bottom: 1px dashed rgba(168, 69, 46, 0.42);
|
|
920
|
+
border-collapse: collapse;
|
|
921
|
+
border-spacing: 0;
|
|
922
|
+
font-variant-numeric: tabular-nums;
|
|
923
|
+
font-size: 0.9em;
|
|
924
|
+
line-height: 1.65;
|
|
925
|
+
|
|
926
|
+
thead tr,
|
|
927
|
+
tr:nth-child(even) {
|
|
928
|
+
background-color: transparent;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
thead tr {
|
|
932
|
+
font-family: inherit;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
td:not(:last-child),
|
|
936
|
+
th:not(:last-child) {
|
|
937
|
+
border-right: none;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
th,
|
|
941
|
+
td {
|
|
942
|
+
padding: 0.7em 0.75em;
|
|
943
|
+
word-break: normal;
|
|
944
|
+
overflow-wrap: break-word;
|
|
945
|
+
|
|
946
|
+
&:first-child {
|
|
947
|
+
padding-left: 0.25em;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
&:last-child {
|
|
951
|
+
padding-right: 0.25em;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
thead th {
|
|
956
|
+
@include defaultFont;
|
|
957
|
+
padding-top: 0.68em;
|
|
958
|
+
padding-bottom: 0.68em;
|
|
959
|
+
font-size: 0.82em;
|
|
960
|
+
font-weight: 600;
|
|
961
|
+
letter-spacing: 0.08em;
|
|
962
|
+
color: $moreGrayText;
|
|
963
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
964
|
+
background-color: transparent;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
tbody tr {
|
|
968
|
+
transition: background-color 0.2s ease;
|
|
969
|
+
|
|
970
|
+
&:hover {
|
|
971
|
+
background-color: rgba(168, 69, 46, 0.025);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
&:last-child td {
|
|
975
|
+
border-bottom: none;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
tbody td {
|
|
980
|
+
color: #2b2b2b;
|
|
981
|
+
border-bottom: 1px dashed rgba(0, 0, 0, 0.09);
|
|
982
|
+
|
|
983
|
+
&:first-child {
|
|
984
|
+
color: #a8452e;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
.travel-route-block {
|
|
990
|
+
max-width: 640px;
|
|
991
|
+
margin: 1.4em auto 2em;
|
|
992
|
+
|
|
993
|
+
.travel-route-summary {
|
|
994
|
+
margin-bottom: 9px;
|
|
995
|
+
text-align: right;
|
|
996
|
+
font-family: $linkFontFamily, "SF Pro Text", -apple-system, sans-serif;
|
|
997
|
+
font-size: 11px;
|
|
998
|
+
line-height: 1;
|
|
999
|
+
letter-spacing: 0.1em;
|
|
1000
|
+
color: $moreGrayText;
|
|
1001
|
+
font-variant-numeric: tabular-nums;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
.travel-route-bar {
|
|
1005
|
+
display: flex;
|
|
1006
|
+
height: 8px;
|
|
1007
|
+
border-radius: 999px;
|
|
1008
|
+
overflow: hidden;
|
|
1009
|
+
gap: 2px;
|
|
1010
|
+
margin-bottom: 16px;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
.travel-route-seg {
|
|
1014
|
+
height: 100%;
|
|
1015
|
+
min-width: 6px;
|
|
1016
|
+
border-radius: 2px;
|
|
1017
|
+
background-color: var(--stop-color, #a8452e);
|
|
1018
|
+
transition:
|
|
1019
|
+
opacity 0.2s ease,
|
|
1020
|
+
transform 0.2s ease;
|
|
1021
|
+
|
|
1022
|
+
&:hover {
|
|
1023
|
+
opacity: 0.85;
|
|
1024
|
+
transform: scaleY(1.25);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
.travel-route-grid {
|
|
1029
|
+
list-style: none;
|
|
1030
|
+
margin: 0;
|
|
1031
|
+
padding: 0;
|
|
1032
|
+
display: grid;
|
|
1033
|
+
grid-template-columns: repeat(var(--route-cols, 4), minmax(0, 1fr));
|
|
1034
|
+
gap: 10px 14px;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
.travel-route-item {
|
|
1038
|
+
list-style: none;
|
|
1039
|
+
margin: 0;
|
|
1040
|
+
padding: 9px 10px 8px;
|
|
1041
|
+
border-top: 1px dashed rgba(0, 0, 0, 0.11);
|
|
1042
|
+
display: flex;
|
|
1043
|
+
flex-direction: column;
|
|
1044
|
+
gap: 3px;
|
|
1045
|
+
transition:
|
|
1046
|
+
border-top-color 0.2s ease,
|
|
1047
|
+
background-color 0.2s ease;
|
|
1048
|
+
|
|
1049
|
+
&:hover {
|
|
1050
|
+
border-top-color: var(--stop-color, #a8452e);
|
|
1051
|
+
background-color: rgba(168, 69, 46, 0.025);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
.travel-route-item-top {
|
|
1056
|
+
display: flex;
|
|
1057
|
+
align-items: center;
|
|
1058
|
+
justify-content: space-between;
|
|
1059
|
+
margin-bottom: 1px;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
.travel-route-index {
|
|
1063
|
+
font-family: $linkFontFamily;
|
|
1064
|
+
font-size: 10px;
|
|
1065
|
+
line-height: 1;
|
|
1066
|
+
color: #999;
|
|
1067
|
+
letter-spacing: 0.08em;
|
|
1068
|
+
font-variant-numeric: tabular-nums;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
.travel-route-dot {
|
|
1072
|
+
width: 6px;
|
|
1073
|
+
height: 6px;
|
|
1074
|
+
border-radius: 50%;
|
|
1075
|
+
background-color: var(--stop-color, #a8452e);
|
|
1076
|
+
flex-shrink: 0;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.travel-route-place {
|
|
1080
|
+
@include sourceSerifFont;
|
|
1081
|
+
font-size: 15.5px;
|
|
1082
|
+
font-weight: 900;
|
|
1083
|
+
line-height: 1.4;
|
|
1084
|
+
color: $darkText;
|
|
1085
|
+
word-break: normal;
|
|
1086
|
+
overflow-wrap: break-word;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
.travel-route-days {
|
|
1090
|
+
font-family: $linkFontFamily, "SF Pro Text", -apple-system, sans-serif;
|
|
1091
|
+
font-size: 11.5px;
|
|
1092
|
+
line-height: 1.4;
|
|
1093
|
+
color: #a8452e;
|
|
1094
|
+
font-variant-numeric: tabular-nums;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
.travel-route-note {
|
|
1098
|
+
@include defaultFont;
|
|
1099
|
+
font-size: 11.5px;
|
|
1100
|
+
line-height: 1.45;
|
|
1101
|
+
color: $moreGrayText;
|
|
1102
|
+
margin-top: 1px;
|
|
1103
|
+
word-break: normal;
|
|
1104
|
+
overflow-wrap: break-word;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
@media (max-width: 728px) {
|
|
1109
|
+
h2:not(#to-page-top):not(.to-page-top):not(.hidden) {
|
|
1110
|
+
margin: 2.2em auto 1.2em;
|
|
1111
|
+
font-size: 1.38em;
|
|
1112
|
+
letter-spacing: 0.06em;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
p:has(.image-grid, .lazyload-outer-wrap, img)
|
|
1116
|
+
+ h2:not(#to-page-top):not(.to-page-top):not(.hidden),
|
|
1117
|
+
.image-grid + h2:not(#to-page-top):not(.to-page-top):not(.hidden),
|
|
1118
|
+
figure + h2:not(#to-page-top):not(.to-page-top):not(.hidden) {
|
|
1119
|
+
margin-top: 2.5em;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
h3 {
|
|
1123
|
+
margin: 1.7em 0 0.75em;
|
|
1124
|
+
font-size: 1.15em;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
p:has(.image-grid, .lazyload-outer-wrap, img) + h3,
|
|
1128
|
+
.image-grid + h3,
|
|
1129
|
+
figure + h3 {
|
|
1130
|
+
margin-top: 2em;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
h4 {
|
|
1134
|
+
margin: 1.4em 0 0.65em;
|
|
1135
|
+
font-size: 1.02em;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
table:not(:where(.highlight table)) {
|
|
1139
|
+
margin: 1.35em 0;
|
|
1140
|
+
font-size: 0.86em;
|
|
1141
|
+
|
|
1142
|
+
th,
|
|
1143
|
+
td {
|
|
1144
|
+
padding: 0.6em 0.55em;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
.travel-route-block {
|
|
1149
|
+
.travel-route-grid {
|
|
1150
|
+
grid-template-columns: repeat(
|
|
1151
|
+
min(var(--route-cols, 3), 3),
|
|
1152
|
+
minmax(0, 1fr)
|
|
1153
|
+
);
|
|
1154
|
+
gap: 8px 12px;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
@media (max-width: 479px) {
|
|
1160
|
+
h2:not(#to-page-top):not(.to-page-top):not(.hidden) {
|
|
1161
|
+
margin: 2em auto 1.1em;
|
|
1162
|
+
font-size: max(min(5.8vw, 1.35em), 20px);
|
|
1163
|
+
letter-spacing: 0.05em;
|
|
1164
|
+
|
|
1165
|
+
&::before {
|
|
1166
|
+
margin-bottom: 8px;
|
|
1167
|
+
padding: 0 calc(28px - 0.14em) 0 28px;
|
|
1168
|
+
font-size: 10.5px;
|
|
1169
|
+
letter-spacing: 0.14em;
|
|
1170
|
+
background-size:
|
|
1171
|
+
18px 1px,
|
|
1172
|
+
18px 1px;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
&::after {
|
|
1176
|
+
width: 18px;
|
|
1177
|
+
margin-top: 10px;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
&:hover {
|
|
1181
|
+
&::before {
|
|
1182
|
+
background-size:
|
|
1183
|
+
22px 1px,
|
|
1184
|
+
22px 1px;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
&::after {
|
|
1188
|
+
width: 26px;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
h3 {
|
|
1194
|
+
font-size: max(min(4.6vw, 1.15em), 17.5px);
|
|
1195
|
+
|
|
1196
|
+
&::before {
|
|
1197
|
+
margin-right: 7px;
|
|
1198
|
+
font-size: 9px;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
&::after {
|
|
1202
|
+
margin-left: 10px;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
h4 {
|
|
1207
|
+
font-size: max(min(4vw, 1.04em), 16px);
|
|
1208
|
+
|
|
1209
|
+
&::before {
|
|
1210
|
+
margin-right: 6px;
|
|
1211
|
+
font-size: 8px;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
&::after {
|
|
1215
|
+
margin-left: 8px;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
.travel-route-block {
|
|
1220
|
+
.travel-route-grid {
|
|
1221
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1222
|
+
gap: 8px 10px;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.travel-route-item {
|
|
1226
|
+
padding: 8px 8px 6px;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
.travel-route-place {
|
|
1230
|
+
font-size: 14.5px;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1236
|
+
h2,
|
|
1237
|
+
h2::before,
|
|
1238
|
+
h2::after,
|
|
1239
|
+
h3,
|
|
1240
|
+
h3::before,
|
|
1241
|
+
h3::after,
|
|
1242
|
+
table:not(:where(.highlight table)) tbody tr,
|
|
1243
|
+
.travel-route-block .travel-route-seg,
|
|
1244
|
+
.travel-route-block .travel-route-item {
|
|
1245
|
+
transition: none;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
643
1250
|
.post-meta {
|
|
644
1251
|
@include defaultFont;
|
|
645
1252
|
margin-top: -15px;
|
|
@@ -643,8 +643,328 @@ function initMaskScrollLock() {
|
|
|
643
643
|
);
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
+
function initTravelRoutes() {
|
|
647
|
+
var contentEl = document.querySelector("#post.travel-post #page-content");
|
|
648
|
+
if (!contentEl) return;
|
|
649
|
+
|
|
650
|
+
var ROUTE_HEADING_RE = /^(?:路线|路线规划|Route|Route Planning)$/i;
|
|
651
|
+
var PALETTE = [
|
|
652
|
+
"#c97a63",
|
|
653
|
+
"#a8452e",
|
|
654
|
+
"#8a9a86",
|
|
655
|
+
"#c4b7a6",
|
|
656
|
+
"#b87d56",
|
|
657
|
+
"#6d8b74",
|
|
658
|
+
"#d49a79",
|
|
659
|
+
"#9c8f84",
|
|
660
|
+
];
|
|
661
|
+
var isEnglish = /^en/i.test(document.documentElement.lang || "");
|
|
662
|
+
|
|
663
|
+
function getHeadingText(heading) {
|
|
664
|
+
var clone = heading.cloneNode(true);
|
|
665
|
+
clone
|
|
666
|
+
.querySelectorAll(".headerlink, .header-anchor")
|
|
667
|
+
.forEach(function (el) {
|
|
668
|
+
el.remove();
|
|
669
|
+
});
|
|
670
|
+
return (clone.textContent || "")
|
|
671
|
+
.replace(/^[#¶\s]+|[#¶\s]+$/g, "")
|
|
672
|
+
.trim();
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function parseZhNum(str) {
|
|
676
|
+
var map = {
|
|
677
|
+
半: 0.5,
|
|
678
|
+
一: 1,
|
|
679
|
+
二: 2,
|
|
680
|
+
两: 2,
|
|
681
|
+
三: 3,
|
|
682
|
+
四: 4,
|
|
683
|
+
五: 5,
|
|
684
|
+
六: 6,
|
|
685
|
+
七: 7,
|
|
686
|
+
八: 8,
|
|
687
|
+
九: 9,
|
|
688
|
+
十: 10,
|
|
689
|
+
};
|
|
690
|
+
if (Object.prototype.hasOwnProperty.call(map, str)) return map[str];
|
|
691
|
+
if (/^十[一二三四五六七八九]$/.test(str)) return 10 + map[str[1]];
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
function parseDuration(text) {
|
|
696
|
+
var trimmed = String(text || "").trim();
|
|
697
|
+
if (!trimmed) return null;
|
|
698
|
+
|
|
699
|
+
var compound = trimmed.match(
|
|
700
|
+
/^(\d+(?:\.\d+)?)\s*(日|天)\s*\d+(?:\.\d+)?\s*(?:晚|夜)$/
|
|
701
|
+
);
|
|
702
|
+
if (compound) {
|
|
703
|
+
var val = Number(compound[1]);
|
|
704
|
+
if (isFinite(val) && val > 0) {
|
|
705
|
+
return {
|
|
706
|
+
label: trimmed,
|
|
707
|
+
weight: val,
|
|
708
|
+
unitKind: "day",
|
|
709
|
+
unitText: compound[2],
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
if (/^(半日|半天|half\s+day)$/i.test(trimmed)) {
|
|
715
|
+
var isEn = /day/i.test(trimmed);
|
|
716
|
+
return {
|
|
717
|
+
label: trimmed,
|
|
718
|
+
weight: 0.5,
|
|
719
|
+
unitKind: "day",
|
|
720
|
+
unitText: isEn ? "days" : trimmed.slice(-1) === "日" ? "日" : "天",
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
var zhNum = trimmed.match(
|
|
725
|
+
/^(十?[一二两三四五六七八九]|十)\s*(日|天|晚|夜)(半)?$/
|
|
726
|
+
);
|
|
727
|
+
if (zhNum) {
|
|
728
|
+
var base = parseZhNum(zhNum[1]);
|
|
729
|
+
if (base) {
|
|
730
|
+
var unitChar = zhNum[2];
|
|
731
|
+
return {
|
|
732
|
+
label: trimmed,
|
|
733
|
+
weight: base + (zhNum[3] ? 0.5 : 0),
|
|
734
|
+
unitKind: unitChar === "晚" || unitChar === "夜" ? "night" : "day",
|
|
735
|
+
unitText: unitChar,
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
var num = trimmed.match(
|
|
741
|
+
/^(\d+(?:\.\d+)?)\s*(日|天|晚|夜|小时|days?|nights?|hours?|hrs?|d|h)$/i
|
|
742
|
+
);
|
|
743
|
+
if (num) {
|
|
744
|
+
var n = Number(num[1]);
|
|
745
|
+
if (isFinite(n) && n > 0) {
|
|
746
|
+
var lower = num[2].toLowerCase();
|
|
747
|
+
var unitKind = "day";
|
|
748
|
+
var unitText = num[2];
|
|
749
|
+
if (lower === "晚" || lower === "夜" || lower.indexOf("night") === 0) {
|
|
750
|
+
unitKind = "night";
|
|
751
|
+
unitText = lower.indexOf("night") === 0 ? "nights" : num[2];
|
|
752
|
+
} else if (
|
|
753
|
+
lower === "小时" ||
|
|
754
|
+
lower.indexOf("hour") === 0 ||
|
|
755
|
+
lower.indexOf("hr") === 0 ||
|
|
756
|
+
lower === "h"
|
|
757
|
+
) {
|
|
758
|
+
unitKind = "hour";
|
|
759
|
+
unitText = lower === "小时" ? "小时" : "hours";
|
|
760
|
+
} else if (lower.indexOf("day") === 0 || lower === "d") {
|
|
761
|
+
unitKind = "day";
|
|
762
|
+
unitText = "days";
|
|
763
|
+
}
|
|
764
|
+
return { label: trimmed, weight: n, unitKind: unitKind, unitText: unitText };
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function parseItem(rawHtml) {
|
|
772
|
+
var content = String(rawHtml || "").trim();
|
|
773
|
+
if (/^<p>[\s\S]*<\/p>$/i.test(content) && !/<\/p>\s*<p>/i.test(content)) {
|
|
774
|
+
content = content.replace(/^<p>|<\/p>$/gi, "").trim();
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
var note = "";
|
|
778
|
+
var duration = null;
|
|
779
|
+
|
|
780
|
+
var paren = content.match(
|
|
781
|
+
/^(.*?)[\s]*(?:(([^()]+))|\(([^()]+)\))\s*$/
|
|
782
|
+
);
|
|
783
|
+
if (paren && paren[1].trim()) {
|
|
784
|
+
var inner = (paren[2] || paren[3] || "").trim();
|
|
785
|
+
var pd = parseDuration(inner);
|
|
786
|
+
if (pd) {
|
|
787
|
+
duration = pd;
|
|
788
|
+
} else {
|
|
789
|
+
note = inner;
|
|
790
|
+
}
|
|
791
|
+
content = paren[1].trim();
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
if (!duration) {
|
|
795
|
+
var tail = content.match(
|
|
796
|
+
/^(.*?)(?:[\s·•\-—::,,/]+)(\d+(?:\.\d+)?\s*(?:日|天)\s*\d+(?:\.\d+)?\s*(?:晚|夜)|\d+(?:\.\d+)?\s*(?:日|天|晚|夜|小时|days?|nights?|hours?|hrs?|d|h)|(?:半日|半天|half\s+day)|(?:十?[一二两三四五六七八九]|十)\s*(?:日|天|晚|夜)(?:半)?)\s*$/i
|
|
797
|
+
);
|
|
798
|
+
if (tail && tail[1].trim()) {
|
|
799
|
+
var td = parseDuration(tail[2]);
|
|
800
|
+
if (td) {
|
|
801
|
+
duration = td;
|
|
802
|
+
content = tail[1].trim();
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
if (!duration) {
|
|
808
|
+
var compact = content.match(
|
|
809
|
+
/^(.*?)(\d+(?:\.\d+)?\s*(?:日|天)\s*\d+(?:\.\d+)?\s*(?:晚|夜)|\d+(?:\.\d+)?\s*(?:日|天|晚|夜|小时)|半日|半天)$/
|
|
810
|
+
);
|
|
811
|
+
if (compact && compact[1].trim()) {
|
|
812
|
+
var cd = parseDuration(compact[2]);
|
|
813
|
+
if (cd) {
|
|
814
|
+
duration = cd;
|
|
815
|
+
content = compact[1].trim();
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
var place = content.replace(/[\s·•\-—::,,/]+$/, "").trim();
|
|
821
|
+
if (!place) {
|
|
822
|
+
return { place: rawHtml.trim(), duration: null, note: "" };
|
|
823
|
+
}
|
|
824
|
+
return { place: place, duration: duration, note: note };
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
function getCols(count) {
|
|
828
|
+
if (count <= 2) return 2;
|
|
829
|
+
if (count === 3 || count === 5 || count === 6 || count === 9) return 3;
|
|
830
|
+
return 4;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
contentEl.querySelectorAll("h2, h3").forEach(function (heading) {
|
|
834
|
+
if (!ROUTE_HEADING_RE.test(getHeadingText(heading))) return;
|
|
835
|
+
|
|
836
|
+
var next = heading.nextElementSibling;
|
|
837
|
+
while (next && next.id === "gitalk-initiator") {
|
|
838
|
+
next = next.nextElementSibling;
|
|
839
|
+
}
|
|
840
|
+
if (!next || (next.tagName !== "UL" && next.tagName !== "OL")) return;
|
|
841
|
+
if (next.classList.contains("travel-route-grid")) return;
|
|
842
|
+
if (next.querySelector("ul, ol, img, iframe, table, pre, blockquote, figure")) {
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
var lis = Array.prototype.slice.call(next.children).filter(function (el) {
|
|
847
|
+
return el.tagName === "LI";
|
|
848
|
+
});
|
|
849
|
+
if (lis.length < 2) return;
|
|
850
|
+
|
|
851
|
+
var stops = lis.map(function (li) {
|
|
852
|
+
return parseItem(li.innerHTML);
|
|
853
|
+
});
|
|
854
|
+
var withDuration = stops.filter(function (s) {
|
|
855
|
+
return !!s.duration;
|
|
856
|
+
});
|
|
857
|
+
var showBar = withDuration.length >= 2;
|
|
858
|
+
var cols = getCols(stops.length);
|
|
859
|
+
|
|
860
|
+
var block = document.createElement("div");
|
|
861
|
+
block.className = "travel-route-block" + (showBar ? " has-bar" : "");
|
|
862
|
+
block.style.setProperty("--route-cols", String(cols));
|
|
863
|
+
|
|
864
|
+
if (showBar) {
|
|
865
|
+
var unitKinds = new Set(
|
|
866
|
+
withDuration.map(function (s) {
|
|
867
|
+
return s.duration.unitKind;
|
|
868
|
+
})
|
|
869
|
+
);
|
|
870
|
+
|
|
871
|
+
if (
|
|
872
|
+
withDuration.length === stops.length &&
|
|
873
|
+
unitKinds.size === 1 &&
|
|
874
|
+
(unitKinds.has("day") || unitKinds.has("night"))
|
|
875
|
+
) {
|
|
876
|
+
var total = Number(
|
|
877
|
+
withDuration
|
|
878
|
+
.reduce(function (sum, s) {
|
|
879
|
+
return sum + s.duration.weight;
|
|
880
|
+
}, 0)
|
|
881
|
+
.toFixed(2)
|
|
882
|
+
);
|
|
883
|
+
var firstUnit = withDuration[0].duration.unitText;
|
|
884
|
+
var useEn = isEnglish || /^[a-z]+$/i.test(firstUnit);
|
|
885
|
+
var summary = document.createElement("div");
|
|
886
|
+
summary.className = "travel-route-summary";
|
|
887
|
+
summary.textContent = useEn
|
|
888
|
+
? stops.length + " STOPS · " + total + " " + firstUnit.toUpperCase()
|
|
889
|
+
: stops.length + " 站 · 共 " + total + " " + firstUnit;
|
|
890
|
+
block.appendChild(summary);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
var bar = document.createElement("div");
|
|
894
|
+
bar.className = "travel-route-bar";
|
|
895
|
+
bar.setAttribute("aria-hidden", "true");
|
|
896
|
+
stops.forEach(function (stop, idx) {
|
|
897
|
+
if (!stop.duration) return;
|
|
898
|
+
var seg = document.createElement("span");
|
|
899
|
+
var color = PALETTE[idx % PALETTE.length];
|
|
900
|
+
var flexWeight = stop.duration.weight;
|
|
901
|
+
if (unitKinds.size > 1 && stop.duration.unitKind === "hour") {
|
|
902
|
+
flexWeight = Math.max(stop.duration.weight / 24, 0.25);
|
|
903
|
+
}
|
|
904
|
+
seg.className = "travel-route-seg";
|
|
905
|
+
seg.style.flex = String(flexWeight);
|
|
906
|
+
seg.style.setProperty("--stop-color", color);
|
|
907
|
+
var plainPlace = stop.place.replace(/<[^>]*>/g, "").trim();
|
|
908
|
+
seg.title = plainPlace + " · " + stop.duration.label;
|
|
909
|
+
bar.appendChild(seg);
|
|
910
|
+
});
|
|
911
|
+
block.appendChild(bar);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
var grid = document.createElement("ul");
|
|
915
|
+
grid.className = "travel-route-grid";
|
|
916
|
+
stops.forEach(function (stop, idx) {
|
|
917
|
+
var color = PALETTE[idx % PALETTE.length];
|
|
918
|
+
var li = document.createElement("li");
|
|
919
|
+
li.className = "travel-route-item";
|
|
920
|
+
li.style.setProperty("--stop-color", color);
|
|
921
|
+
|
|
922
|
+
var top = document.createElement("div");
|
|
923
|
+
top.className = "travel-route-item-top";
|
|
924
|
+
var idxSpan = document.createElement("span");
|
|
925
|
+
idxSpan.className = "travel-route-index";
|
|
926
|
+
idxSpan.textContent = String(idx + 1).padStart(2, "0");
|
|
927
|
+
var dot = document.createElement("span");
|
|
928
|
+
dot.className = "travel-route-dot";
|
|
929
|
+
dot.setAttribute("aria-hidden", "true");
|
|
930
|
+
top.appendChild(idxSpan);
|
|
931
|
+
top.appendChild(dot);
|
|
932
|
+
|
|
933
|
+
var placeDiv = document.createElement("div");
|
|
934
|
+
placeDiv.className = "travel-route-place";
|
|
935
|
+
placeDiv.innerHTML = stop.place;
|
|
936
|
+
|
|
937
|
+
li.appendChild(top);
|
|
938
|
+
li.appendChild(placeDiv);
|
|
939
|
+
|
|
940
|
+
if (stop.duration) {
|
|
941
|
+
var daysSpan = document.createElement("span");
|
|
942
|
+
daysSpan.className = "travel-route-days";
|
|
943
|
+
daysSpan.textContent = stop.duration.label;
|
|
944
|
+
li.appendChild(daysSpan);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
if (stop.note) {
|
|
948
|
+
var noteSpan = document.createElement("span");
|
|
949
|
+
noteSpan.className = "travel-route-note";
|
|
950
|
+
noteSpan.textContent = stop.note;
|
|
951
|
+
li.appendChild(noteSpan);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
grid.appendChild(li);
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
block.appendChild(grid);
|
|
958
|
+
next.parentNode.replaceChild(block, next);
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
|
|
646
962
|
if (document.readyState === "loading") {
|
|
647
|
-
document.addEventListener("DOMContentLoaded",
|
|
963
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
964
|
+
initMaskScrollLock();
|
|
965
|
+
initTravelRoutes();
|
|
966
|
+
});
|
|
648
967
|
} else {
|
|
649
968
|
initMaskScrollLock();
|
|
969
|
+
initTravelRoutes();
|
|
650
970
|
}
|