1. \themes\butterfly\source\js目录下新建funny_title.js文件,添加:

     1var OriginTitle = document.title;
     2var titleTime;
     3document.addEventListener('visibilitychange', function () {
     4    if (document.hidden) {
     5        $('[rel="icon"]').attr('href', "/funny.ico");
     6        document.title = '╭(°A°`)╮ 怎么走了 ~';
     7        clearTimeout(titleTime);
     8    }
     9    else {
    10        $('[rel="icon"]').attr('href', "/favicon.ico");
    11        document.title = '(ฅ>ω<*ฅ) 欢迎回来 ~' + OriginTitle;
    12        titleTime = setTimeout(function () {
    13            document.title = OriginTitle;
    14        }, 2000);
    15    }
    16});
    
  2. 在主题配置文件_config.butterfly.ymlinject,在bottom直接引入js文件

    1- <script src="/js/funny_title.js"></script>