总体来说,由php实现的实时反馈,cookies等渲染,需要替换成由javascript来本地渲染

左侧边栏

时间问候

左侧边栏只有头像右侧名称点击会出现上下午和晚上的问候,去掉即可

/usr/themes/handsome/component/aside.php
注释掉<!-- dropdown -->这一段

右侧边栏

最后活动

右侧边栏的最后活动会定格在缓存那一刻,修改为缓存时间,方便查看页面缓存了多久

/usr/themes/handsome/component/sidebar.php
修改

<li class="list-group-item text-second"><span class="blog-info-icons"> <i data-feather="activity"></i></span> <span
                       class="badge
           pull-right"><?php //echo Utils::getLatestTime($this); ?></span><?php _me("最后活动") ?></li>

修改为

           <li class="list-group-item text-second"><span class="blog-info-icons"> <i data-feather="activity"></i></span> <span
                       class="badge
           pull-right" id="cacheuptime">loading</span><?php _me("缓存时间") ?></li>
           <script>var cacheuptime = '<?=time()*1000?>';</script>

合适位置加上

function getDateDiff(dateTimeStamp){<?php if(Typecho_Widget::widget('Widget_User')->hasLogin()):?>return "ByPsaa";<?php endif;?>var minute=1000*60;var hour=minute*60;var day=hour*24;var halfamonth=day*15;var month=day*30;var now=new Date().getTime();var diffValue=now-dateTimeStamp;var monthC=diffValue/month;var weekC=diffValue/(7*day);var dayC=diffValue/day;var hourC=diffValue/hour;var minC=diffValue/minute;if(hourC>48){result="前天"}else if(hourC>24){result="昨天"}else if(hourC>=1){result=parseInt(hourC)+"个小时前"}else if(minC>=1){result=parseInt(minC)+"分钟前"}else result="刚刚";return result}
function ShowCachetime(){if(typeof(cacheuptime)!=='undefined'){if(cacheuptime>0){$('#cacheuptime').text(getDateDiff(cacheuptime));}cacheuptime=0;}}
ShowCachetime();

如果开启了pjax加载,还需要在pjax回调加入

ShowCachetime();

文章页

页面浏览统计改为javascript方式

评论信息

评论修改为javascript方式获取cookies

最后修改:2020 年 03 月 01 日 12 时 50 分