mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
feat: 代碼框設置高度限制,展開後按鈕不會消失,可點擊再次摺疊 close #637 feat: 增加 no-lightbox class 偵測,可配置 fancybox 和 medium-zoom 不應用於圖片 #636 fix: 修復開啟 lazyload 時, fancybox 的縮略圖顯示 lazyload 加載圖片的 bug
35 lines
826 B
JavaScript
35 lines
826 B
JavaScript
/**
|
|
* Butterfly
|
|
* galleryGroup and allery
|
|
*/
|
|
|
|
'use strict'
|
|
|
|
const urlFor = require('hexo-util').url_for.bind(hexo)
|
|
|
|
function gallery (args, content) {
|
|
return `<div class="justified-gallery">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
|
|
</div>`
|
|
}
|
|
|
|
function galleryGroup (args) {
|
|
const name = args[0]
|
|
const desrc = args[1]
|
|
const url = urlFor(args[2])
|
|
const img = urlFor(args[3])
|
|
|
|
return `
|
|
<figure class="gallery-group">
|
|
<img class="gallery-group-img no-lightbox" src='${img}' alt="Group Image Gallery">
|
|
<figcaption>
|
|
<div class="gallery-group-name">${name}</div>
|
|
<p>${desrc}</p>
|
|
<a href='${url}'></a>
|
|
</figcaption>
|
|
</figure>
|
|
`
|
|
}
|
|
|
|
hexo.extend.tag.register('gallery', gallery, { ends: true })
|
|
hexo.extend.tag.register('galleryGroup', galleryGroup)
|