hexo-theme-linen 1.0.44 → 1.0.46
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 +38 -3
- package/layout/series.ejs +1 -1
- package/package.json +1 -1
- package/scripts/lazyload/client.js +16 -1
- package/scripts/lazyload/config.js +2 -1
- package/scripts/lazyload/inject.js +2 -1
- package/source/linen-theme/css/font-version.scss +1 -1
- package/source/linen-theme/css/linen.scss +44 -15
- package/source/linen-theme/img/icons/medium-clap-reacted.svg +1 -0
- package/source/linen-theme/js/gitalk/gitalk.css +427 -2
- package/source/linen-theme/js/gitalk/gitalk.min.js +2 -2
- package/source/linen-theme/js/lazyload.js +16 -1
package/layout/post.ejs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const coverImgStartTime = performance.now();
|
|
7
7
|
setTimeout(() => {
|
|
8
8
|
const postCoverImg = document.getElementById('postCoverImg');
|
|
9
|
-
if (postCoverImg &&
|
|
9
|
+
if (postCoverImg && !postCoverImg.classList.contains('loaded') && !postCoverImg.classList.contains('cached')) {
|
|
10
10
|
postCoverImg.classList.add('loading')
|
|
11
11
|
}
|
|
12
12
|
}, 100);
|
|
@@ -201,10 +201,10 @@ const seriesInfo = getSeriesInfo(page?.series);
|
|
|
201
201
|
}
|
|
202
202
|
const link = document.createElement("link");
|
|
203
203
|
link.rel = "stylesheet";
|
|
204
|
-
link.href = "<%=url_for(
|
|
204
|
+
link.href = "<%=url_for(`/linen-theme/js/gitalk/gitalk.css?v=${theme.version}-gitalk`)%>";
|
|
205
205
|
document.head.appendChild(link);
|
|
206
206
|
const script = document.createElement("script");
|
|
207
|
-
script.src = "<%=url_for(
|
|
207
|
+
script.src = "<%=url_for(`/linen-theme/js/gitalk/gitalk.min.js?v=${theme.version}-gitalk`)%>";
|
|
208
208
|
const pageId = location.pathname.length > 40 ? hashPathname(location.pathname) : location.pathname;
|
|
209
209
|
console.log(`GitTalk page ID: ${pageId}`);
|
|
210
210
|
script.onload = function() {
|
|
@@ -223,6 +223,41 @@ const seriesInfo = getSeriesInfo(page?.series);
|
|
|
223
223
|
});
|
|
224
224
|
|
|
225
225
|
gitalk.render("gitalk-container");
|
|
226
|
+
|
|
227
|
+
var container = document.getElementById("gitalk-container");
|
|
228
|
+
if (container) {
|
|
229
|
+
var expandComment = function() {
|
|
230
|
+
var comment = container.querySelector(".gt-header-comment");
|
|
231
|
+
if (comment && !comment.classList.contains("is-expanded")) {
|
|
232
|
+
comment.classList.add("is-expanded");
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// Focus the textarea and expand when clicking on the comment box wrapper
|
|
237
|
+
container.addEventListener("click", function(e) {
|
|
238
|
+
var comment = e.target.closest(".gt-header-comment");
|
|
239
|
+
if (comment) {
|
|
240
|
+
expandComment();
|
|
241
|
+
if (e.target === comment) {
|
|
242
|
+
var textarea = comment.querySelector(".gt-header-textarea");
|
|
243
|
+
if (textarea) textarea.focus();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// Expand once interacted with and keep expanded permanently
|
|
249
|
+
container.addEventListener("focusin", function(e) {
|
|
250
|
+
if (e.target && e.target.classList.contains("gt-header-textarea")) {
|
|
251
|
+
expandComment();
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
container.addEventListener("input", function(e) {
|
|
256
|
+
if (e.target && e.target.classList.contains("gt-header-textarea")) {
|
|
257
|
+
expandComment();
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
226
261
|
};
|
|
227
262
|
document.body.appendChild(script);
|
|
228
263
|
$gitalkInitiated = true;
|
package/layout/series.ejs
CHANGED
|
@@ -51,7 +51,7 @@ const travelPlacesJson = encodeURIComponent(JSON.stringify(travelPlaces));
|
|
|
51
51
|
const coverImgStartTime = Date.now();
|
|
52
52
|
setTimeout(() => {
|
|
53
53
|
const seriesCoverImg = document.getElementById('seriesCoverImg');
|
|
54
|
-
if (seriesCoverImg &&
|
|
54
|
+
if (seriesCoverImg && !seriesCoverImg.classList.contains('loaded') && !seriesCoverImg.classList.contains('cached')) {
|
|
55
55
|
seriesCoverImg.classList.add('loading')
|
|
56
56
|
}
|
|
57
57
|
}, 100);
|
package/package.json
CHANGED
|
@@ -224,9 +224,12 @@
|
|
|
224
224
|
var showTransition =
|
|
225
225
|
!window.$lazyload || window.$lazyload.showTransition !== false;
|
|
226
226
|
var clearPlaceholder = function clearPlaceholder() {
|
|
227
|
+
// Keep the placeholder underneath by default to prevent blank frames or flashes
|
|
228
|
+
// caused by asynchronous GPU decoding and rasterization delays.
|
|
227
229
|
var keepPlaceholder =
|
|
228
230
|
element.getAttribute("data-hdr-active") === "true" ||
|
|
229
|
-
|
|
231
|
+
!window.$lazyload ||
|
|
232
|
+
window.$lazyload.keepPlaceholder !== false;
|
|
230
233
|
if (!keepPlaceholder) {
|
|
231
234
|
element.children[0].classList.add("loaded");
|
|
232
235
|
}
|
|
@@ -247,6 +250,18 @@
|
|
|
247
250
|
return;
|
|
248
251
|
}
|
|
249
252
|
revealedSource = source;
|
|
253
|
+
|
|
254
|
+
// If the resource finishes loading while off-screen, skip the opacity
|
|
255
|
+
// transition to prevent deferred animations and visual flashes when
|
|
256
|
+
// the element scrolls into the viewport.
|
|
257
|
+
var rect = element.getBoundingClientRect();
|
|
258
|
+
var inViewport =
|
|
259
|
+
rect.bottom > 0 &&
|
|
260
|
+
rect.top < (window.innerHeight || document.documentElement.clientHeight);
|
|
261
|
+
if (!inViewport) {
|
|
262
|
+
resourceElement.style.transition = "none";
|
|
263
|
+
}
|
|
264
|
+
|
|
250
265
|
// The inline opacity is already 0 and the inline transition is set
|
|
251
266
|
// before insertion, so the next frame can reveal without forcing a
|
|
252
267
|
// synchronous layout for every image.
|
|
@@ -14,6 +14,7 @@ module.exports = function (hexo) {
|
|
|
14
14
|
placeholderRatio,
|
|
15
15
|
showTransition,
|
|
16
16
|
preloadCount,
|
|
17
|
+
keepPlaceholder: configKeepPlaceholder,
|
|
17
18
|
} = {
|
|
18
19
|
...defaultConfig,
|
|
19
20
|
...(hexo?.config?.theme_config?.lazyload || {}),
|
|
@@ -154,7 +155,7 @@ module.exports = function (hexo) {
|
|
|
154
155
|
preloadCount: ${preloadCount},
|
|
155
156
|
showTransition: ${showTransition},
|
|
156
157
|
keepPlaceholder: ${
|
|
157
|
-
page?.lazyload?.keepPlaceholder ??
|
|
158
|
+
page?.lazyload?.keepPlaceholder ?? configKeepPlaceholder ?? true
|
|
158
159
|
}}</script>`;
|
|
159
160
|
|
|
160
161
|
const injectExtraScript = function (filePath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
$font-version: "
|
|
1
|
+
$font-version: "a80a526b";
|
|
@@ -1547,6 +1547,10 @@ body {
|
|
|
1547
1547
|
}
|
|
1548
1548
|
}
|
|
1549
1549
|
#gitalk-container {
|
|
1550
|
+
--gt-avatar-size: 2.25rem;
|
|
1551
|
+
@media (max-width: 479px) {
|
|
1552
|
+
--gt-avatar-size: 2rem;
|
|
1553
|
+
}
|
|
1550
1554
|
margin-top: $postWidgetGap;
|
|
1551
1555
|
padding: 0 $commonPadding;
|
|
1552
1556
|
background-color: #fff;
|
|
@@ -1567,11 +1571,11 @@ body {
|
|
|
1567
1571
|
.gt-comments {
|
|
1568
1572
|
padding-top: $commonPadding;
|
|
1569
1573
|
.gt-comment {
|
|
1570
|
-
--comment-content-indent: calc(
|
|
1574
|
+
--comment-content-indent: calc(var(--gt-avatar-size) + 1rem);
|
|
1571
1575
|
display: grid;
|
|
1572
|
-
grid-template-columns:
|
|
1576
|
+
grid-template-columns: var(--gt-avatar-size) minmax(0, 1fr);
|
|
1573
1577
|
grid-template-rows: auto auto auto auto;
|
|
1574
|
-
column-gap:
|
|
1578
|
+
column-gap: 1rem;
|
|
1575
1579
|
align-items: start;
|
|
1576
1580
|
padding: 1.5em 0;
|
|
1577
1581
|
border-bottom: solid 1px rgb(242, 242, 242);
|
|
@@ -1585,9 +1589,15 @@ body {
|
|
|
1585
1589
|
grid-column: 1;
|
|
1586
1590
|
grid-row: 1 / span 2;
|
|
1587
1591
|
align-self: center;
|
|
1592
|
+
width: var(--gt-avatar-size);
|
|
1593
|
+
height: var(--gt-avatar-size);
|
|
1588
1594
|
border-radius: 50%;
|
|
1589
1595
|
|
|
1590
1596
|
img {
|
|
1597
|
+
display: block;
|
|
1598
|
+
width: 100%;
|
|
1599
|
+
height: 100%;
|
|
1600
|
+
object-fit: cover;
|
|
1591
1601
|
border-radius: 50%;
|
|
1592
1602
|
}
|
|
1593
1603
|
}
|
|
@@ -1606,7 +1616,7 @@ body {
|
|
|
1606
1616
|
grid-row: 1;
|
|
1607
1617
|
line-height: 1.5;
|
|
1608
1618
|
position: relative;
|
|
1609
|
-
top:
|
|
1619
|
+
top: 0;
|
|
1610
1620
|
}
|
|
1611
1621
|
.gt-comment-text {
|
|
1612
1622
|
display: none;
|
|
@@ -1615,7 +1625,7 @@ body {
|
|
|
1615
1625
|
grid-column: 2;
|
|
1616
1626
|
grid-row: 2;
|
|
1617
1627
|
position: relative;
|
|
1618
|
-
top:
|
|
1628
|
+
top: 0;
|
|
1619
1629
|
margin: 0.2em 0 0;
|
|
1620
1630
|
}
|
|
1621
1631
|
.gt-comment-body {
|
|
@@ -1637,7 +1647,7 @@ body {
|
|
|
1637
1647
|
height: 1.5em;
|
|
1638
1648
|
line-height: 1;
|
|
1639
1649
|
margin-top: 1.1em;
|
|
1640
|
-
transform: translateX(calc(-1 * var(--comment-content-indent)
|
|
1650
|
+
transform: translateX(calc(-1 * var(--comment-content-indent)));
|
|
1641
1651
|
}
|
|
1642
1652
|
.gt-comment-edit,
|
|
1643
1653
|
.gt-comment-reply {
|
|
@@ -1653,6 +1663,9 @@ body {
|
|
|
1653
1663
|
margin: 1.1em 0 0 2em;
|
|
1654
1664
|
transform: translateX(calc(-1 * var(--comment-content-indent)));
|
|
1655
1665
|
}
|
|
1666
|
+
.gt-comment-reply {
|
|
1667
|
+
margin-left: 3em;
|
|
1668
|
+
}
|
|
1656
1669
|
.gt-comment-like .gt-ico-heart {
|
|
1657
1670
|
display: inline-flex;
|
|
1658
1671
|
align-items: center;
|
|
@@ -1668,8 +1681,12 @@ body {
|
|
|
1668
1681
|
}
|
|
1669
1682
|
}
|
|
1670
1683
|
|
|
1684
|
+
&.is-reacted .gt-svg {
|
|
1685
|
+
background-image: url("../img/icons/medium-clap-reacted.svg");
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1671
1688
|
.gt-ico-text {
|
|
1672
|
-
margin-left: 0.
|
|
1689
|
+
margin-left: 0.25em;
|
|
1673
1690
|
color: #6b6b6b;
|
|
1674
1691
|
}
|
|
1675
1692
|
}
|
|
@@ -1713,13 +1730,13 @@ body {
|
|
|
1713
1730
|
}
|
|
1714
1731
|
@media (max-width: 479px) {
|
|
1715
1732
|
.gt-comment {
|
|
1716
|
-
--comment-content-indent: calc(
|
|
1717
|
-
grid-template-columns:
|
|
1718
|
-
column-gap: 0.
|
|
1733
|
+
--comment-content-indent: calc(var(--gt-avatar-size) + 0.875rem);
|
|
1734
|
+
grid-template-columns: var(--gt-avatar-size) minmax(0, 1fr);
|
|
1735
|
+
column-gap: 0.875rem;
|
|
1719
1736
|
}
|
|
1720
1737
|
.gt-comment-avatar {
|
|
1721
|
-
width:
|
|
1722
|
-
height:
|
|
1738
|
+
width: var(--gt-avatar-size);
|
|
1739
|
+
height: var(--gt-avatar-size);
|
|
1723
1740
|
}
|
|
1724
1741
|
}
|
|
1725
1742
|
a:not([class]) {
|
|
@@ -1778,14 +1795,23 @@ body {
|
|
|
1778
1795
|
.gt-header-avatar,
|
|
1779
1796
|
.gt-comment-avatar {
|
|
1780
1797
|
background-color: #f5f5f5;
|
|
1798
|
+
border-radius: 50%;
|
|
1799
|
+
|
|
1800
|
+
img {
|
|
1801
|
+
border-radius: 50%;
|
|
1802
|
+
}
|
|
1781
1803
|
}
|
|
1782
1804
|
.user-mention {
|
|
1783
1805
|
color: $darkText;
|
|
1784
|
-
text-decoration:
|
|
1806
|
+
text-decoration: none;
|
|
1785
1807
|
@include defaultFont;
|
|
1786
1808
|
text-underline-offset: 0.2rem;
|
|
1787
1809
|
font-weight: 500;
|
|
1788
1810
|
font-size: 14px;
|
|
1811
|
+
|
|
1812
|
+
&:hover {
|
|
1813
|
+
text-decoration: underline;
|
|
1814
|
+
}
|
|
1789
1815
|
}
|
|
1790
1816
|
.gt-comments-controls {
|
|
1791
1817
|
margin-top: 0.625em;
|
|
@@ -1812,6 +1838,9 @@ body {
|
|
|
1812
1838
|
}
|
|
1813
1839
|
}
|
|
1814
1840
|
}
|
|
1841
|
+
.gt-header-comment {
|
|
1842
|
+
border-radius: 2px;
|
|
1843
|
+
}
|
|
1815
1844
|
.gt-header-textarea {
|
|
1816
1845
|
border: none;
|
|
1817
1846
|
border-radius: 2px;
|
|
@@ -2334,7 +2363,7 @@ body {
|
|
|
2334
2363
|
.copyright-popover-content {
|
|
2335
2364
|
position: absolute;
|
|
2336
2365
|
bottom: 100%;
|
|
2337
|
-
right: -
|
|
2366
|
+
right: -30px;
|
|
2338
2367
|
margin-bottom: 10px;
|
|
2339
2368
|
width: 280px;
|
|
2340
2369
|
max-width: calc(100vw - 32px);
|
|
@@ -2391,7 +2420,7 @@ body {
|
|
|
2391
2420
|
.copyright-popover-arrow {
|
|
2392
2421
|
position: absolute;
|
|
2393
2422
|
bottom: -5px;
|
|
2394
|
-
right:
|
|
2423
|
+
right: 35px;
|
|
2395
2424
|
transform: rotate(45deg);
|
|
2396
2425
|
width: 8px;
|
|
2397
2426
|
height: 8px;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-label="clap"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.3694 0.827581L12 3.2822L12.6306 0.827581H11.3694Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M15.4213 1.84055L14.2362 1.45158L13.8985 3.95255L15.4213 1.84055Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M9.75726 1.45158L8.57299 1.84055L10.0957 3.95255L9.75726 1.45158Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M20.2527 11.8403L17.7509 7.43751C17.5134 7.08496 17.1807 6.85406 16.8215 6.79531C16.6901 6.77166 16.5551 6.77571 16.4253 6.8072C16.2955 6.8387 16.1736 6.89694 16.0676 6.9782C15.8218 7.16937 15.6753 7.40441 15.6248 7.67338C15.6389 7.69158 15.6546 7.70648 15.6687 7.72551L18.0215 11.8643C19.6353 14.8138 19.1206 17.635 16.4963 20.2593C16.351 20.4041 16.1994 20.5424 16.042 20.6739C17.0392 20.5448 17.9686 20.064 18.8152 19.2174C21.5197 16.5128 21.3319 13.632 20.2527 11.8403Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M12.0662 9.00993C11.9371 8.32303 12.1457 7.71144 12.6389 7.23724L10.5766 5.17406C10.1628 4.75696 9.43615 4.75696 9.02152 5.17406C8.87421 5.32303 8.79559 5.5051 8.74925 5.69544L12.0662 9.00993Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.741 8.30896C14.5606 8.04165 14.2949 7.85379 14.0127 7.80745C13.92 7.79004 13.8246 7.79232 13.7328 7.81414C13.641 7.83595 13.5548 7.87681 13.4797 7.93407C13.3341 8.04745 12.8897 8.39172 13.2811 9.23007L14.4646 11.7335C14.5106 11.7795 14.546 11.8349 14.5684 11.896C14.5907 11.9571 14.5994 12.0224 14.5939 12.0872C14.5884 12.152 14.5687 12.2148 14.5363 12.2712C14.504 12.3276 14.4596 12.3763 14.4065 12.4138C14.3533 12.4513 14.2926 12.4767 14.2286 12.4882C14.1646 12.4998 14.0988 12.4972 14.0359 12.4806C13.973 12.464 13.9145 12.4339 13.8644 12.3924C13.8144 12.3508 13.774 12.2988 13.7462 12.24L7.61381 6.10593C7.53801 6.03012 7.44801 5.96999 7.34897 5.92897C7.24993 5.88794 7.14377 5.86683 7.03657 5.86683C6.92936 5.86683 6.82321 5.88794 6.72417 5.92897C6.62512 5.96999 6.53513 6.03012 6.45933 6.10593C6.38352 6.18173 6.32339 6.27173 6.28237 6.37077C6.24134 6.46981 6.22023 6.57597 6.22023 6.68317C6.22023 6.79037 6.24134 6.89653 6.28237 6.99557C6.32339 7.09461 6.38352 7.18461 6.45933 7.26041L10.1015 10.9043C10.1429 10.9457 10.1758 10.9948 10.1982 11.0489C10.2206 11.103 10.2321 11.161 10.2321 11.2196C10.2321 11.2781 10.2206 11.3361 10.1982 11.3902C10.1758 11.4443 10.1429 11.4935 10.1015 11.5349C10.0601 11.5763 10.011 11.6091 9.95687 11.6316C9.90277 11.654 9.84478 11.6655 9.78622 11.6655C9.72766 11.6655 9.66968 11.654 9.61558 11.6316C9.56148 11.6091 9.51232 11.5763 9.47091 11.5349L5.83119 7.89517L4.80167 6.86482C4.64816 6.7122 4.44049 6.62653 4.22402 6.62653C4.00755 6.62653 3.79987 6.7122 3.64636 6.86482C3.57014 6.94031 3.50964 7.03016 3.46835 7.12916C3.42706 7.22817 3.4058 7.33438 3.4058 7.44165C3.4058 7.54892 3.42706 7.65513 3.46835 7.75414C3.50964 7.85315 3.57014 7.94299 3.64636 8.01848L4.6734 9.04551L8.31643 12.6894C8.35789 12.7307 8.39079 12.7797 8.41324 12.8338C8.43569 12.8878 8.44725 12.9458 8.44725 13.0043C8.44725 13.0628 8.43569 13.1207 8.41324 13.1748C8.39079 13.2288 8.35789 13.2779 8.31643 13.3192C8.27524 13.361 8.22615 13.3941 8.17202 13.4168C8.11789 13.4394 8.0598 13.4511 8.00112 13.4511C7.94244 13.4511 7.88435 13.4394 7.83022 13.4168C7.77609 13.3941 7.727 13.3508 7.68581 13.3192L3.79367 12.9964C3.71811 12.9202 3.6282 12.8597 3.52912 12.8184C3.43005 12.7771 3.32377 12.7558 3.21643 12.7558C3.10909 12.7558 3.00281 12.7771 2.90374 12.8184C2.80466 12.8597 2.71475 12.9202 2.63919 12.9964C2.48662 13.1498 2.40097 13.3573 2.40097 13.5737C2.40097 13.79 2.48662 13.9975 2.63919 14.1509L7.04195 18.5537C9.83174 21.3443 12.5371 22.6725 15.7233 19.4855C17.9917 17.2138 18.4312 14.8965 17.0648 12.3989L14.7402 8.30896H14.741Z"></path></svg>
|