hexo-theme-linen 1.0.31 → 1.0.32
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/source/linen-theme/js/hdr.js +22 -22
package/layout/post.ejs
CHANGED
|
@@ -278,7 +278,8 @@ const seriesInfo = getSeriesInfo(page?.series);
|
|
|
278
278
|
left: 0,
|
|
279
279
|
right: 0
|
|
280
280
|
};
|
|
281
|
-
const isHDRScreen = window.
|
|
281
|
+
const isHDRScreen = typeof window.matchMedia === 'function' &&
|
|
282
|
+
window.matchMedia('(dynamic-range: high)').matches;
|
|
282
283
|
const lightbox = new PhotoSwipeLightbox({
|
|
283
284
|
gallery: '#post',
|
|
284
285
|
children: 'a.gallery-item',
|
package/package.json
CHANGED
|
@@ -3,33 +3,33 @@ var hdrEnabled = false;
|
|
|
3
3
|
var lang = document.documentElement.getAttribute("lang") || "en";
|
|
4
4
|
|
|
5
5
|
function testHDRSupport() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (window.screen.width <= 330) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// 3. Exclude macOS Safari (Option A) due to EDR image rendering inconsistencies
|
|
19
|
-
const isMac = /Macintosh|Mac OS X/i.test(ua);
|
|
20
|
-
const isSafari = /^((?!chrome|android).)*safari/i.test(ua);
|
|
21
|
-
if (isMac && isSafari) {
|
|
6
|
+
// `dynamic-range: high` describes the combination of the user agent and the
|
|
7
|
+
// current output device. `screen.colorDepth` alone is not sufficient: a
|
|
8
|
+
// 10-bit framebuffer can still be SDR, and some HDR displays report 8-bit
|
|
9
|
+
// color depth (for example, through FRC or an OS compositor).
|
|
10
|
+
if (
|
|
11
|
+
typeof window.matchMedia !== "function" ||
|
|
12
|
+
!window.matchMedia("(dynamic-range: high)").matches
|
|
13
|
+
) {
|
|
22
14
|
return false;
|
|
23
15
|
}
|
|
24
16
|
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
// There is no web API that exposes "ISO 21496-1 gain map decoding" as a
|
|
18
|
+
// standalone feature. `dynamic-range-limit: no-limit` is the closest
|
|
19
|
+
// standards-based signal: the property applies to HDR images and browsers
|
|
20
|
+
// that implement it have an HDR image rendering pipeline.
|
|
21
|
+
if (
|
|
22
|
+
typeof CSS !== "undefined" &&
|
|
23
|
+
typeof CSS.supports === "function" &&
|
|
24
|
+
CSS.supports("dynamic-range-limit: no-limit")
|
|
25
|
+
) {
|
|
26
|
+
return true;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
//
|
|
32
|
-
|
|
29
|
+
// Do not use a user-agent or color-depth fallback here. Both are only
|
|
30
|
+
// heuristics and can report support when the browser will actually decode
|
|
31
|
+
// an ISO gain map as its SDR base image.
|
|
32
|
+
return false;
|
|
33
33
|
}
|
|
34
34
|
hdrSupport = testHDRSupport();
|
|
35
35
|
const HDRSwitchButton = document.querySelector(".hdr-switch");
|