hexo-theme-linen 1.0.30 → 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 CHANGED
@@ -278,7 +278,8 @@ const seriesInfo = getSeriesInfo(page?.series);
278
278
  left: 0,
279
279
  right: 0
280
280
  };
281
- const isHDRScreen = window.screen.colorDepth >= 30;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-linen",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "A clean Hexo theme",
5
5
  "main": "index.js",
6
6
  "homepage": "https://github.com/lynanbreeze/hexo-theme-linen",
@@ -10,11 +10,19 @@
10
10
  }
11
11
  .nav-header.is-post {
12
12
  position: fixed;
13
- transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
14
- will-change: transform;
13
+ transform: translateY(0);
14
+ opacity: 1;
15
+ pointer-events: auto;
16
+ transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
17
+ opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
18
+ will-change: transform, opacity;
15
19
  }
16
20
  .nav-header.is-post.hide {
17
21
  transform: translateY(-100%);
22
+ opacity: 0;
23
+ pointer-events: none;
24
+ transition: transform 0.26s cubic-bezier(0.32, 0, 0.67, 0),
25
+ opacity 0.22s ease;
18
26
  }
19
27
  .nav-header .header-inner .right .buttonSet .button.toc {
20
28
  display: block;
@@ -91,11 +99,12 @@
91
99
  .post-series {
92
100
  display: none;
93
101
  }
94
- .nav-header {
95
- transform: translateY(0);
96
- }
102
+ .nav-header,
97
103
  .nav-header.hide {
98
- transform: translateY(0);
104
+ transform: translateY(0) !important;
105
+ opacity: 1 !important;
106
+ pointer-events: auto !important;
107
+ transition: none !important;
99
108
  }
100
109
  }
101
110
  .post-series {
@@ -3,33 +3,33 @@ var hdrEnabled = false;
3
3
  var lang = document.documentElement.getAttribute("lang") || "en";
4
4
 
5
5
  function testHDRSupport() {
6
- const ua = navigator.userAgent;
7
-
8
- // 1. Exclude WeChat
9
- if (/MicroMessenger/i.test(ua)) {
10
- return false;
11
- }
12
-
13
- // 2. Exclude extremely small screen devices
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
- // 4. Modern standard: check dynamic-range media query
26
- if (window.matchMedia) {
27
- const hasHDR = window.matchMedia("(dynamic-range: high)").matches;
28
- if (hasHDR) return true;
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
- // 5. Legacy fallback: check 10-bit color depth
32
- return window.screen.colorDepth >= 30;
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");