安和Blog

是非成败转头成空

2020年02月23日

Nexmoe移植记录

我就是 copy 怪hhh,大部分样式来自 Hexo 版本

文章归档

所有移植都要从文章归档页面开始说起,看到 Hexo 版本的文章归档页面感觉很好看,于是就开始移植了。
先用 chrome 的F12看下折影大佬站上的有关样式 全部Copy下来
nexmoe-1.png
其实最主要的就是 ::before 样式,其它的抄来也用不了啊hhh
然后整理下需要用到的样式,留下来了这些。

    .nexmoe-archives li {
        position: relative;
        padding: 10px 0;
    }
    .nexmoe-archives li::before {
        content: "";
        width: 14px;
        height: 14px;
        background: #ff4e6a;
        display: inline-block;
        vertical-align: middle;
        margin-top: -2px;
        margin-right: 11px;
        border-radius: 100%;
        border: 3px solid #fff;
        z-index: 100;
        position: relative;
    }
    .nexmoe-archives ul {
        list-style: none;
        padding-left: 0!important;
    }
    .nexmoe-archives li::after {
        content: "";
        height: 100%;
        width: 2px;
        background: rgba(255,78,106,.2);
        position: absolute;
        left: 6px;
        top: 20px;
    }
    .nexmoe-archives span {
        margin-right: 15px;
    }

有了样式了,接下来就是创建归档模板了

<?php 
/**
 * 归档页面
 *
 * @package custom
 */
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this-&gt;need('layout/_partial/head.php'); 
?>

然后全部复制 page.php的内容粘贴到下边,删除掉这些

            <div class="nexmoe-post-cover mdui-ripple"> 
                <?php if ($this->fields->Cover){ ?>
                    <img src="<?php echo $this->fields->Cover ?>">
                <?php }  else{ ?>
                    <img src="<?php echo $this->options->background ?>">
                <?php } ?>
                <h1><?php $this->title() ?></h1>
            </div>
            <div class="nexmoe-post-meta">
                <a><i class="nexmoefont icon-calendar-fill"></i><?php $this->date('Y年n月d日');?></a>
                <a><?php artCount($this->cid);?> 汉字</a>
                <a><?php post_view($this);?> 围观</a>
                <a><?php $this->commentsNum('%d'); ?> 评论</a>
            </div>

然后再把调用评论删掉

 <div id="comments">
                <?php $this->need('comments.php'); ?>
            </div>

这样我们就得到了个空的页面模板,加入typecho的归档,并仿照 Hexo 的日期输出方式进行修改,得到以下代码



              <?php 
    $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);   
    $year=0; $mon=0; $i=0; $j=0;   
    $output = '<div id="archives">';   
    while($archives->next()):   
        $year_tmp = date('Y',$archives->created);   
        $mon_tmp = date('m',$archives->created);   
        $y=$year; $m=$mon;   
        if ($mon != $mon_tmp && $mon > 0) $output .= '</ul></li>';   
        if ($year != $year_tmp && $year > 0) $output .= '</ul>';   
        if ($year != $year_tmp) {   
            $year = $year_tmp;   
            $output .= '<h2 >'. $year .' 年</h2><ul class="article1">'; //输出年份   
        }   
        $output .= '<li><span>'.date('n月d日    ',$archives->created).'</span><a href="'.$archives->permalink .'">'. $archives->title .'</a></li>'; //输出文章日期和标题   
    endwhile;   
    $output .= '</ul></li></ul></div>';
    echo $output;
?>
P.S 这里是把 <?php $this->content(''); ?>替换掉

## 友情链接

这项功能是从原先的Catui上直接搞来的,实现其实很简单,就是把原先 catui 有关 link-area 的样式全都 copy 来,再把页面内的输出也改成 catui 友情链接的输出方式即可。
但是使用后就发现,图片大小太小了。
使用 F12 就可以看到是原先的样式定义了 max-width ,于是在 link-area 的样式上也加一行max-width:115px;

图片是变大了,但发现在手机端时,所有友情链接都会出现偏左的现象。

    
@media screen and (max-width: 850px)
    .link-area a {
        width: calc(33.333333333333336% - 8px);
    }

加一段自适应即可。
但在写本博文时,发现了在 ipad 这种宽屏设备下出现了bug
nexmoe-2.png
于是为了省事,就直接放弃原先的样式,准备从Hexo版本直接Copy,但是输出部分还是需要修改成这样

    <pre>`                                                    <?php
                            $str = preg_replace('#<li>(.*?)</li>#','<li>$1</li>', $this->content);
                          $str = preg_replace('#<li></li>#','<li>$1<a href="$2"><p>$3</p></a>',$str);
                            $str = preg_replace('#<ul>#','<ul>', $str);
                            $str = preg_replace('#</ul>#','</ul>', $str);
                         
                            $str = preg_replace('#<a href="(.*?)">(.*?)</a>#','<a href="$1" class="link-p" target="_blank" >$2</a>',$str);
                            echo $str;
                            ?>

然后在页面顶部增加修改后的样式

<style>
article ul li {
    transition: all .03s;
    width: calc(12.5% - 10px);
    margin: 5px;
    border-radius: 4px;
    border: 1px solid #eee;

    overflow: hidden;
}
.link-p {
 top: 10px;
    font-size: 15px;
    color: #606266;
    -webkit-transition: none;
    transition: none;
 margin-bottom: 5px;
    display: block;
    position: relative;
    width: 100%;
    border: none;
height:30px;
    margin-top: -2px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

article ul {
    list-style-type: none;
    padding: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    margin: -5px;
}

article ul li img {
  height:110px;
    width: 100%;
    border-radius: 0;
    border: none;
    display: block;
}
@media screen and (max-width: 768px) {
article ul li {
    width: calc(33.3333333333% - 10px);
}
</style>

然后就大功告成啦

社交小部件

搞完页面就该搞小部件了,首先可以看到这个主题设计思路很棒hhh,它是用这种方式调用侧边栏小部件的


<aside id="nexmoe-sidebar">
    
  <?php 
    $widget = explode(",",$this->options->widget);
    foreach($widget as $item){
        $this->need('layout/_widget/'.$item.'.php');
    }
  ?>
</aside>

我们只需要在layout/_widget/文件夹新建一个 social.php 文件即可。
代码就直接 Copy Hexo版本的就行了

  <div class="nexmoe-widget nexmoe-social"><a class="mdui-ripple" href="https://space.bilibili.com/20238211" target="_blank" mdui-tooltip="{content: '哔哩哔哩'}" style="color:#e76a8d;background-color:rgba(231,106,141,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-bilibili"></i> </a><a class="mdui-ripple" href="https://github.com/nexmoe/" target="_blank" mdui-tooltip="{content: 'GitHub'}" style="color:#191717;background-color:rgba(25,23,23,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-github"></i> </a><a class="mdui-ripple" href="https://www.zhihu.com/people/chainwon/" target="_blank" mdui-tooltip="{content: '知乎'}" style="color:#1e88e5;background-color:rgba(30,136,229,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-zhihu"></i> </a><a class="mdui-ripple" href="https://t.me/nexmoe" target="_blank" mdui-tooltip="{content: 'Telegram'}" style="color:#27a7e5;background-color:rgba(39,167,229,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-telegram"></i> </a><a class="mdui-ripple" href="https://twitter.com/nexmoe" target="_blank" mdui-tooltip="{content: 'Twitter'}" style="color:#1da1f2;background-color:rgba(29,161,242,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-twitter"></i> </a><a class="mdui-ripple" href="https://steamcommunity.com/id/nexmoe" target="_blank" mdui-tooltip="{content: 'Steam'}" style="color:#0e47a1;background-color:rgba(14,71,161,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-steam"></i> </a><a class="mdui-ripple" href="JavaScript:void(0)" target="_blank" mdui-tooltip="{content: '折影轻梦#5789'}" style="color:#3c57a4;background-color:rgba(60,87,164,.1)"><i class="nexmoefont icon-battlenet"></i> </a><a class="mdui-ripple" href="https://nexmoe.com/atom.xml" target="_blank" mdui-tooltip="{content: 'RSS'}" style="color:#f78422;background-color:rgba(247,132,34,.1)"><i class="nexmoefont icon-rss"></i></a></div>

但这乱七八糟的,没法动,格式化后插入从后台设置的调用

<div class="nexmoe-widget-wrap">
   <h3 class="nexmoe-widget-title">社交按钮</h3> 
   <div class="nexmoe-widget nexmoe-social"> 
<a class="mdui-ripple none1" href="<?php $this->options->bilibili(); ?>" target="_blank" mdui-tooltip="{content: '哔哩哔哩'}" style="color:#e76a8d;background-color:rgba(231,106,141,.1)" rel="external nofollow noopener noreferrer"> <i class="nexmoefont icon-bilibili"></i> </a>
<a class="mdui-ripple none2" href="<?php $this->options->github(); ?>" target="_blank" mdui-tooltip="{content: 'GitHub'}" style="color:#191717;background-color:rgba(25,23,23,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-github"></i> </a>
<a class="mdui-ripple none3" href="<?php $this->options->zhihu(); ?>" target="_blank" mdui-tooltip="{content: '知乎'}" style="color:#1e88e5;background-color:rgba(30,136,229,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-zhihu"></i> </a>
<a class="mdui-ripple none4" href="<?php $this->options->telegram(); ?>" target="_blank" mdui-tooltip="{content: 'Telegram'}" style="color:#27a7e5;background-color:rgba(39,167,229,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-telegram"></i> </a>
<a class="mdui-ripple none5" href="<?php $this->options->twitter(); ?>" target="_blank" mdui-tooltip="{content: 'Twitter'}" style="color:#1da1f2;background-color:rgba(29,161,242,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-twitter"></i> </a>
<a class="mdui-ripple none6" href="<?php $this->options->steam(); ?>" target="_blank" mdui-tooltip="{content: 'Steam'}" style="color:#0e47a1;background-color:rgba(14,71,161,.1)" rel="external nofollow noopener noreferrer"><i class="nexmoefont icon-steam"></i> </a>
<a class="mdui-ripple none7" href="JavaScript:void(0)" target="_blank" mdui-tooltip="{content: '<?php $this->options->game(); ?>'}" style="color:#3c57a4;background-color:rgba(60,87,164,.1)"><i class="nexmoefont icon-battlenet"></i> </a>
<a class="mdui-ripple" href="<?php $this->options->siteUrl(); ?>/feed" target="_blank" mdui-tooltip="{content: 'RSS'}" style="color:#f78422;background-color:rgba(247,132,34,.1)"><i class="nexmoefont icon-rss"></i></a>
   </div>
  </div> 

但这些调用实际上是不存在的,所以要去 functions.php 增加以下代码

$bilibili = new Typecho_Widget_Helper_Form_Element_Text('bilibili', NULL, NULL, _t('哔哩哔哩地址'), _t('社交按钮部件-哔哩哔哩'));
  $form->addInput($bilibili); 
    
  $github = new Typecho_Widget_Helper_Form_Element_Text('github', NULL, NULL, _t('github地址'), _t('社交按钮部件-github'));
  $form->addInput($github); 
      
  $zhihu = new Typecho_Widget_Helper_Form_Element_Text('zhihu', NULL, NULL, _t('知乎地址'), _t('社交按钮部件-知乎'));
  $form->addInput($zhihu); 
      
   $telegram = new Typecho_Widget_Helper_Form_Element_Text('telegram', NULL, NULL, _t('telegram地址'), _t('社交按钮部件-telegram'));
      $form->addInput($telegram); 
      
   $twitter = new Typecho_Widget_Helper_Form_Element_Text('twitter', NULL, NULL, _t('推特地址'), _t('社交按钮部件-推特'));
      $form->addInput($twitter); 
      
       $steam = new Typecho_Widget_Helper_Form_Element_Text('steam', NULL, NULL, _t('steam地址'), _t('社交按钮部件-steam'));
      $form->addInput($steam); 
  
   $game = new Typecho_Widget_Helper_Form_Element_Text('game', NULL, NULL, _t('游戏ID'), _t('社交按钮部件-游戏ID'));
      $form->addInput($game); 

最后的RSS调用,就直接以调用本站链接/feed的方式实现了。
但是运行后发现,rss的图标消失了,我去mdui的图标库并没有找到和 Hexo 版本一样的RSS图标,所以判定是调用了第三方资源。
最后在 Hexo 版本的代码中找到以下代码

@font-face {
      font-family:nexmoefont;src:url(iconfont.eot?t=1581230946722);src:url(iconfont.eot?t=1581230946722#iefix) format('embedded-opentype'),url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAABHUAAsAAAAAIAgAABGEAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCHGAqreKJaATYCJAN4Cz4ABCAFhQUHgmEbYRoz0nLSCgzZf33AjaGQg/oFDojEIHSYKLYXCbYWSTWcwd4bduI62MfahwVbTuryt2hbF/yz2YvgaT9z3t8NwRHKU1GngR0WJKKqcVWtNHUyYVmC4Wmb/+7ecSCod4j2YEpauWFjnahgAOrWp66CzVUgFi6NqD+XHS5++ItGPzdXb+U0vzYAxb8HZvgHlsZleWVfRsVzuq+Ah+EQGtoBy7xtb5HWE2pvgFRsTB2pymlNucAVrpGq/t8Rd0J29mRQ4G0uA5xqufzdc7WqBggYwMHk/mqttDsBQEWwLsKQMO/kzR7ObR/08z7x3gV2Q0BGId3xA7IKsAK0ETYVJaLlx0UYHx/2bu2BFeSiWWqzPP07yydQt80bcra7uKsqY+bABu/o5WPVRJhcMjZUrWVDvrkcn5RUiw/FZYWP3uePqbIbVQqlhGV78+L8maMB9mQy/De4pzm660lY5UdCD5ApesbU2AED1vPEuikW8y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+Y1yuObGurqokkc3xPZz98aIL0oe0nO41uWzbl5LKfeP+vn0EZXGo6UOKkj+lU5Aosl7OlLHcHLpyJBFwLyNHMrRWAwAAAA==') format('woff2'),url(iconfont.woff?t=1581230946722) format('woff'),url(iconfont.ttf?t=1581230946722) format('truetype'),url(iconfont.svg?t=1581230946722#nexmoefont) format('svg')
  }

然后问题又来了,在小尺寸设备,侧边栏收起后的按钮排列方式不怎么好看,于是我进行了如下修改

@media screen and (max-width:599px){
#nexmoe-header .nexmoe-social a {
    margin: 10px!important;
    width: 36px!important;
    height: 36px!important;
    line-height: 36px !important;
}
    }
    @media screen and (max-width:1024px){
        #nexmoe-header .nexmoe-social a {
    margin: 10px;
    width: 45px;
    height: 45px;
    line-height: 45px;
}
    }

到这里,社交小部件的修改也算是大功告成了。

搜索小部件

这个挺简单的,Copy 下Hexo的样式再加入Typecho的代码即可实现

        #nexmoe-header .nexmoe-search input {
        border: none!important;
        background-color: transparent;
        padding: 20px;
        box-sizing: border-box;
        outline: 0;
    }
    [type=search] {
        -webkit-appearance: textfield;
        outline-offset: -2px;
    }
    button, input {
        overflow: visible;
    }
    button, input, optgroup, select, textarea {
        margin: 0;
        font-family: inherit;
        font-size: 100%;
        line-height: 1.15;
    }
</style>
 <div class="nexmoe-widget-wrap">
    <div class="nexmoe-widget nexmoe-search">
            <form class="search" method="post" action="./search" role="search" style="
    margin-bottom: 0px;
"> 
            <input type="search" placeholder="搜索" name="s" class="search-input" >
           </div></div></form>

文章目录

这个功能是做的最久的,毕竟太麻烦了。
弄 PHP 之前先把 html 搞来,得到以下代码

    .nexmoe-valign {
        display: -webkit-box!important;
        display: -webkit-flex!important;
        display: -ms-flexbox!important;
        display: flex!important;
        -webkit-box-align: center!important;
        -webkit-align-items: center!important;
        -ms-flex-align: center!important;
        align-items: center!important;
        height: 100%;
    }
        .mdui-tab-indicator {
            display: none;
        }
        .mdui-tab .mdui-tab-active {
        color: #fff;
        background: #f4a7b9;
        opacity: 1;
    }
    .nexmoe-post-right .nexmoe-toc {
        margin-left: 16px;
        width: 240px;
        margin-left: 0px;
        text-align: left;
    }
    .nexmoe-post-right .nexmoe-toc&gt;ol {
        padding-left: 0;
    }
        .nexmoe-post-right .nexmoe-fixed {
        position: fixed;
        z-index: 1000;
        height: 100vh;
        display: inline-block;
        top: 0;
    }
    .nexmoe-post-right {
        margin: 0 -25px;
        text-align: right;
    }
    .nexmoe-post-right .nexmoe-toc li {
        margin: 1em 0;
    }
    .nexmoe-toc a {
        color: rgba(0,0,0,.6);
    }
    .nexmoe-toc * {
        list-style-type: decimal;
        color: rgba(0,0,0,.6);

    }

然后我觉得再去把百度的Typecho目录弄来就ok了,但谁能想到那代码有Bug,还找不到其它的了,于是就自己改了改,具体方法已经写在上篇文章了Typecho无插件实现目录树

美化代码高亮

这个代码高亮太丑了,真的太丑了...但是换成prism还要大改,于是就先加了一行

hljs {
      font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;
  }

图片灯箱&相册

这个是Catui的功能,毕竟以前是付费主题,所以就没直接开源放出来,我就先自用啦hhh

预览

预览

评论卡

评论区

已有 4 条评论

  1. 鹤别空林
    鹤别空林
    3月19日

    哈哈哈哈操

    回复

    1. 安和
      安和
      3月19日

      小朋友你是否有很多问号

      回复

  2. ventoso
    ventoso
    3月6日

    大佬,我主页直接一篇文章下来,为啥会这样啊,

    回复

    1. 安和
      安和
      3月6日

      文章编辑器里的HR分割线按钮旁边的就是哦~点一下就可以分割摘要和内容了

      回复