前言

为了下次升级能够更快的恢复原来的配置,特地记录此次更新。

复制原文件

  • 将原主题文件中source文件夹内文件复制到升级后的主题中(css和js文件夹除外)。
  • 将原主题文件中scripts\tags中btns及timeline复制到升级后的主题中

修改主题配置文件

修改顺序依次为:

  • menu:l9

  • copy:l41

  • social:l50

  • local_search:l70

  • avatar:l101

  • xxx_img:l106-l…

  • cover:l129

  • error_404:l164

  • reward:l212

  • comments:l270

  • footer::l396

  • background:l504

  • click_heart:l555

  • beautify:l571

  • hr_icon:l592

  • subtitle:l598

  • aside:l624

  • runtimeshow:l670

  • baidu_push:l788

  • inject:l830

  • CDN--valine:l843

    其它修改

  • mian.js
    增加如下代码:

    1
    2
    3
    4
    5
    6
    // 隐藏首页banner图
    var full_page = document.getElementsByClassName("full_page");
    if (full_page.length != 0) {
    full_page[0].style.background = "transparent";
    }

  • var.styl

$card-bg
$body-bg

  • background

\Butterfly\layout\includes\layout.pug

找到代码:

1
2
if theme.background
- var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color'

修改:

1
2
if theme.background
- var is_photo = 'photo'

找到代码:

1
2
footer#footer(style=footer_bg data-type=is_bg)
!=partial('includes/footer', {}, {cache:theme.fragment_cache})

在其下方增加代码后:

1
2
3
4
5
footer#footer(style=footer_bg data-type=is_bg)
!=partial('includes/footer', {}, {cache:theme.fragment_cache})
#if !is_post()
script() var bg_index = Math.floor(Math.random() * #{theme.background_num});var res = 'background-image: url("/img/banner/' + bg_index + '.jpg"); background-attachment: fixed;';document.getElementById('web_bg').style = res

if !is_post()表示文章页面不采用随机背景

修改完毕后在配置文件中将background设置为任意颜色,并添加代码:

1
2
3
# 随机背景图banner的数量
background_num: 14

  • valine
    修改主题配置文件以及themes\butterfly\layout\includes\comments\valine.pug

  • footer
    \themes\butterfly\layout\includes\footer.pug

    1
    2
    3
    4
    if theme.footer.owner.since && theme.footer.owner.since != nowYear
    .copyright!= `©${theme.footer.owner.since} - ${nowYear} By ${config.author}`
    else
    .copyright!= `©${nowYear} By ${config.author}`

    修改为

    1
    2
    3
    4
    if theme.footer.owner.since && theme.footer.owner.since != nowYear
    .copyright!= `&copy;${theme.footer.owner.since} - ${nowYear} <i style="color:#FF6A6A" class="fa fa-heartbeat"></i> ${config.author}`
    else
    .copyright!= `&copy;${nowYear} <i style="color:#FF6A6A;animation: announ_animation 0.8s linear infinite;" class="fa fa-heartbeat"></i> ${config.author}`