Skip to content

Commit

Permalink
update 1.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wehaox committed Jan 20, 2023
1 parent 04b4c34 commit 088cb16
Show file tree
Hide file tree
Showing 16 changed files with 266 additions and 201 deletions.
4 changes: 2 additions & 2 deletions css/style.css
Expand Up @@ -479,8 +479,8 @@ code[class*="language-"], pre[class*="language-"] {
}
#card-newest-comments > .aside-list>.aside-list-item .thumbnail>img{
border-radius: 50%;
width: 53px;
height: 53px;
width: 50px!important;
height: 50px!important;
}

#card-newest-comments > .aside-list>.aside-list-item .thumbnail>img:hover {
Expand Down
11 changes: 6 additions & 5 deletions footer.php
Expand Up @@ -70,7 +70,7 @@
<?php $this->options->CustomBodyEnd() ?>
<!--搜索 -->
<div id="local-search">
<div class="search-dialog" style="">
<div class="search-dialog">
<nav class="search-nav">
<span class="search-dialog-title">本地搜索</span>
<span id="loading-status"></span>
Expand Down Expand Up @@ -173,8 +173,8 @@ function butterfly_swiper_injector_config() {
$html=$html.'<div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="'.$ji->permalink.'" alt=""><img width="48" height="48" src="'.get_ArticleThumbnail($ji).'" alt="" /></a><div class="blog-slider__content"><span class="blog-slider__code">'.date('Y-m-d', $ji->modified).'</span><a class="blog-slider__title" href="'.$ji->permalink.'" alt="'.$ji->title.'">'.$ji->title.'</a><div class="blog-slider__text">'.$ji->title.'</div><a class="blog-slider__button" href="'.$ji->permalink.'" alt="">详情</a></div></div>';}echo $html;
?>
</div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>`;
// parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错,但不影响使用(支持pjax跳转)
parent_div_git.insertAdjacentHTML("afterbegin", item_html) // 有报错,但不影响使用(支持pjax跳转)
parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错,但不影响使用(支持pjax跳转)
// parent_div_git.insertAdjacentHTML("afterbegin", item_html) // 有报错,但不影响使用(支持pjax跳转)
}
if (document.getElementById('recent-posts') && (location.pathname === 'all' || 'all' === 'all')) {
butterfly_swiper_injector_config()}
Expand All @@ -186,7 +186,7 @@ function butterfly_swiper_injector_config() {
<?php endif?>
</div>
<!--js-pjax end-->
<div id="rightside">
<div id="rightside" style="">
<div id="rightside-config-hide" class="">
<button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button>
<button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button>
Expand Down Expand Up @@ -224,7 +224,8 @@ function butterfly_swiper_injector_config() {
</i>
</a>
<?php endif ?>
<button id="go-up" type="button" title="回到顶部">
<button id="go-up" type="button" title="回到頂部" class="show-percent">
<span class="scroll-percent"></span>
<i class="fas fa-arrow-up">
</i>
</button>
Expand Down
6 changes: 3 additions & 3 deletions functions.php
Expand Up @@ -136,7 +136,7 @@ function themeConfig($form) {
$AD = new Typecho_Widget_Helper_Form_Element_Textarea('AD', NULL, NULL, _t('广告(由@yzl3014提供)'), _t('在这里填入广告,填入后自动显示在侧栏中公告栏的下方,支持html'));
$form->addInput($AD);

$headerimg = new Typecho_Widget_Helper_Form_Element_Text('headerimg', NULL,_t('https://tva1.sinaimg.cn/large/007X0Rdyly1ghm1qiihrdj31hc0u07jk.jpg'), _t('主页顶图(banner image)'), _t('填入主页头图链接'));
$headerimg = new Typecho_Widget_Helper_Form_Element_Text('headerimg', NULL,_t('https://s2.loli.net/2023/01/18/bIJTVaR3MLPzcZ7.jpg'), _t('主页顶图(banner image)'), _t('填入主页头图链接'));
$form->addInput($headerimg);

$buildtime = new Typecho_Widget_Helper_Form_Element_Text('buildtime', NULL,_t('2021/04/05'), _t('建站时间'), _t('按照输入框内格式填写'));
Expand Down Expand Up @@ -341,7 +341,7 @@ function themeConfig($form) {
'showLineNumber' => _t('是否显示代码块行号'),
'showSnackbar' => _t('是否显示主题以及简繁切换弹窗'),
'showLazyloadBlur' => _t('是否开启懒加载模糊效果'),
'showButterflyClock' => _t('是否开启侧栏显示时钟'),
'showButterflyClock' => _t('是否开启侧栏显示时钟(需要在下方填写和风和高德key)'),
),
array('ShowTopimg','PostShowTopimg','PageShowTopimg','showLineNumber','showSnackbar','showLazyloadBlur'), _t('美化选项'));
$beautifyBlock->setAttribute('id', 'beautifyBlock');
Expand Down Expand Up @@ -1816,4 +1816,4 @@ function weibohot(){
}
echo '<div class="weibo-list-item"><div class="weibo-hotness '.$hotness[$hot].'">'.$hot.'</div><span class="weibo-title"><a title="'.$item['note'].'" href="https://s.weibo.com/weibo?q=%23' . $item['word'] . '%23" target="_blank" rel="external nofollow noreferrer" style="color:#a08ed5">'.$item['note'].'</a></span><div class="weibo-num"><span>'.$item['num'].'</span></div></div>';
}
}
}
92 changes: 48 additions & 44 deletions header_com.php
Expand Up @@ -21,8 +21,8 @@
<link rel="preconnect" href="//<?php $this->options->jsdelivrLink() ?>" />
<link rel="preconnect" href="//cdn.staticfile.org" />
<!--<link rel="stylesheet" href="https://gcore.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css">-->
<link rel="stylesheet" href="<?php $this->options->themeUrl('index.css?v1.5.3'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/style.css?v1.7.1'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('index.css?v1.7.3'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/style.css?v1.7.3'); ?>">
<!--魔改美化-->
<?php if (!empty($this->options->beautifyBlock) && in_array('ShowBeautifyChange',$this->options->beautifyBlock)): ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/custom.css?v1.5.9'); ?>">
Expand All @@ -42,8 +42,8 @@
<link rel="stylesheet" href="<?php $this->options->themeUrl('static/css/OwO.min.css'); ?>" />
<?php endif; ?>
<?php if (!empty($this->options->beautifyBlock) && in_array('showSnackbar',$this->options->beautifyBlock)): ?>
<link rel="stylesheet" href="/usr/themes/butterfly/css/snackbar.min.css" media="print" onload="this.media='all'">
<script src="/usr/themes/butterfly/js/snackbar.min.js"></script>
<link rel="stylesheet" href="<?php $this->options->themeUrl('/css/snackbar.min.css')?>" media="print" onload="this.media='all'">
<script src="<?php $this->options->themeUrl('js/snackbar.min.js')?>"></script>
<?php endif; ?>
<?php if (!empty($this->options->beautifyBlock) && in_array('showLazyloadBlur',$this->options->beautifyBlock)): ?>
<style>
Expand All @@ -60,48 +60,48 @@
<?php endif; ?>
<!--额外的-->
<script>
const GLOBAL_CONFIG = {
root: "/",
algolia: void 0,
localSearch: {
path: "",
languages: {
hits_empty: "回车查询:${query}"
}
},
translate: {
const GLOBAL_CONFIG = {
root: "/",
algolia: void 0,
localSearch: {
path: undefined,
languages: {
hits_empty: "回车查询:${query}"
}
},
translate: {
defaultEncoding: <?php $this->options->DefaultEncoding() ?>,
translateDelay: 0,
msgToTraditionalChinese: "繁",
msgToSimplifiedChinese: "简"
},
noticeOutdate: void 0,
highlight: {
plugin: "highlighjs",
highlightCopy: !0,
highlightLang: !0,
highlightHeightLimit: 400
},
copy: {
noticeOutdate: void 0,
highlight: {
plugin: "highlighjs",
highlightCopy: !0,
highlightLang: !0,
highlightHeightLimit: 400
},
copy: {
success: "复制成功",
error: "复制错误",
noSupport: "浏览器不支持"
},
relativeDate: {
homepage: !0,
post: !0
},
runtime: "天",
date_suffix: {
},
relativeDate: {
homepage: !0,
post: !0
},
runtime: "天",
date_suffix: {
just: "",
min: "",
hour: "",
day: "",
month: ""
},
copyright: undefined,
lightbox: "fancybox",
Snackbar: {
},
copyright: undefined,
lightbox: "fancybox",
Snackbar: {
"chs_to_cht": "你已切换为繁体",
"cht_to_chs": "你已切换为简体",
"day_to_night": "你已切换为深色模式",
Expand All @@ -110,18 +110,22 @@
"bgDark": "#121212",
"position": "<?php $this->options->SnackbarPosition() ?>"
},
source: {
source: {
justifiedGallery: {
js: "https://<?php $this->options->jsdelivrLink() ?>/npm/flickr-justified-gallery@2/dist/fjGallery.min.js",
css: "https://<?php $this->options->jsdelivrLink() ?>/npm/flickr-justified-gallery@2/dist/fjGallery.min.css"
}
},
isPhotoFigcaption: !1,
islazyload: !0,
isAnchor: !0,
coverPosition: '<?php $this->options->coverPosition() ?>',
}
var saveToLocal = {
isPhotoFigcaption: !1,
islazyload: !0,
isAnchor: !0,
percent: {
toc: !0,
rightside: !0
},
coverPosition: '<?php $this->options->coverPosition() ?>',
}
var saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
const now = new Date()
const expiryDay = ttl * 86400000
Expand Down Expand Up @@ -160,7 +164,7 @@
}
document.head.appendChild(script)
})
</script>
</script>
<script id="config-diff">
var GLOBAL_CONFIG_SITE = {
isPost: !0,
Expand Down Expand Up @@ -323,9 +327,9 @@
<?php $this->options->CustomHead() ?>
</head>
<body>
<script src="<?php $this->options->themeUrl('/js/main.js?v1.6.0'); ?>"> </script>
<script src="<?php $this->options->themeUrl('/js/utils.js?v1.5.0'); ?>"> </script>
<script src="<?php $this->options->themeUrl('/js/tw_cn.js?v1.7.0'); ?>"> </script>
<script src="<?php $this->options->themeUrl('/js/main.js?v1.7.3'); ?>"> </script>
<script src="<?php $this->options->themeUrl('/js/utils.js?v1.7.3'); ?>"> </script>
<script src="<?php $this->options->themeUrl('/js/tw_cn.js?v1.7.3'); ?>"> </script>
<script src="<?php $this->options->themeUrl('/js/local-search.js'); ?>"> </script>
<?php if($this->options->StaticFile == 'CDN' && $this->options->CDNURL == ''): ?>
<script src="https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion index.css

Large diffs are not rendered by default.

36 changes: 16 additions & 20 deletions index.php
Expand Up @@ -3,28 +3,22 @@
* <span><script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>主题最新版本:<span id="latest">获取中...</span><script>$(document).ready(function() {$.get("https://typecho.wehao.ml", function(data) { $("#latest").text(data.ver);});});</script></span>
* 这是 Typecho 版本的 butterfly 主题
* 主题为移植至Typecho,你可以替换原butterfly主题的index.css文件
* 当前适配 hexo-butterfly 4.2.0
* 当前适配 hexo-butterfly 4.6.0
* <a href="https://www.wehaox.com">个人网站</a> | <a href="https://blog.wehaox.com/archives/typecho-butterfly.html">主题使用文档</a>
* @package Typecho-Butterfly
* @author b站:wehao-
* @version 1.7.2
* @version 1.7.3
* @link https://space.bilibili.com/34174433
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/** 文章置顶 */
$sticky = $this->options->sticky_cids;
if($sticky && $this->is('index') || $this->is('front')){
$sticky_cids = explode(',', strtr($sticky, ' ', ','));//分割文本
$sticky_html =
"<span class='article-meta'>
<i class='fas fa-thumbtack article-meta__icon sticky'></i>
<span class='sticky'>置顶 </span>
<span class='article-meta__separator'>|</span>
</span>";
$sticky_html = "<span class='article-meta'><i class='fas fa-thumbtack article-meta__icon sticky'></i><span class='sticky'>置顶 </span><span class='article-meta__separator'>|</span></span>";
$db = Typecho_Db::get();
$select1 = $this->select()->where('type = ?', 'post');
$select2 = $this->select()->where('type = ? && status = ? && created < ?', 'post','publish',time());
//清空原有文章的列队
$select2 = $this->select()->where('type = ? AND status = ? AND created < ?', 'post','publish',time());
$this->row = [];
$this->stack = [];
$this->length = 0;
Expand All @@ -33,15 +27,15 @@
if($i == 0) $select1->where('cid = ?', $cid);
else $select1->orWhere('cid = ?', $cid);
$order .= " when $cid then $i";
$select2->where('table.contents.cid != ?', $cid); //避免重复
$select2->where('table.contents.cid != ?', $cid);
}
if ($order) $select1->order('',"(case cid$order end)"); //置顶文章的顺序 按 $sticky 中 文章ID顺序
if ($this->_currentPage == 1) foreach($db->fetchAll($select1) as $sticky_post){ //首页第一页才显示
if ($order) $select1->order('',"(case cid$order end)");
if ($this->_currentPage == 1) foreach($db->fetchAll($select1) as $sticky_post){
$sticky_post['sticky'] = $sticky_html;
$this->push($sticky_post); //压入列队
$this->push($sticky_post);
}
$uid = $this->user->uid; //登录时,显示用户各自的私密文章
if($uid) $select2->orWhere('authorId = ? && status = ?',$uid,'private');
$uid = $this->user->uid; //登录时,显示用户各自的私密文章
if($uid) $select2->orWhere('authorId = ? AND status = ?',$uid,'private');
$sticky_posts = $db->fetchAll($select2->order('table.contents.created', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize));
foreach($sticky_posts as $sticky_post) $this->push($sticky_post); //压入列队
$this->setTotal($this->getTotal()-count($sticky_cids)); //置顶文章不计算在所有文章内
Expand All @@ -53,7 +47,8 @@
<?php while($this->next()): ?>
<div class="recent-post-item" >
<wehao class="post_cover">
<a class="article-title" href="<?php $this->permalink() ?>"><img class="post_bg" data-lazy-src="<?php echo get_ArticleThumbnail($this);?>" src="<?php echo GetLazyLoad() ?>" onerror="this.onerror=null;this.src='https://tva1.sinaimg.cn/large/007X0Rdyly1gpaaf55n1rj30ic09u0sw.jpg'"></a>
<a href="<?php $this->permalink() ?>">
<img class="post-bg" data-lazy-src="<?php echo get_ArticleThumbnail($this);?>" src="<?php echo GetLazyLoad() ?>" onerror="this.onerror=null;this.src='<?php $this->options->themeUrl('img/404.jpg'); ?>'"></a>
</wehao>
<div class="recent-post-info">
<a class="article-title" href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
Expand Down Expand Up @@ -91,9 +86,10 @@
if($this->fields->excerpt && $this->fields->excerpt!='') {
echo $this->fields->excerpt;}
else{
echo $this->excerpt(130);}
echo $this->excerpt(130);
}
echo '<br><br><a href="',$this->permalink(),'" title="',$this->title(),'">阅读全文...</a>';
?>
?>
</div>
</div>
</div>
Expand All @@ -116,7 +112,7 @@ function ver() {console.log(`
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #
1.7.2
1.7.3
===================================================================
`);}
</script>

0 comments on commit 088cb16

Please sign in to comment.