hexo-theme-butterfly/scripts/tag/gallery.js
Jerry f1bf2413a0 breaking changes: 更新 fancybox 到 4
improvement: 網站資料顯示,但標籤和分類為0時,數量顯示為 0,而不是隱藏
improvement: subtitle 代碼優化, 1.當source設為false,同時sub也沒有配置,將會讀取hexo配置文件的 subtitle,2.無須使用轉義字符
improvement: 禁止ios點擊搜索框,頁面放大的問題
2021-08-08 15:36:22 +08:00

35 lines
827 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 not-lightbox">
<img class="gallery-group-img" 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)