hexo-theme-linen 1.0.45 → 1.0.47
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 +334 -1
- 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/linen.scss +60 -23
- package/source/linen-theme/js/gitalk/gitalk.css +140 -99
- package/source/linen-theme/js/gitalk/gitalk.min.js +1 -1
- package/source/linen-theme/js/hdr.js +0 -16
- 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);
|
|
@@ -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;
|
|
@@ -280,11 +315,26 @@ const seriesInfo = getSeriesInfo(page?.series);
|
|
|
280
315
|
};
|
|
281
316
|
const isHDRScreen = typeof window.matchMedia === 'function' &&
|
|
282
317
|
window.matchMedia('(dynamic-range: high)').matches;
|
|
318
|
+
let pendingOpenPromise = null;
|
|
283
319
|
const lightbox = new PhotoSwipeLightbox({
|
|
284
320
|
gallery: '#post',
|
|
285
321
|
children: 'a.gallery-item',
|
|
286
322
|
bgOpacity: 1,
|
|
287
323
|
pswpModule: PhotoSwipe,
|
|
324
|
+
openPromise: () => {
|
|
325
|
+
if (pendingOpenPromise) {
|
|
326
|
+
const promise = pendingOpenPromise;
|
|
327
|
+
pendingOpenPromise = null;
|
|
328
|
+
return promise;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const currentIndex = lightbox.options && lightbox.options.index;
|
|
332
|
+
if (typeof currentIndex === 'number' && currentIndex >= 0 && typeof prepareGalleryItemOpenPromise === 'function') {
|
|
333
|
+
const itemData = lightbox.getItemData(currentIndex);
|
|
334
|
+
const target = itemData && itemData.element;
|
|
335
|
+
return prepareGalleryItemOpenPromise(target);
|
|
336
|
+
}
|
|
337
|
+
},
|
|
288
338
|
paddingFn: (viewportSize) => {
|
|
289
339
|
return viewportSize.x < 700 ? smallScreenPadding : largeScreenPadding
|
|
290
340
|
},
|
|
@@ -539,6 +589,272 @@ const seriesInfo = getSeriesInfo(page?.series);
|
|
|
539
589
|
</div>`;
|
|
540
590
|
}
|
|
541
591
|
|
|
592
|
+
const isElementInImageGridItem = (element) => {
|
|
593
|
+
const gridItem = element && element.closest && element.closest('.grid-item');
|
|
594
|
+
return Boolean(gridItem && gridItem.closest && gridItem.closest('.image-grid'));
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
let headerWasHiddenByLightbox = false;
|
|
598
|
+
|
|
599
|
+
const isImageBlockedByFixedHeader = (element) => {
|
|
600
|
+
if (!element) return false;
|
|
601
|
+
const header = document.querySelector('.nav-header');
|
|
602
|
+
if (!header) return false;
|
|
603
|
+
const style = window.getComputedStyle(header);
|
|
604
|
+
if (style.position !== 'fixed' || header.classList.contains('hide')) {
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
const headerHeight = header.offsetHeight || 65;
|
|
608
|
+
const target = (typeof getScrollTarget === 'function' ? getScrollTarget(element) : null) || element;
|
|
609
|
+
const rect = target.getBoundingClientRect();
|
|
610
|
+
return rect.top < headerHeight && rect.bottom > 0;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
const hideFixedHeaderOnGalleryClick = (target) => {
|
|
614
|
+
if (!isImageBlockedByFixedHeader(target)) {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
const header = document.querySelector('.nav-header');
|
|
618
|
+
if (!header) return false;
|
|
619
|
+
headerWasHiddenByLightbox = true;
|
|
620
|
+
header.classList.add('hide');
|
|
621
|
+
return true;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
const getFixedHeaderHeight = () => {
|
|
625
|
+
const header = document.querySelector('.nav-header');
|
|
626
|
+
if (!header) return 0;
|
|
627
|
+
const style = window.getComputedStyle(header);
|
|
628
|
+
if (style.position !== 'fixed' || header.classList.contains('hide')) {
|
|
629
|
+
return 0;
|
|
630
|
+
}
|
|
631
|
+
return header.offsetHeight || 65;
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
const getScrollDelta = (element) => {
|
|
635
|
+
if (!element) {
|
|
636
|
+
return { deltaX: 0, deltaY: 0, scrollContainer: null, target: null };
|
|
637
|
+
}
|
|
638
|
+
const target = (typeof getScrollTarget === 'function' ? getScrollTarget(element) : null) || element;
|
|
639
|
+
const rect = target.getBoundingClientRect();
|
|
640
|
+
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
641
|
+
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
642
|
+
|
|
643
|
+
const scrollContainer = target.closest && target.closest('.image-grid.scroll, .image-grid.slider');
|
|
644
|
+
let deltaX = 0;
|
|
645
|
+
|
|
646
|
+
if (scrollContainer) {
|
|
647
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
648
|
+
const targetCenter = rect.left + rect.width / 2;
|
|
649
|
+
const containerCenter = containerRect.left + containerRect.width / 2;
|
|
650
|
+
deltaX = targetCenter - containerCenter;
|
|
651
|
+
} else {
|
|
652
|
+
if (rect.left < 0) {
|
|
653
|
+
deltaX = rect.left;
|
|
654
|
+
} else if (rect.right > windowWidth) {
|
|
655
|
+
deltaX = rect.right - windowWidth;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const headerHeight = getFixedHeaderHeight();
|
|
660
|
+
const topSafePadding = headerHeight > 0 ? headerHeight + 16 : 16;
|
|
661
|
+
let deltaY = 0;
|
|
662
|
+
|
|
663
|
+
if (rect.top < topSafePadding) {
|
|
664
|
+
deltaY = rect.top - topSafePadding;
|
|
665
|
+
} else if (rect.bottom > windowHeight) {
|
|
666
|
+
const desiredDeltaY = rect.bottom - windowHeight + 16;
|
|
667
|
+
const maxAllowedDeltaY = rect.top - topSafePadding;
|
|
668
|
+
deltaY = Math.min(desiredDeltaY, maxAllowedDeltaY);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return { deltaX, deltaY, scrollContainer, target };
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
const waitForScrollEnd = (scrollContainer, needsScrollX, needsScrollY) => {
|
|
675
|
+
return new Promise((resolve) => {
|
|
676
|
+
let resolved = false;
|
|
677
|
+
let rafId = null;
|
|
678
|
+
let startTimer = null;
|
|
679
|
+
let maxTimer = null;
|
|
680
|
+
|
|
681
|
+
let hasMoved = false;
|
|
682
|
+
let hasMovedX = false;
|
|
683
|
+
let hasMovedY = false;
|
|
684
|
+
let idleFrames = 0;
|
|
685
|
+
let lastX = scrollContainer ? scrollContainer.scrollLeft : 0;
|
|
686
|
+
let lastY = window.pageYOffset;
|
|
687
|
+
|
|
688
|
+
const finish = () => {
|
|
689
|
+
if (resolved) return;
|
|
690
|
+
resolved = true;
|
|
691
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
692
|
+
clearTimeout(startTimer);
|
|
693
|
+
clearTimeout(maxTimer);
|
|
694
|
+
if (scrollContainer) {
|
|
695
|
+
scrollContainer.removeEventListener('scrollend', onContainerScrollEnd);
|
|
696
|
+
}
|
|
697
|
+
window.removeEventListener('scrollend', onWindowScrollEnd);
|
|
698
|
+
|
|
699
|
+
window.requestAnimationFrame(() => {
|
|
700
|
+
window.requestAnimationFrame(resolve);
|
|
701
|
+
});
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
const onContainerScrollEnd = () => {
|
|
705
|
+
if (!needsScrollY || !hasMovedY) {
|
|
706
|
+
finish();
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
const onWindowScrollEnd = () => {
|
|
711
|
+
if (!needsScrollX || !hasMovedX) {
|
|
712
|
+
finish();
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
maxTimer = setTimeout(finish, 800);
|
|
717
|
+
|
|
718
|
+
startTimer = setTimeout(() => {
|
|
719
|
+
if (!hasMoved) {
|
|
720
|
+
finish();
|
|
721
|
+
}
|
|
722
|
+
}, 160);
|
|
723
|
+
|
|
724
|
+
const check = () => {
|
|
725
|
+
if (resolved) return;
|
|
726
|
+
|
|
727
|
+
const currX = scrollContainer ? scrollContainer.scrollLeft : 0;
|
|
728
|
+
const currY = window.pageYOffset;
|
|
729
|
+
|
|
730
|
+
const diffX = Math.abs(currX - lastX);
|
|
731
|
+
const diffY = Math.abs(currY - lastY);
|
|
732
|
+
|
|
733
|
+
if (needsScrollX && diffX > 0.5) {
|
|
734
|
+
hasMoved = true;
|
|
735
|
+
hasMovedX = true;
|
|
736
|
+
}
|
|
737
|
+
if (needsScrollY && diffY > 0.5) {
|
|
738
|
+
hasMoved = true;
|
|
739
|
+
hasMovedY = true;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
if (hasMoved) {
|
|
743
|
+
const isIdleX = !needsScrollX || diffX <= 0.5;
|
|
744
|
+
const isIdleY = !needsScrollY || diffY <= 0.5;
|
|
745
|
+
|
|
746
|
+
if (isIdleX && isIdleY) {
|
|
747
|
+
idleFrames++;
|
|
748
|
+
if (idleFrames >= 6) {
|
|
749
|
+
finish();
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
} else {
|
|
753
|
+
idleFrames = 0;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
lastX = currX;
|
|
758
|
+
lastY = currY;
|
|
759
|
+
|
|
760
|
+
rafId = requestAnimationFrame(check);
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
if (scrollContainer) {
|
|
764
|
+
scrollContainer.addEventListener('scrollend', onContainerScrollEnd, { once: true, passive: true });
|
|
765
|
+
}
|
|
766
|
+
window.addEventListener('scrollend', onWindowScrollEnd, { once: true, passive: true });
|
|
767
|
+
|
|
768
|
+
rafId = requestAnimationFrame(check);
|
|
769
|
+
});
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
const prepareGalleryItemOpenPromise = (target) => {
|
|
773
|
+
if (!target) {
|
|
774
|
+
return null;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
const isBlocked = isImageBlockedByFixedHeader(target);
|
|
778
|
+
const inGrid = isElementInImageGridItem(target);
|
|
779
|
+
|
|
780
|
+
// Neither blocked by fixed nav-header nor inside an image-grid; open lightbox immediately
|
|
781
|
+
if (!isBlocked && !inGrid) {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// Hide nav-header early on click only when the item is blocked by it
|
|
786
|
+
const headerDidStartHiding = isBlocked ? hideFixedHeaderOnGalleryClick(target) : false;
|
|
787
|
+
|
|
788
|
+
let deltaX = 0;
|
|
789
|
+
let deltaY = 0;
|
|
790
|
+
let scrollContainer = null;
|
|
791
|
+
|
|
792
|
+
if (inGrid) {
|
|
793
|
+
const scrollInfo = getScrollDelta(target);
|
|
794
|
+
deltaX = scrollInfo.deltaX;
|
|
795
|
+
deltaY = scrollInfo.deltaY;
|
|
796
|
+
scrollContainer = scrollInfo.scrollContainer;
|
|
797
|
+
} else if (isBlocked) {
|
|
798
|
+
// Non-grid image blocked by header: smooth scroll down if top edge overflows above viewport (< 16px)
|
|
799
|
+
const scrollTarget = (typeof getScrollTarget === 'function' ? getScrollTarget(target) : null) || target;
|
|
800
|
+
const rect = scrollTarget.getBoundingClientRect();
|
|
801
|
+
if (rect.top < 16) {
|
|
802
|
+
deltaY = rect.top - 16;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
const needsScrollX = Boolean(scrollContainer && Math.abs(deltaX) > 6);
|
|
807
|
+
const needsScrollY = Math.abs(deltaY) > 6;
|
|
808
|
+
const needsScroll = needsScrollX || needsScrollY;
|
|
809
|
+
|
|
810
|
+
if (!needsScroll) {
|
|
811
|
+
if (headerDidStartHiding) {
|
|
812
|
+
return new Promise((resolve) => {
|
|
813
|
+
setTimeout(resolve, 180);
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
return null;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const prefersReducedMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
820
|
+
const behavior = prefersReducedMotion ? 'instant' : 'smooth';
|
|
821
|
+
|
|
822
|
+
if (needsScrollX && scrollContainer) {
|
|
823
|
+
if (typeof scrollContainer.scrollBy === 'function') {
|
|
824
|
+
scrollContainer.scrollBy({ left: deltaX, behavior });
|
|
825
|
+
} else {
|
|
826
|
+
scrollContainer.scrollLeft += deltaX;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
if (needsScrollY) {
|
|
831
|
+
if (typeof window.scrollBy === 'function') {
|
|
832
|
+
window.scrollBy({ top: deltaY, behavior });
|
|
833
|
+
} else {
|
|
834
|
+
window.scroll(0, window.pageYOffset + deltaY);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
if (behavior === 'instant') {
|
|
839
|
+
return new Promise((resolve) => {
|
|
840
|
+
window.requestAnimationFrame(() => {
|
|
841
|
+
window.requestAnimationFrame(resolve);
|
|
842
|
+
});
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
return waitForScrollEnd(scrollContainer, needsScrollX, needsScrollY);
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
lightbox.addFilter('clickedIndex', (index, event) => {
|
|
850
|
+
if (index >= 0) {
|
|
851
|
+
const clickedEl = event && event.target && (event.target.closest ? event.target : event.target.parentElement);
|
|
852
|
+
const target = clickedEl && clickedEl.closest && (clickedEl.closest('a.gallery-item') || clickedEl.closest('.gallery-item'));
|
|
853
|
+
pendingOpenPromise = prepareGalleryItemOpenPromise(target);
|
|
854
|
+
}
|
|
855
|
+
return index;
|
|
856
|
+
});
|
|
857
|
+
|
|
542
858
|
lightbox.addFilter('itemData', (itemData) => {
|
|
543
859
|
const livePhotoSrc = itemData && itemData.element && itemData.element.dataset && itemData.element.dataset.livePhotoSrc;
|
|
544
860
|
if (!livePhotoSrc) {
|
|
@@ -623,6 +939,23 @@ const seriesInfo = getSeriesInfo(page?.series);
|
|
|
623
939
|
lightbox.on('closingAnimationEnd', () => {
|
|
624
940
|
setPswpLivePhotoClosing(false);
|
|
625
941
|
window.requestAnimationFrame(restorePageLivePhotoTriggers);
|
|
942
|
+
if (headerWasHiddenByLightbox) {
|
|
943
|
+
const header = document.querySelector('.nav-header');
|
|
944
|
+
if (header) {
|
|
945
|
+
header.classList.remove('hide');
|
|
946
|
+
}
|
|
947
|
+
headerWasHiddenByLightbox = false;
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
lightbox.on('destroy', () => {
|
|
952
|
+
if (headerWasHiddenByLightbox) {
|
|
953
|
+
const header = document.querySelector('.nav-header');
|
|
954
|
+
if (header) {
|
|
955
|
+
header.classList.remove('hide');
|
|
956
|
+
}
|
|
957
|
+
headerWasHiddenByLightbox = false;
|
|
958
|
+
}
|
|
626
959
|
});
|
|
627
960
|
|
|
628
961
|
lightbox.on('change', (e) => {
|
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) {
|
|
@@ -330,9 +330,31 @@ body {
|
|
|
330
330
|
}
|
|
331
331
|
&.hdr-switch {
|
|
332
332
|
background-image: url("../img/icons/hdr.svg");
|
|
333
|
-
background-size:
|
|
333
|
+
background-size: contain;
|
|
334
|
+
background-repeat: no-repeat;
|
|
335
|
+
background-position: center;
|
|
334
336
|
cursor: pointer;
|
|
335
337
|
position: relative;
|
|
338
|
+
transition: opacity 0.2s ease;
|
|
339
|
+
|
|
340
|
+
&:hover {
|
|
341
|
+
opacity: 0.75;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&::before {
|
|
345
|
+
content: "";
|
|
346
|
+
position: absolute;
|
|
347
|
+
inset: 0;
|
|
348
|
+
background: linear-gradient(90deg, #ff6ec4, #7873f5, #4ade80);
|
|
349
|
+
-webkit-mask: url("../img/icons/hdr.svg") no-repeat center;
|
|
350
|
+
mask: url("../img/icons/hdr.svg") no-repeat center;
|
|
351
|
+
-webkit-mask-size: contain;
|
|
352
|
+
mask-size: contain;
|
|
353
|
+
opacity: 0;
|
|
354
|
+
transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
355
|
+
pointer-events: none;
|
|
356
|
+
}
|
|
357
|
+
|
|
336
358
|
&::after {
|
|
337
359
|
content: "";
|
|
338
360
|
display: block;
|
|
@@ -340,22 +362,26 @@ body {
|
|
|
340
362
|
height: 2px;
|
|
341
363
|
position: absolute;
|
|
342
364
|
top: 50%;
|
|
343
|
-
|
|
344
|
-
|
|
365
|
+
margin-top: -1px;
|
|
366
|
+
left: 2%;
|
|
345
367
|
background-color: #232323;
|
|
346
|
-
transition: all ease-in-out 0.3s;
|
|
347
368
|
border-radius: 2px;
|
|
369
|
+
transform: rotate(37deg) scaleX(1);
|
|
370
|
+
transform-origin: center;
|
|
348
371
|
opacity: 1;
|
|
372
|
+
transition:
|
|
373
|
+
transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
374
|
+
opacity 0.25s ease;
|
|
375
|
+
pointer-events: none;
|
|
349
376
|
}
|
|
377
|
+
|
|
350
378
|
&.hdr_on {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
-webkit-mask-size: contain;
|
|
355
|
-
mask-size: contain;
|
|
379
|
+
&::before {
|
|
380
|
+
opacity: 1;
|
|
381
|
+
}
|
|
356
382
|
&::after {
|
|
357
383
|
opacity: 0;
|
|
358
|
-
transform: rotate(0);
|
|
384
|
+
transform: rotate(37deg) scaleX(0);
|
|
359
385
|
}
|
|
360
386
|
}
|
|
361
387
|
}
|
|
@@ -1547,6 +1573,10 @@ body {
|
|
|
1547
1573
|
}
|
|
1548
1574
|
}
|
|
1549
1575
|
#gitalk-container {
|
|
1576
|
+
--gt-avatar-size: 2.25rem;
|
|
1577
|
+
@media (max-width: 479px) {
|
|
1578
|
+
--gt-avatar-size: 2rem;
|
|
1579
|
+
}
|
|
1550
1580
|
margin-top: $postWidgetGap;
|
|
1551
1581
|
padding: 0 $commonPadding;
|
|
1552
1582
|
background-color: #fff;
|
|
@@ -1567,11 +1597,11 @@ body {
|
|
|
1567
1597
|
.gt-comments {
|
|
1568
1598
|
padding-top: $commonPadding;
|
|
1569
1599
|
.gt-comment {
|
|
1570
|
-
--comment-content-indent: calc(
|
|
1600
|
+
--comment-content-indent: calc(var(--gt-avatar-size) + 1rem);
|
|
1571
1601
|
display: grid;
|
|
1572
|
-
grid-template-columns:
|
|
1602
|
+
grid-template-columns: var(--gt-avatar-size) minmax(0, 1fr);
|
|
1573
1603
|
grid-template-rows: auto auto auto auto;
|
|
1574
|
-
column-gap:
|
|
1604
|
+
column-gap: 1rem;
|
|
1575
1605
|
align-items: start;
|
|
1576
1606
|
padding: 1.5em 0;
|
|
1577
1607
|
border-bottom: solid 1px rgb(242, 242, 242);
|
|
@@ -1585,9 +1615,15 @@ body {
|
|
|
1585
1615
|
grid-column: 1;
|
|
1586
1616
|
grid-row: 1 / span 2;
|
|
1587
1617
|
align-self: center;
|
|
1618
|
+
width: var(--gt-avatar-size);
|
|
1619
|
+
height: var(--gt-avatar-size);
|
|
1588
1620
|
border-radius: 50%;
|
|
1589
1621
|
|
|
1590
1622
|
img {
|
|
1623
|
+
display: block;
|
|
1624
|
+
width: 100%;
|
|
1625
|
+
height: 100%;
|
|
1626
|
+
object-fit: cover;
|
|
1591
1627
|
border-radius: 50%;
|
|
1592
1628
|
}
|
|
1593
1629
|
}
|
|
@@ -1606,7 +1642,7 @@ body {
|
|
|
1606
1642
|
grid-row: 1;
|
|
1607
1643
|
line-height: 1.5;
|
|
1608
1644
|
position: relative;
|
|
1609
|
-
top:
|
|
1645
|
+
top: 0;
|
|
1610
1646
|
}
|
|
1611
1647
|
.gt-comment-text {
|
|
1612
1648
|
display: none;
|
|
@@ -1615,7 +1651,7 @@ body {
|
|
|
1615
1651
|
grid-column: 2;
|
|
1616
1652
|
grid-row: 2;
|
|
1617
1653
|
position: relative;
|
|
1618
|
-
top:
|
|
1654
|
+
top: 0;
|
|
1619
1655
|
margin: 0.2em 0 0;
|
|
1620
1656
|
}
|
|
1621
1657
|
.gt-comment-body {
|
|
@@ -1637,7 +1673,7 @@ body {
|
|
|
1637
1673
|
height: 1.5em;
|
|
1638
1674
|
line-height: 1;
|
|
1639
1675
|
margin-top: 1.1em;
|
|
1640
|
-
transform: translateX(calc(-1 * var(--comment-content-indent)
|
|
1676
|
+
transform: translateX(calc(-1 * var(--comment-content-indent)));
|
|
1641
1677
|
}
|
|
1642
1678
|
.gt-comment-edit,
|
|
1643
1679
|
.gt-comment-reply {
|
|
@@ -1720,13 +1756,13 @@ body {
|
|
|
1720
1756
|
}
|
|
1721
1757
|
@media (max-width: 479px) {
|
|
1722
1758
|
.gt-comment {
|
|
1723
|
-
--comment-content-indent: calc(
|
|
1724
|
-
grid-template-columns:
|
|
1725
|
-
column-gap: 0.
|
|
1759
|
+
--comment-content-indent: calc(var(--gt-avatar-size) + 0.875rem);
|
|
1760
|
+
grid-template-columns: var(--gt-avatar-size) minmax(0, 1fr);
|
|
1761
|
+
column-gap: 0.875rem;
|
|
1726
1762
|
}
|
|
1727
1763
|
.gt-comment-avatar {
|
|
1728
|
-
width:
|
|
1729
|
-
height:
|
|
1764
|
+
width: var(--gt-avatar-size);
|
|
1765
|
+
height: var(--gt-avatar-size);
|
|
1730
1766
|
}
|
|
1731
1767
|
}
|
|
1732
1768
|
a:not([class]) {
|
|
@@ -2353,7 +2389,7 @@ body {
|
|
|
2353
2389
|
.copyright-popover-content {
|
|
2354
2390
|
position: absolute;
|
|
2355
2391
|
bottom: 100%;
|
|
2356
|
-
right: -
|
|
2392
|
+
right: -30px;
|
|
2357
2393
|
margin-bottom: 10px;
|
|
2358
2394
|
width: 280px;
|
|
2359
2395
|
max-width: calc(100vw - 32px);
|
|
@@ -2410,7 +2446,7 @@ body {
|
|
|
2410
2446
|
.copyright-popover-arrow {
|
|
2411
2447
|
position: absolute;
|
|
2412
2448
|
bottom: -5px;
|
|
2413
|
-
right:
|
|
2449
|
+
right: 35px;
|
|
2414
2450
|
transform: rotate(45deg);
|
|
2415
2451
|
width: 8px;
|
|
2416
2452
|
height: 8px;
|
|
@@ -3429,6 +3465,7 @@ html[lang="zh-CN"] {
|
|
|
3429
3465
|
width: 100%;
|
|
3430
3466
|
display: inline-block;
|
|
3431
3467
|
vertical-align: middle;
|
|
3468
|
+
scroll-margin-top: calc(#{$navbarMinHeight} + 16px);
|
|
3432
3469
|
}
|
|
3433
3470
|
}
|
|
3434
3471
|
|