mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
improvement: 文章頁標題改為h1(seo) improvement: 改用hexo 內置的 injector 插入 inject 的代碼 improvement: canonical 改為hexo提供的函數生成 improvement: 優化手機toc 的特效和按鈕出現的時機 remove: 刪除搜索不必要的配置 remove: 移除豆瓣配置,如需配置,請使用 hexo-butterfly-douban fix: 修復上一個版本導致的搜索按鈕在pjax下無法點擊的bugs close #387 fix: 修復上一個版本更新的toc z-index 過低的bugs
29 lines
717 B
JavaScript
29 lines
717 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 button--animated ${option}" href="${urlFor(url)}"
|
|
title="${text}">${icon.length > 0 ? `<i class="${icon} fa-fw"></i>` : ''}<span>${text}</span></a>`
|
|
}
|
|
|
|
hexo.extend.tag.register('btn', btn, { ends: false })
|