`
const img_mds = content.split('\n').filter(item => item.trim().length > 0)
for (let md of img_mds) {
const matches = md.match(/\!\[(.*?)\]\((.*?)\)/i)
diff --git a/scripts/tags/lib/image.js b/scripts/tags/lib/image.js
index bc8ccbf..7cbe449 100644
--- a/scripts/tags/lib/image.js
+++ b/scripts/tags/lib/image.js
@@ -25,10 +25,10 @@ module.exports = ctx => function(args) {
}
// 覆盖配置
if (args.fancybox && args.fancybox.length > 0) {
- if (args.fancybox == 'true') {
- fancybox = true
- } else if (args.fancybox == 'false') {
+ if (args.fancybox == 'false') {
fancybox = false
+ } else {
+ fancybox = args.fancybox
}
}
}
@@ -40,7 +40,7 @@ module.exports = ctx => function(args) {
img += ' alt="' + alt + '"'
}
if (fancybox) {
- img += ' fancybox="true"'
+ img += ` data-fancybox="${fancybox}"`
}
if (style.length > 0) {
img += ' style="' + style + '"'
diff --git a/source/css/_plugins/fancybox.styl b/source/css/_plugins/fancybox.styl
index 38d3d81..4a45238 100644
--- a/source/css/_plugins/fancybox.styl
+++ b/source/css/_plugins/fancybox.styl
@@ -1,6 +1,2 @@
-img[fancybox='true']
+img[data-fancybox]
cursor: zoom-in
-
-.fancybox
- img
- cursor: zoom-in
\ No newline at end of file
diff --git a/source/css/_plugins/lazyload.styl b/source/css/_plugins/lazyload.styl
index f42c4de..f79f12f 100644
--- a/source/css/_plugins/lazyload.styl
+++ b/source/css/_plugins/lazyload.styl
@@ -1,31 +1,16 @@
-trans-cover($p, $t = 0.28s)
- trans2pro: transform 0.5s $p $t
-trans-site($p)
- trans2: box-shadow transform $p
-trans-user($p)
- trans3: box-shadow transform $p
-
-if hexo-config('plugins.lazyload.transition') == 'blur'
- img.lazy
- trans-cover filter
+img.lazy
+ &:not(.loaded)
+ opacity: 0
+ &.loaded,&.error
+ opacity: 1
+ if hexo-config('plugins.lazyload.transition') == 'blur'
+ trans1 all 0.75s
&:not(.loaded)
- filter blur(8px)
- -webkit-filter blur(8px)
+ filter blur(50px)
+ -webkit-filter blur(50px)
&.loaded,&.error
filter none
-webkit-filter none
- .site-card .card-link>img
- trans-site filter
- .user-card .card-link>img
- trans-user filter
-else
- img.lazy
- trans-cover opacity 0.5s
- &:not(.loaded)
- opacity: 0
- &.loaded,&.error
- opacity: 1
- .site-card .card-link>img
- trans-site opacity
- .user-card .card-link>img
- trans-user opacity
+ else
+ trans1 all 0.38s
+
\ No newline at end of file
diff --git a/source/js/main.js b/source/js/main.js
index 6f6cd31..a1dfff1 100644
--- a/source/js/main.js
+++ b/source/js/main.js
@@ -303,24 +303,9 @@ if (stellar.plugins.preload) {
}
}
-function loadFancybox() {
- stellar.loadCSS(stellar.plugins.fancybox.css);
- stellar.loadScript(stellar.plugins.fancybox.js, { defer: true }).then(function () {
- Fancybox.bind(selector, {
- groupAll: true,
- hideScrollbar: false,
- Thumbs: {
- autoStart: false,
- },
- caption: function (fancybox, carousel, slide) {
- return slide.$trigger.alt || null
- }
- });
- })
-}
// fancybox
if (stellar.plugins.fancybox) {
- let selector = 'img[fancybox]:not(.error)';
+ let selector = '[data-fancybox]:not(.error)';
if (stellar.plugins.fancybox.selector) {
selector += `, ${stellar.plugins.fancybox.selector}`
}
@@ -332,16 +317,16 @@ if (stellar.plugins.fancybox) {
}
}
if (needFancybox) {
+ console.log('need fancy', selector, document.querySelectorAll(selector) );
stellar.loadCSS(stellar.plugins.fancybox.css);
stellar.loadScript(stellar.plugins.fancybox.js, { defer: true }).then(function () {
Fancybox.bind(selector, {
- groupAll: true,
hideScrollbar: false,
Thumbs: {
autoStart: false,
},
- caption: function (fancybox, carousel, slide) {
- return slide.$trigger.alt || null
+ caption: (fancybox, slide) => {
+ return slide.triggerEl.alt || null
}
});
})
diff --git a/source/js/plugins/memos.js b/source/js/plugins/memos.js
index 9efa7b1..397a0c8 100644
--- a/source/js/plugins/memos.js
+++ b/source/js/plugins/memos.js
@@ -91,11 +91,10 @@ const MemosJS = {
cell += '
';
for (let img of imgs) {
if (img.externalLink?.length > 0) {
- cell += `
`;
+ cell += `
`;
} else {
- cell += `
`;
+ cell += `
`;
}
-
}
cell += '
';
}