mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
feat: 點擊文字特效增加隨機配置 feat: 可配置是否添加css前綴 fix: 修復子目錄下,配置justifiedGallery CDN(相對鏈接)後,連接會無法訪問的bugs fix: 修復 pangu 配置post 後,仍在全站生效的bugs improvement: 夜間模式下,廣告降低亮度 improvement: 手機端toc邊距微調 improvement: html格式優化 improvement: 搜索優化 improvement: 刪除不必要的語言文件
35 lines
814 B
JavaScript
35 lines
814 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" 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)
|