|ω・) 屏幕太小了,换个大点的吧

如果您看到这篇文章,表示您的 blog 已经安装成功.

今天正式搬家到typecho,zblog停更,将陆续迁移到此处

以后会在这里记录一些修改Typecho的教程

隐藏博主评论

在评论所在的位置,如本主题的footer.phpWidget_Comments_Recent所在位置
然后将

$this->widget('Widget_Comments_Recent')->to($comments);

改为

widget('Widget_Comments_Recent','ignoreAuthor=true')->to($comments);

获取访客真实IP(相对)

将以下代码添加到站点根目录的config.inc.php

//绕过 CDN 代理IP获取客户真实IP地址
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];
}

邮件插件通知模板

部分仿QQ样式

<div style="margin: 16px 40px; background-color: #eef2fa; border: 1px solid #d8e3e8; padding: 0 15px;  -moz-border-radius:5px; -webkit-border-radius:5px; -khtml-border-radius:5px; border-radius:5px;">
    <p style="font-size:18px;font-weight:400;">在援军博客的&nbsp;<a target="_blank" href="{permalink}">{title}</a>&nbsp;有新的回复</p>
    <div style="color: #777777;
    border: 5px solid #EEF2FF;
    margin-top: -20px;
    font-size: 12px;">本邮件为{siteTitle}Mail自动发送,请勿直接回复<br>如有疑问,请<a href="mailto:{contactme}" target="_blank" style="color:#0e0e70">联系我</a> 。</div>

        <p style="color:#008040">{author_p}</p>
        <p>{text_p}</p>
    <p style="color:#0100fe">{author}&nbsp;{time}</p>
        <p>{text}</p>

</div>

修改gravatar头像源

var/Typecho/Common.php文件的第937行,将两个地址替换为其他镜像站

if (defined('__TYPECHO_GRAVATAR_PREFIX__')) {
            $url = __TYPECHO_GRAVATAR_PREFIX__;
        } else {
            $url = $isSecure ? 'https://cdn.v2ex.com/gravatar/' : 'https://gravatar.loli.net/avatar/';
        }

添加评论区预览

效果可能不是很好,我只是为了评论区不缺一块硬加上的而已……

<h3 id="response"><?php _e('添加新评论');
            ?><small>(点击头像可修改/隐藏信息框)</small></h3>
        <form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form">
            <?php if ($this->remember('author',true)): ?><?php $guestinfo = "display:none"?><?php else :?><?php $guestinfo = "display:block";
            ?><?php endif;
            ?>
            <?php if ($this->user->hasLogin()): ?>
            <p>
                <?php _e('登录身份: ');
                ?><a href="<?php $this->options->profileUrl();
                    ?>"><?php $this->user->screenName();
                    ?></a>. <a href="<?php $this->options->logoutUrl();
                    ?>" title="Logout"><?php _e('退出');
                    ?> &raquo;</a>
            </p>
            <?php else : ?>
            <div id="guestinfo" class="guest-info" style="<?php echo $guestinfo ?>">
                <script src="https://cdnjs.loli.net/ajax/libs/marked/0.6.2/marked.min.js"></script>
                <script>var rendererMD = new marked.Renderer();</script>    
                    <input type="text" name="author" id="author" class="text" style="width:275px;margin:10px 0" placeholder="昵称*" value="<?php $this->remember('author');
                    ?>" required />

                    <input type="email" name="mail" id="mail" class="text" style="width:275px;margin:10px 10px" placeholder="邮箱*" value="<?php $this->remember('mail');
                    ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif;
                    ?> />

                    <br>
                    <input type="url" name="url" id="url" class="text" style="width:275px;margin:10px 0" placeholder="<?php _e('http://');
                    ?>" value="<?php $this->remember('url');
                    ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif;
                    ?> />

                    <input type="button" name="preview" id="preview" class="preview" onclick="acpreview()" value="预览" />
            </div>
            <?php endif;
            ?>
                <div class="user-face">
                    <img id="userface" src="<?php if ($this->user->hasLogin()): ?><?php _e('https://gravatar.loli.net/avatar/'.md5($this->author->mail))?><?php elseif ($this->remember('mail',true)): _e('https://gravatar.loli.net/avatar/'.md5($this->remember('mail',true)));
                    else :_e('https://i.loli.net/2018/10/28/5bd55579d2d72.png')?><?php endif;
                    ?>">
                </div>
                <div id="preview-box" class="preview-box" ></div>
                <textarea rows="8" cols="50" name="text" id="textarea" class="textarea" required><?php $this->remember('text');
                    ?></textarea>

                <button type="submit" class="comment-submit"><?php _e('提交评论');
                    ?></button>
                <div id="OwO" class="OwO"></div>
        </form>

下面是搭配的js

//评论区预览
function acpreview(){
    if($('#preview-box').is(':visible')){
        $('#preview').css({'background-color':'#f4f5f7','color':'#99a2aa'});
    }else{
        $('#preview').css({'background-color':'#00a1d6','color':'#fff'});
    }
    $('#preview-box').slideToggle();
}
$('#textarea').on('change', function () { var md = $('#textarea').val();var html = marked(md);$('#preview-box').html(html); });

适配的是Bilispace主题,比较主要的代码是:

<script src="https://cdnjs.loli.net/ajax/libs/marked/0.6.2/marked.min.js"></script>
                <script>var rendererMD = new marked.Renderer();</script>

//评论区预览
function acpreview(){
    if($('#preview-box').is(':visible')){
        $('#preview').css({'background-color':'#f4f5f7','color':'#99a2aa'});
    }else{
        $('#preview').css({'background-color':'#00a1d6','color':'#fff'});
    }
    $('#preview-box').slideToggle();
}
$('#textarea').on('change', function () { var md = $('#textarea').val();var html = marked(md);$('#preview-box').html(html); });

搬家 新的开始

仅有一条评论

  1. Typecho
    Typecho

    欢迎加入 Typecho 大家族

添加新评论(点击头像可修改/隐藏信息框)