首页关于归档标签链接👀打卡

🔖订阅本站的RSS


▶️ 🈳 typecho

想试着做一个满足自己需求的主题(大概是复制粘贴吧!)

可以研究一下的东西Typecho语法大全/Typech常用函数/Typecho调用方法

功能

文章目录

functions.php

function createCatalog($obj) {
    global $catalog;
    global $catalog_count;
    $catalog = array();
    $catalog_count = 0;
    $obj = preg_replace_callback('/<h([1-6])(.*?)>(.*?)<\/h\1>/i', function($obj) {
        global $catalog;
        global $catalog_count;
        $catalog_count ++;
        $catalog[] = array('text' => trim(strip_tags($obj[3])), 'depth' => $obj[1], 'count' => $catalog_count);
        return '<h'.$obj[1].$obj[2].'><a name="cl-'.$catalog_count.'"></a>'.$obj[3].'</h'.$obj[1].'>';
    }, $obj);
    return $obj;
}
function getCatalog() {
    global $catalog;
    $index = '';
    if ($catalog) {
        $index = '<ul>'."\n";
        $prev_depth = '';
        $to_depth = 0;
        foreach($catalog as $catalog_item) {
            $catalog_depth = $catalog_item['depth'];
            if ($prev_depth) {
                if ($catalog_depth == $prev_depth) {
                    $index .= '</li>'."\n";
                } elseif ($catalog_depth > $prev_depth) {
                    $to_depth++;
                    $index .= '<ul>'."\n";
                } else {
                    $to_depth2 = ($to_depth > ($prev_depth - $catalog_depth)) ? ($prev_depth - $catalog_depth) : $to_depth;
                    if ($to_depth2) {
                        for ($i=0; $i<$to_depth2; $i++) {
                            $index .= '</li>'."\n".'</ul>'."\n";
                            $to_depth--;
                        }
                    }
                    $index .= '</li>';
                }
            }
            $index .= '<li><a href="#cl-'.$catalog_item['count'].'">'.$catalog_item['text'].'</a>';
            $prev_depth = $catalog_item['depth'];
        }
        for ($i=0; $i<=$to_depth; $i++) {
            $index .= '</li>'."\n".'</ul>'."\n";
        }
    $index = '<div id="toc-container">'."\n".'<div id="toc">'."\n".'<strong>文章目录</strong>'."\n".$index.'</div>'."\n".'</div>'."\n";
    }
    echo $index;
}

把上面的代码放到主题文件functions.php内,然后在functions.php内搜索关键词function themeInit,如果有themeInit这个函数,则在themeInit这个函数内添加下面的代码

有themeInit函数

if ($archive->is('single')) {
    $archive->content = createCatalog($archive->content);
}

无themeInit函数

function themeInit($archive) {
    if ($archive->is('single')) {
        $archive->content = createCatalog($archive->content);
    }
}

调用代码

<?php getCatalog(); ?>

倒计时代码

<Script Language="JavaScript"> 
   var timedate= new Date("May 2,2010"); 
   var times= "唐涛的生日"; 
   var now = new Date(); 
   var date = timedate.getTime() - now.getTime(); 
   var time = Math.floor(date / (1000 * 60 * 60 * 24)); 
   if (time >= 0) 
   document.write( "现在离"+times+"还有: "+time +"天")
</Script>

文章归档页面

<?php
/**
 * 文章存档
 *
 * @package custom
 */
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>
    <div class="col-md-12 text-center">
        <div class="page-header">
            <h2 class="page-title"><?php $this->title() ?></h2>
            <hr>
        </div>
    </div>
    <div class="col-md-12">
        <article class="page-wrapper" itemscope itemtype="http://schema.org/BlogPosting">
            <div class="post-content" itemprop="articleBody">
                <?php
                $stat = Typecho_Widget::widget('Widget_Stat');
                Typecho_Widget::widget('Widget_Contents_Post_Recent', 'pageSize='.$stat->publishedPostsNum)->to($archives);
                $year=0; $mon=0; $i=0; $j=0;
                $output = '<div class="archives">';
                while($archives->next()){
                    $year_tmp = date('Y',$archives->created);
                    $mon_tmp = date('m',$archives->created);
                    $y=$year; $m=$mon;
                    if ($year > $year_tmp || $mon > $mon_tmp) {
                        $output .= '</ul></div>';
                    }
                    if ($year != $year_tmp || $mon != $mon_tmp) {
                        $year = $year_tmp;
                        $mon = $mon_tmp;
                        $output .= '<div class="archives-item"><h4>'.date('Y年m月',$archives->created).'</h4><hr><ul class="archives_list">'; //输出年份
                    }
                    $output .= '<li>'.date('d日',$archives->created).' <a href="'.$archives->permalink .'">'. $archives->title .'</a></li>'; //输出文章
                }
                $output .= '</ul></div></div>';
                echo $output;
                ?>
            </div>
        </article>
    </div><!-- end #main-->
<?php $this->need('footer.php'); ?>

运行时间代码

functions.php

// 设置时区
date_default_timezone_set('Asia/Shanghai');
/**
 * 秒转时间,格式 年 月 日 时 分 秒
 *
 */
function getBuildTime() {
    // 在下面按格式输入本站创建的时间
    $site_create_time = strtotime('2019-12-20 20:00:00');
    $time = time() - $site_create_time;
    if (is_numeric($time)) {
        $value = array(
            "years" => 0, "days" => 0, "hours" => 0,
            "minutes" => 0, "seconds" => 0,
        );
        if ($time >= 31556926) {
            $value["years"] = floor($time / 31556926);
            $time = ($time % 31556926);
        }
        if ($time >= 86400) {
            $value["days"] = floor($time / 86400);
            $time = ($time % 86400);
        }
        if ($time >= 3600) {
            $value["hours"] = floor($time / 3600);
            $time = ($time % 3600);
        }
        if ($time >= 60) {
            $value["minutes"] = floor($time / 60);
            $time = ($time % 60);
        }
        $value["seconds"] = floor($time);

        echo '<span class="btime">'.$value['years'].
        '年'.$value['days'].
        '天'.$value['hours'].
        '小时'.$value['minutes'].
        '分</span>';
    } else {
        echo '';
    }
}

调用代码

<?php getBuildTime(); ?>

时间轴代码

style.css

/* 站点动态时间轴 */
#teamnewslist ol{list-style:none;margin-left: 36px;padding-left: 14px;border-left: 2px solid 
#eee;font-size: 18px;color: #666;}
#teamnewslist b{font-size: 12px;font-weight: normal;color: #999;display: block;position: relative;margin-bottom:5px;}
#teamnewslist b::after{position: absolute;top: 6px;left: -22px;content: '';width: 14px;height: 14px;border-radius: 50%;background-color: #fff;border: 2px solid #ccc;box-shadow: 2px 2px 0 rgba(255,255,255,1), -2px -2px 0 rgba(255,255,255,1)}
#teamnewslist li{list-style:none;margin: 0 0 20px 0;line-height: 100%;}
#teamnewslist li:hover{color: #555;}
#teamnewslist li:hover b::after{border-color: #C01E22;}
#teamnewslist li:hover b{color: #C01E22;}

调用代码

!!!
<h4>
<span style="font-size: 20px; color: #99ccff;">
    <a style="color: #99ccff;text-decoration: none;">2019年</a>
</span>
</h4>
<div id="teamnewslist">
    <ol>
<li><b>2019年10月</b>遭受大规模攻击,导致进入小黑屋三天。收录被K</li>
<li><b>2019年7月</b>修复DUX模板大部分BUG</li>
<li><b>2019年06月</b>完成jinjun.top的域名备案</li>
<li><b>2019年03月</b>腾讯云服务器过期,启用jinjun.top域名</li>
<li><b>2019年01月</b>完成对jinjun.top域名的收购</li>
</ol>
</div>
!!!

编辑页面/编辑文章

编辑页面代码

<?php if($this->user->hasLogin()):?>
  <a href="<?php $this->options->adminUrl(); ?>write-page.php?cid=<?php echo $this->cid;?>">编辑</a>
  <?php endif;?>

编辑文章代码

<?php if($this->user->hasLogin()):?>
  <a href="<?php $this->options->adminUrl(); ?>write-post.php?cid=<?php echo $this->cid;?>">编辑</a>
  <?php endif;?>

直达评论区代码

<li itemprop="interactionCount">
   <a itemprop="discussionUrl" href="<?php $this->permalink() ?>#comments">
   <?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a>
</li>

显示摘要内容

<?php $this->excerpt(); ?>

显示全文内容

<?php $this->content(); ?>

抄了post.php的……不然图片也太大了

<div class="post-content" itemprop="articleBody">
   <?php $this->content(); ?>
</div>

▶️ 🈳 Huawei Mate 30 5G
型号运行内存存储成色磕碰更换价格更换屏幕
Huawei Mate 30 5G8G128GB8新外框掉漆非原装屏摔了,换了个原屏¥630¥650

前几天捞了个工作机Mate30来用

虽然是想着做信号机(因为红米和苹果的信号太差了,经常没信号)

但是顶上了苹果有时候没电,可以继续接单

今天用了一天发现耗电还挺大的,可能是没有带充电宝吧!

昨天有带充电宝,iPhone XR和Mate30轮流充电,就还顶得住

……虽然不知道最近为什么突然旺季了,天天都跑到流油(bushi)

天天都能跑满1张💰

不过我这个工作机屏幕不行,它是换过屏幕的,这个屏幕感应怎么说呢,手感很怪、触摸多少有点问题的,但是不怎么耽误操作就还好啊

Mate30的OS是鸿蒙4.0

点外卖的话,左上角会有个小小的通知,大概类似于灵动岛的感觉吧,我觉得还挺有趣的

不过这个机子确实不行,看看能用多久吧,也不指望它让我用多久~本来就是买来图一乐的

更换屏幕

不小心摔了个稀巴烂,换了个原装屏幕,结果指纹识别跟屎一样。什么玩意啊???


▶️ 🈳 typec扩展坞

看电脑吧公众号推荐了个Type-C扩展坞

正好我想整理一下笔记本使用的USB扩展坞

买了个带很多USB 3.0的扩展坞来帮忙腾一下电脑的USB插口

效果还是不错的,我把一些鼠标键盘的USB插到typec扩展坞上

移动硬盘的USB就还是直接和电脑面对面(以防扩展坞不给力影响硬盘)


再购入!拿来给Mac mini使用


▶️ 🈳 キボウノチカラ~オトナプリキュア`23~, ひきこまり吸血姫の悶々, 私の推しは悪役令嬢。
因为字幕组更新有点慢,一周看一次总会忘了上周看了哪些内容,就给自己记个小笔记

希望的力量~大人的光之美少女`23~

✅第十一集

弱智吧,这个破剧情jpg

东映还是要每天揍一顿比较好,这个翻译,我……我还是等网盘吧

✅第十集

哭笑不得,到这集才意识到“雪城”是一代的姓氏啊,难怪之前那个老奶奶我看着眼熟!

靠,没想起来是我的失误jpg明明一代的我看得还挺喜欢的!

这集还是很那啥,但是这个好像只是月番,坐等明年的魔法使了orz

✅第九集

加重了我想每天给东映一拳的想法!😠

真的不知道东映到底是想写什么剧情,现在都把二三代的关系链搞得很难看,CP也是卖了个寂寞!

好歹三代的CP当时可是吊打了贼久的,结果呢,现在成什么样了

家里蹲吸血姬的苦闷

✅第十集

啊,这集我不太知道在写什么,不过还是一如既往的搞笑,笑死了,差点笑到上气不接下气

✅第九集

乍一看还以为漏看了一集,结果翻了一下记录发现没漏看,怎么回事,怎么突然跳到这里来了🤔️

还是一如既往的搞笑片进展

我推是反派大小姐

✅第十二集

啊,改编到小说的第二卷第四章,完结了吗?

✅第十一集

啧,这个会做到哪里啊,这里不是才第二卷还是第三卷的内容吗……

✅第十集

那个女人终于出现了,挺好的😆


▶️ 🈳 锻炼

原来是左右直拳+左右勾拳+左右摆拳视频

今天我来教大家如何摆拳和勾拳

……慢慢练吧(^^)

先一套50个/天,慢慢练起来吧……

日期组合次数/拳备注
2023.12.09左右直拳100……这么累,我先定个小目标吧
2023.12.10全部100慢慢来吧……肌肉累了我就歇
2023.12.12全部5分钟……做了个操(bushi)昨天搬酒肌肉酸痛,锻炼锻炼为主
2023.12.14全部5分钟肌肉没那么酸痛了,再接再厉