hexo-theme-nblog 1.2.1 → 1.2.2

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/_config.yml CHANGED
@@ -63,8 +63,6 @@ footer_links:
63
63
  - name: 版权协议
64
64
  path: /posts/copyright/
65
65
 
66
- posts_per_page: 10
67
-
68
66
  twikoo:
69
67
  enable: false
70
68
  envId: https://xxx
@@ -26,10 +26,10 @@
26
26
  <%= theme.author || config.author %>
27
27
  </span>. All rights reserved.
28
28
  </p>
29
- <div class="footer__busuanzi">
30
- <span id="busuanzi_container_site_pv">本站总访问量 <span id="busuanzi_value_site_pv"></span> 次</span>
31
- <span class="footer__busuanzi-divider">|</span>
32
- <span id="busuanzi_container_site_uv">访客数 <span id="busuanzi_value_site_uv"></span> 人次</span>
29
+ <div class="footer__vercount">
30
+ <span id="vercount_container_site_pv">本站总访问量 <span id="vercount_value_site_pv"></span> 次</span>
31
+ <span class="footer__vercount-divider">|</span>
32
+ <span id="vercount_container_site_uv">访客数 <span id="vercount_value_site_uv"></span> 人次</span>
33
33
  </div>
34
34
  </div>
35
35
  <div class="footer__right">
@@ -46,4 +46,4 @@
46
46
  </div>
47
47
  </div>
48
48
  </footer>
49
- <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
49
+ <script async src="https://cn.vercount.one/js"></script>
@@ -1,8 +1,6 @@
1
1
  <% var license=page.license || theme.default_license || 'CC BY-NC-SA 4.0' ; var author=page.author || theme.author ||
2
2
  config.author || '作者' ; var isOriginal=page.original !==false; var sourceUrl=page.source_url || '' ; var
3
- licenseInfo={ 'CC BY-NC-SA 4.0' : { name: 'CC BY-NC-SA 4.0' ,
4
- url: 'https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh' , desc: '署名-非商业性使用-相同方式共享 4.0 国际' } }; var
5
- currentLicense=licenseInfo[license] || licenseInfo['CC BY-NC-SA 4.0']; %>
3
+ currentLicense=license || 'CC BY-NC-SA 4.0' ; %>
6
4
  <div class="post-license animate-fade-in-up animate-delay-2">
7
5
  <div class="post-license__header">
8
6
  <span class="copyright-symbol">©</span>
@@ -33,8 +31,8 @@
33
31
  <% } %>
34
32
  <div class="post-license__notice">
35
33
  <% if (isOriginal) { %>
36
- 本文为作者原创文章,遵循 <a href="<%= currentLicense.url %>" target="_blank" rel="noopener">
37
- <%= currentLicense.name %>
34
+ 本文为作者原创文章,遵循 <a target="_blank" rel="noopener">
35
+ <%= currentLicense %>
38
36
  </a> 许可协议,转载请注明出处。
39
37
  <% } else { %>
40
38
  本文仅供学习交流使用,版权归原作者所有,侵权请联系删除
package/layout/layout.ejs CHANGED
@@ -60,7 +60,7 @@
60
60
  <link rel="stylesheet" href="<%= url_for('/css/markdown.css') %>">
61
61
  <link rel="stylesheet" href="<%= url_for('/css/highlight.css') %>">
62
62
  <link rel="stylesheet" href="<%= url_for('/css/admonition.css') %>">
63
- <% if (theme.twikoo && theme.twikoo.enable) { %>
63
+ <% if (theme.twikoo && theme.twikoo.enable && page.comments !==false) { %>
64
64
  <link rel="stylesheet" href="<%= url_for('/css/twikoo.css') %>">
65
65
  <% } %>
66
66
  <% } %>
@@ -106,10 +106,10 @@
106
106
  <script defer src="<%= url_for('/js/lazyload.js') %>"></script>
107
107
  <% } %>
108
108
  <% if (theme.medium_zoom && theme.medium_zoom.enable) { %>
109
- <script defer src="<%= url_for('/js/lib/medium-zoom.min.js') %>"></script>
109
+ <script defer src="<%= url_for('/lib/js/medium-zoom.min.js') %>"></script>
110
110
  <% } %>
111
111
  <% if (theme.pjax && theme.pjax.enable) { %>
112
- <script defer src="<%= url_for('/js/lib/pjax.min.js') %>"></script>
112
+ <script defer src="<%= url_for('/lib/js/pjax.min.js') %>"></script>
113
113
  <script>
114
114
  document.addEventListener('DOMContentLoaded', function () {
115
115
  if (typeof Pjax !== 'undefined') {
@@ -133,7 +133,7 @@
133
133
  if (typeof initPage === 'function') {
134
134
  initPage();
135
135
  }
136
- if (typeof twikoo !== 'undefined' && twikoo.init) {
136
+ if (typeof twikoo !== 'undefined' && twikoo.init && document.querySelector('#twikoo-comment')) {
137
137
  twikoo.init({
138
138
  envId: '<%= theme.twikoo.envId %>',
139
139
  el: '#twikoo-comment'
@@ -144,8 +144,8 @@
144
144
  });
145
145
  </script>
146
146
  <% } %>
147
- <% if (is_post() && theme.twikoo && theme.twikoo.enable) { %>
148
- <script defer src="<%= url_for('/js/lib/twikoo.all.min.js') %>"></script>
147
+ <% if (is_post() && theme.twikoo && theme.twikoo.enable && page.comments !==false) { %>
148
+ <script defer src="<%= url_for('/lib/js/twikoo.all.min.js') %>"></script>
149
149
  <script>
150
150
  document.addEventListener('DOMContentLoaded', function () {
151
151
  if (typeof twikoo !== 'undefined' && twikoo.init) {
package/layout/post.ejs CHANGED
@@ -20,8 +20,7 @@
20
20
  <header class="post-header animate-fade-in-up">
21
21
  <% if (page.cover) { %>
22
22
  <div class="post-header__cover">
23
- <img data-src="<%= page.cover %>" alt="<%= page.title %>" <%=theme.medium_zoom && theme.medium_zoom.enable
24
- ? ' data-zoomable' : '' %>>
23
+ <img data-src="<%= page.cover %>" alt="<%= page.title %>">
25
24
  </div>
26
25
  <% } %>
27
26
  <h1 class="post-header__title">
@@ -128,7 +127,7 @@
128
127
  </nav>
129
128
  </div>
130
129
 
131
- <% if (theme.twikoo && theme.twikoo.enable) { %>
130
+ <% if (theme.twikoo && theme.twikoo.enable && page.comments !== false) { %>
132
131
  <section class="post-comments animate-fade-in-up animate-delay-4">
133
132
  <div id="twikoo-comment"></div>
134
133
  </section>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-nblog",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "A lightweight and minimalist blog theme",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,7 +8,6 @@
8
8
  box-shadow: var(--shadow-sm);
9
9
  overflow: hidden;
10
10
  border: 1px solid var(--border-color);
11
- border-left: 4px solid var(--admonition-color, var(--primary-color));
12
11
  transition: all var(--transition-normal);
13
12
  }
14
13
 
@@ -25,7 +24,7 @@
25
24
  font-weight: 600;
26
25
  font-size: 0.95rem;
27
26
  color: var(--admonition-color, var(--primary-color));
28
- margin: 0;
27
+ margin: 0 !important;
29
28
  transition: background var(--transition-fast);
30
29
  }
31
30
 
@@ -39,7 +38,7 @@
39
38
  }
40
39
 
41
40
  .admonition-content {
42
- padding: 12px 16px;
41
+ padding: 16px 12px;
43
42
  color: var(--text-primary);
44
43
  }
45
44
 
@@ -66,6 +65,7 @@
66
65
  }
67
66
 
68
67
  .admonition.anote .admonition-title {
68
+ margin-bottom: 0em;
69
69
  color: var(--primary-dark);
70
70
  }
71
71
 
@@ -1,10 +1,10 @@
1
1
  .highlight {
2
- background: #282c34;
2
+ background: var(--surface-color);
3
3
  border-radius: 10px;
4
4
  margin: 1em 0;
5
5
  overflow-x: auto;
6
6
  position: relative;
7
- font-family: Consolas, Menlo, 'Fira Code', monospace;
7
+ font-family: 'Fira Code', Consolas, Menlo, monospace;
8
8
  }
9
9
 
10
10
  .highlight .gutter {
@@ -1,7 +1,6 @@
1
1
  .lazyload-wrapper {
2
2
  position: relative;
3
3
  overflow: hidden;
4
- background: var(--surface-color);
5
4
  border-radius: var(--border-radius);
6
5
  }
7
6
 
@@ -150,11 +149,6 @@ img[data-src].lazyload-loaded {
150
149
  border-radius: 50%;
151
150
  }
152
151
 
153
- .markdown-body .lazyload-wrapper,
154
- .post-body .lazyload-wrapper {
155
- margin: 16px 0;
156
- }
157
-
158
152
  .markdown-body .lazyload-image,
159
153
  .post-body .lazyload-image {
160
154
  display: block;
@@ -130,7 +130,7 @@ button {
130
130
  }
131
131
 
132
132
  .material-card:hover {
133
- transform: translateY(-2px);
133
+ transform: translateY(-1px);
134
134
  box-shadow: var(--shadow-lg);
135
135
  }
136
136
 
@@ -505,6 +505,7 @@ button {
505
505
  display: flex;
506
506
  justify-content: space-between;
507
507
  align-items: flex-end;
508
+ white-space: nowrap;
508
509
  }
509
510
 
510
511
  .footer__left {
@@ -532,7 +533,7 @@ button {
532
533
 
533
534
  .footer__copyright,
534
535
  .footer__themeInfo {
535
- font-size: 14px;
536
+ font-size: 12px;
536
537
  color: var(--text-secondary);
537
538
  display: flex;
538
539
  flex-direction: row;
@@ -560,7 +561,7 @@ button {
560
561
 
561
562
  .footer__links a {
562
563
  padding: 0;
563
- font-size: 13px;
564
+ font-size: 11px;
564
565
  text-decoration: none;
565
566
  transition: color var(--transition-fast);
566
567
  }
@@ -583,12 +584,12 @@ button {
583
584
  .footer__rss,
584
585
  .footer__sitemap {
585
586
  color: var(--primary-color);
586
- font-size: 14px;
587
+ font-size: 12px;
587
588
  text-decoration: none;
588
589
  }
589
590
 
590
591
  .footer__powered {
591
- font-size: 13px;
592
+ font-size: 11px;
592
593
  color: var(--text-secondary);
593
594
  display: flex;
594
595
  align-items: center;
@@ -599,17 +600,17 @@ button {
599
600
  text-decoration: none;
600
601
  }
601
602
 
602
- .footer__busuanzi {
603
- font-size: 14px;
603
+ .footer__vercount {
604
+ font-size: 12px;
604
605
  color: var(--text-secondary);
605
606
  }
606
607
 
607
- .footer__busuanzi #busuanzi_value_site_pv,
608
- .footer__busuanzi #busuanzi_value_site_uv {
608
+ .footer__vercount #vercount_value_site_pv,
609
+ .footer__vercount #vercount_value_site_uv {
609
610
  color: var(--primary-dark);
610
611
  }
611
612
 
612
- .footer__busuanzi-divider {
613
+ .footer__vercount-divider {
613
614
  margin: 0 8px;
614
615
  }
615
616
 
@@ -760,15 +761,10 @@ button {
760
761
  .notification-banner__content {
761
762
  position: relative;
762
763
  min-height: 44px;
763
- cursor: grab;
764
764
  user-select: none;
765
765
  transition: height 0.3s ease;
766
766
  }
767
767
 
768
- .notification-banner__content:active {
769
- cursor: grabbing;
770
- }
771
-
772
768
  .notification-banner__item {
773
769
  position: absolute;
774
770
  top: 0;
@@ -1027,6 +1023,21 @@ button {
1027
1023
  border-color: var(--primary-color);
1028
1024
  }
1029
1025
 
1026
+ .pagination .space {
1027
+ display: inline-flex;
1028
+ align-items: center;
1029
+ justify-content: center;
1030
+ min-width: 40px;
1031
+ height: 40px;
1032
+ padding: 0 12px;
1033
+ border-radius: var(--border-radius-sm);
1034
+ font-size: 14px;
1035
+ color: var(--text-secondary);
1036
+ background: var(--surface-color);
1037
+ border: 1px solid var(--border-color);
1038
+ transition: all var(--transition-fast);
1039
+ }
1040
+
1030
1041
  .page-header {
1031
1042
  text-align: center;
1032
1043
  padding: 40px 0;
@@ -1159,7 +1170,7 @@ button {
1159
1170
  }
1160
1171
 
1161
1172
  .post-footer__tag {
1162
- font-size: 14px;
1173
+ font-size: 12px;
1163
1174
  color: var(--primary-color);
1164
1175
  padding: 4px 12px;
1165
1176
  background: var(--border-color);
@@ -2238,22 +2249,8 @@ html:hover {
2238
2249
  position: relative;
2239
2250
  z-index: 1;
2240
2251
  white-space: nowrap;
2241
- transition: color var(--transition-fast);
2242
2252
  }
2243
2253
 
2244
2254
  .post-license__notice a::before {
2245
- content: '';
2246
- position: absolute;
2247
- bottom: 0;
2248
- left: 0;
2249
- width: 100%;
2250
- height: 0;
2251
- background: var(--btn-plain-bg-hover);
2252
- transition: height var(--transition-fast);
2253
- transform-origin: bottom;
2254
- z-index: -1;
2255
- }
2256
-
2257
- .post-license__notice a:hover::before {
2258
- height: 100%;
2255
+ height: 0%;
2259
2256
  }
@@ -10,7 +10,7 @@
10
10
  .post-body h4,
11
11
  .post-body h5,
12
12
  .post-body h6 {
13
- margin-top: 1.5em;
13
+ margin-top: 1em;
14
14
  margin-bottom: 0.5em;
15
15
  font-weight: 600;
16
16
  line-height: 1.4;
@@ -26,6 +26,7 @@
26
26
  color: var(--primary-color);
27
27
  font-weight: normal;
28
28
  opacity: 1;
29
+ bottom: -0.5em;
29
30
  transition: opacity var(--transition-fast);
30
31
  border-bottom: none;
31
32
  position: relative;
@@ -111,14 +112,13 @@
111
112
  position: relative;
112
113
  z-index: 1;
113
114
  transition: color var(--transition-fast);
114
- bottom: -0.55em;
115
+ bottom: -0.65em;
115
116
  right: 0.1em;
116
117
  word-break: break-word;
117
118
  }
118
119
 
119
120
  .post-body a::before {
120
121
  position: absolute;
121
- bottom: 0;
122
122
  left: 0;
123
123
  width: 100%;
124
124
  height: 0;
@@ -145,20 +145,11 @@
145
145
  .post-body ul,
146
146
  .post-body ol {
147
147
  margin-bottom: 1em;
148
- padding-left: 1em;
149
148
  }
150
149
 
151
150
  .post-body li {
152
151
  margin-bottom: 0.5em;
153
- }
154
-
155
- .post-body li::marker {
156
- color: var(--primary-color);
157
- }
158
-
159
- .post-body li>strong,
160
- .post-body li>a {
161
- display: inline-flex;
152
+ display: flex;
162
153
  align-items: center;
163
154
  }
164
155
 
@@ -176,109 +167,38 @@
176
167
  }
177
168
 
178
169
  .post-body code {
179
- font-family: Consolas, Menlo, 'Fira Code', monospace;
180
170
  font-size: 0.9em;
181
171
  padding: 0.2em 0.4em;
182
172
  margin: 0em 0.4em;
183
- background: var(--border-color);
184
- border-radius: 10px;
173
+ background: var(--primary-light);
174
+ border-radius: 5px;
185
175
  color: var(--primary-color);
186
176
  }
187
177
 
188
- .post-body pre {
189
- margin: 1em 0;
190
- padding: 0;
191
- background: #282c34;
192
- border-radius: 10px;
193
- overflow: hidden;
194
- font-family: Consolas, Menlo, 'Fira Code', monospace;
195
- }
196
-
197
- .post-body pre code {
198
- padding: 0;
199
- background: transparent;
200
- font-size: 0.9em;
201
- line-height: 1.6;
202
- color: inherit;
203
- font-family: Consolas, Menlo, 'Fira Code', monospace;
204
- }
205
-
206
- .post-body .highlight {
207
- margin: 1em 0;
208
- border-radius: 10px;
209
- overflow-x: auto;
210
- background: #282c34;
211
- padding: 1em;
212
- position: relative;
213
- font-family: Consolas, Menlo, 'Fira Code', monospace;
214
- }
215
-
216
- .post-body .highlight pre {
217
- margin: 0;
218
- padding: 0;
219
- background: transparent;
220
- font-family: Consolas, Menlo, 'Fira Code', monospace;
221
- white-space: pre;
222
- }
223
-
224
178
  .post-body .highlight code {
225
179
  padding: 0;
226
180
  background: transparent;
227
181
  color: inherit;
228
- font-family: Consolas, Menlo, 'Fira Code', monospace;
229
182
  white-space: pre;
230
183
  }
231
184
 
232
- .post-body .highlight table {
233
- margin: 0;
234
- border: none;
235
- }
236
-
237
- .post-body .highlight table tr {
238
- background: transparent;
239
- }
240
-
241
- .post-body .highlight table td {
242
- padding: 0;
243
- border: none;
244
- }
245
-
246
- .post-body .highlight .gutter {
247
- width: 20px;
248
- padding-right: 5px;
249
- border-right: 1px solid #3e4451;
250
- text-align: right;
251
- user-select: none;
252
- }
253
-
254
- .post-body .highlight .gutter pre {
255
- padding: 0 0.5em 0 0.5em;
256
- }
257
-
258
- .post-body .highlight .gutter .line {
259
- color: #5c6370;
260
- }
261
-
262
- .post-body .highlight .code pre {
263
- padding: 0 0 0 0.5em;
264
- }
265
-
266
- .post-body .highlight .line {
267
- height: 1.6em;
268
- line-height: 1.6;
185
+ .post-body pre,
186
+ code {
187
+ font-family: Consolas, Menlo, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
269
188
  }
270
189
 
271
190
  .post-body .highlight-wrap {
272
191
  position: relative;
273
192
  margin: 1em 0;
274
193
  border-radius: 10px;
275
- background: #282c34;
194
+ background-color: var(--border-color);
276
195
  overflow-x: auto;
196
+ font-family: Consolas, Menlo, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
277
197
  }
278
198
 
279
199
  .post-body .highlight-wrap .highlight {
280
- margin: 5px;
281
- padding: 5px;
200
+ margin: 0px;
201
+ padding: 0px;
282
202
  overflow-x: auto;
283
203
  overflow-y: hidden;
284
204
  }
@@ -314,20 +234,11 @@
314
234
  border-color: #98c379;
315
235
  }
316
236
 
317
- .post-body .highlight .code,
318
- .post-body .highlight .gutter {
319
- user-select: none;
320
- }
321
-
322
- .post-body .highlight .code pre {
323
- user-select: text;
324
- }
325
-
326
237
  .post-body img {
327
- max-width: 100%;
238
+ width: 100%;
328
239
  height: auto;
329
240
  border-radius: var(--border-radius-sm);
330
- margin: 1em 0;
241
+ margin: 0;
331
242
  }
332
243
 
333
244
  .post-body .medium-zoom-image {
@@ -364,7 +275,6 @@
364
275
 
365
276
  .post-body table {
366
277
  width: 100%;
367
- margin: 1em 0;
368
278
  border-collapse: collapse;
369
279
  border-radius: var(--border-radius-sm);
370
280
  overflow: hidden;
@@ -374,7 +284,6 @@
374
284
  .post-body td {
375
285
  padding: 12px 16px;
376
286
  text-align: left;
377
- border: 1px solid var(--border-color);
378
287
  }
379
288
 
380
289
  .post-body th {
@@ -455,10 +364,6 @@
455
364
  font-size: 15px;
456
365
  }
457
366
 
458
- .post-body pre {
459
- font-size: 0.85em;
460
- }
461
-
462
367
  .post-body table {
463
368
  display: block;
464
369
  overflow-x: auto;
@@ -115,6 +115,19 @@
115
115
  img.removeAttribute('data-src');
116
116
  img.removeAttribute('data-srcset');
117
117
 
118
+ if (img.hasAttribute('data-zoomable') && typeof mediumZoom !== 'undefined') {
119
+ img.classList.add('medium-zoom-image');
120
+ var globalZoom = window.mediumZoomInstance;
121
+ if (!globalZoom) {
122
+ window.mediumZoomInstance = mediumZoom('.medium-zoom-image', {
123
+ margin: 24,
124
+ background: getComputedStyle(document.documentElement).getPropertyValue('--bg-color') || '#fff'
125
+ });
126
+ } else {
127
+ globalZoom.attach(img);
128
+ }
129
+ }
130
+
118
131
  img.dispatchEvent(new CustomEvent('lazyload:loaded', {
119
132
  bubbles: true,
120
133
  detail: { img: img }
package/source/js/main.js CHANGED
@@ -249,7 +249,7 @@
249
249
  }
250
250
 
251
251
  const script = document.createElement('script');
252
- script.src = '/js/lib/highlight.min.js';
252
+ script.src = '/lib/js/highlight.min.js';
253
253
  script.onload = callback;
254
254
  document.head.appendChild(script);
255
255
  }
@@ -257,24 +257,31 @@
257
257
  function applyHighlight(element, language) {
258
258
  if (!window.hljs) return;
259
259
 
260
- const codeElement = element.querySelector('code') || element.querySelector('.code pre') || element.querySelector('pre');
260
+ const codeElement = element.querySelector('.code code') || element.querySelector('code');
261
261
  if (!codeElement) return;
262
262
 
263
- let codeText = codeElement.textContent || codeElement.innerText;
263
+ let codeText;
264
+ const tempEl = codeElement.cloneNode(true);
265
+ tempEl.querySelectorAll('br').forEach(br => br.replaceWith('\n'));
266
+ codeText = tempEl.textContent || tempEl.innerText;
264
267
 
265
- element.innerHTML = '';
268
+ const gutter = element.querySelector('.gutter');
269
+ const lines = codeText.split('\n');
270
+ if (lines.length > 0 && lines[lines.length - 1] === '') {
271
+ lines.pop();
272
+ }
273
+ const lineCount = lines.length;
274
+
275
+ if (gutter) {
276
+ gutter.innerHTML = '<pre>' + Array.from({ length: lineCount }, (_, i) => `<span class="line">${i + 1}</span><br>`).join('') + '</pre>';
277
+ }
266
278
 
267
- const pre = document.createElement('pre');
268
- const code = document.createElement('code');
269
- code.className = language ? `hljs language-${language}` : 'hljs';
270
- code.textContent = codeText;
271
- pre.appendChild(code);
272
- element.appendChild(pre);
279
+ codeElement.textContent = codeText;
273
280
 
274
281
  if (language && hljs.getLanguage(language)) {
275
- hljs.highlightElement(code);
282
+ hljs.highlightElement(codeElement);
276
283
  } else {
277
- hljs.highlightElement(code);
284
+ hljs.highlightElement(codeElement);
278
285
  }
279
286
  }
280
287
 
@@ -366,7 +373,7 @@
366
373
  document.head.appendChild(link);
367
374
 
368
375
  const script = document.createElement('script');
369
- script.src = '/js/lib/tocbot.min.js';
376
+ script.src = '/lib/js/tocbot.min.js';
370
377
  script.onload = callback;
371
378
  document.head.appendChild(script);
372
379
  }
@@ -538,6 +545,8 @@
538
545
  setTimeout(updateTocPosition, 500);
539
546
  }
540
547
 
548
+ let zoomInstance = null;
549
+
541
550
  function initMediumZoom() {
542
551
  if (typeof mediumZoom === 'undefined') return;
543
552
 
@@ -550,19 +559,23 @@
550
559
  images.forEach(img => {
551
560
  if (img.closest('a')) return;
552
561
  if (img.classList.contains('medium-zoom-image')) return;
562
+ if (img.hasAttribute('data-src')) return;
553
563
  img.classList.add('medium-zoom-image');
554
564
  });
555
565
 
556
566
  document.querySelectorAll('[data-zoomable]').forEach(function (img) {
557
- if (!img.classList.contains('medium-zoom-image')) {
567
+ if (!img.classList.contains('medium-zoom-image') && !img.hasAttribute('data-src')) {
558
568
  img.classList.add('medium-zoom-image');
559
569
  }
560
570
  });
561
571
 
562
- mediumZoom('.medium-zoom-image', {
563
- margin: 24,
564
- background: getComputedStyle(document.documentElement).getPropertyValue('--bg-color') || '#fff'
565
- });
572
+ if (!zoomInstance) {
573
+ zoomInstance = mediumZoom('.medium-zoom-image', {
574
+ margin: 24,
575
+ background: getComputedStyle(document.documentElement).getPropertyValue('--bg-color') || '#fff'
576
+ });
577
+ window.mediumZoomInstance = zoomInstance;
578
+ }
566
579
  }
567
580
 
568
581
  function initPage() {