hexo-theme-butterfly/scripts/tag/button.js
Jerry c67b4304d2 breaking changes: 更改 rightside-bottom 為 rightside_bottom
feat: 置頂圖標改為在標題左側
feat: 可配置打賞按鈕的文字
feat: 側邊欄增加 系列文章顯示
feat: 增加 series 系列文章 標籤外掛
feat: 移除 addthis 分享
improvement: 代碼優化
improvement: tabs 標籤外掛的回到頂部箭頭位置調整
improvement: 更新 plugin.yml
2023-06-24 16:12:23 +08:00

21 lines
602 B
JavaScript

/**
* Button
* {% btn url text icon option %}
* option: color outline center block larger
* color : default/blue/pink/red/purple/orange/green
*/
'use strict'
const urlFor = require('hexo-util').url_for.bind(hexo)
const btn = args => {
args = args.join(' ').split(',')
const [url = '', text = '', icon = '', option = ''] = args.map(arg => arg.trim())
return `<a class="btn-beautify ${option}" href="${urlFor(url)}"
title="${text}">${icon.length ? `<i class="${icon}"></i>` : ''}${text.length ? `<span>${text}</span>` : ''}</a>`
}
hexo.extend.tag.register('btn', btn, { ends: false })