hexo-theme-butterfly/scripts/tag/button.js
Jerry 850c825fcf feat: toc 間隔調整, 直接子元素增加豎線辨識 closed #723
fix: 修復 toc 在小設備上顯示出屏幕外的 bug
fix: 修復在打賞按鈕周圍也會觸發打賞彈窗的 bug
fix: Waline 最近評論的時間只顯示 "剛剛" 的問題 (以docker的方式執行) #730
fix: 修復點擊右下角顯示按鈕時,按鈕沒有出現的 bug
remove: 移除 button 的 hover 效果
2021-12-22 22:39:27 +08:00

29 lines
714 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)
function btn (args) {
args = args.join(' ').split(',')
let url = args[0] || ''
let text = args[1] || ''
let icon = args[2] || ''
let option = args[3] || ''
url = url.trim()
text = text.trim()
icon = icon.trim()
option = option.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 })