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
|
@@ -100,30 +100,14 @@ function switchHDR() {
|
|
|
100
100
|
} else {
|
|
101
101
|
lazyloadItem.removeAttribute("data-hdr-active");
|
|
102
102
|
}
|
|
103
|
-
var innerWrap = lazyloadItem.querySelector(".inner-wrap");
|
|
104
|
-
var placeholder = lazyloadItem.querySelector(".placeholder");
|
|
105
103
|
var InnerImgs = lazyloadItem.querySelectorAll("img");
|
|
106
104
|
InnerImgs.forEach((img) => {
|
|
107
105
|
if (targetState) {
|
|
108
106
|
if (img.src && img.src.includes(SDRPath)) {
|
|
109
|
-
// Re-enter the lazyload visual state while the replacement image
|
|
110
|
-
// is loading. The placeholder remains underneath the image.
|
|
111
|
-
lazyloadItem.classList.remove("loaded");
|
|
112
|
-
if (innerWrap) {
|
|
113
|
-
innerWrap.classList.remove("loaded");
|
|
114
|
-
innerWrap.style.opacity = "0";
|
|
115
|
-
}
|
|
116
|
-
if (placeholder) placeholder.classList.remove("loaded");
|
|
117
107
|
img.src = img.src.replace(SDRPath, HDRPath);
|
|
118
108
|
}
|
|
119
109
|
} else {
|
|
120
110
|
if (img.src && img.src.includes(HDRPath)) {
|
|
121
|
-
lazyloadItem.classList.remove("loaded");
|
|
122
|
-
if (innerWrap) {
|
|
123
|
-
innerWrap.classList.remove("loaded");
|
|
124
|
-
innerWrap.style.opacity = "0";
|
|
125
|
-
}
|
|
126
|
-
if (placeholder) placeholder.classList.remove("loaded");
|
|
127
111
|
img.src = img.src.replace(HDRPath, SDRPath);
|
|
128
112
|
}
|
|
129
113
|
}
|
|
@@ -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.
|