Skip to content

Commit 0789ffe

Browse files
committed
fix: 修复暗色主题颜色错误问题
1 parent 3f1bc9f commit 0789ffe

File tree

7 files changed

+32
-32
lines changed

7 files changed

+32
-32
lines changed

assets/js/lamu-leimu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
!(function () {
22

3-
var style = '@media (max-width:860px){.sidebar_wo{display:none}}.sidebar_wo{position:fixed;bottom:0;z-index:1000;line-height:0;cursor:url(https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/cursor/leimu.cur),pointer}#lamu:hover{-webkit-transform:translate(0,0);transform:translate(0,0);-ms-transform:translate(0,0)}#lamu{right:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-transform:translate(7px,7px);transform:translate(7px,7px);-ms-transform:translate(7px,7px)}#leimu:hover{-webkit-transform:translate(0,0);transform:translate(0,0);-ms-transform:translate(0,0)}#leimu{left:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-transform:translate(-7px,7px);transform:translate(-7px,7px);-ms-transform:translate(-7px,7px)}';
3+
var style = '@media (max-width:860px){.sidebar_wo{display:none}}.sidebar_wo{position:fixed;bottom:0;z-index:1000;line-height:0;cursor:url(https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/cursor/leimu.cur),pointer}#lamu:hover{-webkit-transform:translate(0,0);transform:translate(0,0);-ms-transform:translate(0,0)}#lamu{right:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-transform:translate(7px,7px);transform:translate(7px,7px);-ms-transform:translate(7px,7px)}#leimu:hover{-webkit-transform:translate(0,0);transform:translate(0,0);-ms-transform:translate(0,0)}#leimu{left:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-transform:translate(-7px,7px);transform:translate(-7px,7px);-ms-transform:translate(-7px,7px)}';
44

55
var css = document.createElement('style');
66
css.type = 'text/css';
77
css.innerHTML = style;
88
var head = document.head || document.getElementsByTagName('head')[0];
99
head.appendChild(css);
1010

11-
var lamuleimuDiv = '<div class="sidebar_wo" id="leimu"><img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/bottom/leimu1.png" alt="雷姆" onmouseover="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/bottom/leimu2.png\'" onmouseout="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/bottom/leimu1.png\'"></div><div class="sidebar_wo" id="lamu"><img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/bottom/lamu1.png" alt="拉姆" onmouseover="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/bottom/lamu2.png\'" onmouseout="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/bottom/lamu1.png\'"></div>';
11+
var lamuleimuDiv = '<div class="sidebar_wo" id="leimu"><img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/bottom/leimu1.png" alt="雷姆" onmouseover="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/bottom/leimu2.png\'" onmouseout="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/bottom/leimu1.png\'"></div><div class="sidebar_wo" id="lamu"><img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/bottom/lamu1.png" alt="拉姆" onmouseover="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/bottom/lamu2.png\'" onmouseout="this.src=\'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/bottom/lamu1.png\'"></div>';
1212

1313
var div = document.createElement('div');
1414
div.innerHTML = lamuleimuDiv;

assets/js/match-dark-mode.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
const expiredTime = new Date()
2-
expiredTime.setTime(new Date().getTime() + 372 * 24 * 60 * 60 * 1000)
2+
expiredTime.setTime(new Date().getTime() + 365 * 24 * 60 * 60 * 1000)
33
if (matchMedia('(prefers-color-scheme: dark)').matches) {
4-
document.getElementsByTagName('body')[0].classList.add('dark');
5-
document.getElementsByTagName('body')[0].classList.remove('light');
64
document.cookie = 'latest-prefers-color-scheme=dark; expires=' + expiredTime.toUTCString();
75
} else if (matchMedia('(prefers-color-scheme: light)').matches) {
8-
document.getElementsByTagName('body')[0].classList.add('light');
9-
document.getElementsByTagName('body')[0].classList.remove('dark');
106
document.cookie = 'latest-prefers-color-scheme=light; expires=' + expiredTime.toUTCString();
117
}

comments.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
</div>
7070
<div class="comment-content">
7171
<b><?php get_comment_at($comments->coid); ?></b>
72-
<?php echo preg_replace('#\@\((.*?)\)#', '<img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/alu/$1.png">', $comments->content); // 替换关键词为表情 ?>
72+
<?php echo preg_replace('#\@\((.*?)\)#', '<img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/alu/$1.png">', $comments->content); // 替换关键词为表情 ?>
7373
</div>
7474
<?php if ($comments->children) { ?>
7575
<div class="comment-children" id="pllc">
@@ -173,7 +173,7 @@ function okBaidu($url, $baiduPushUrl) {
173173
logo: 'OωO表情',
174174
container: document.getElementsByClassName('OwO')[0],
175175
target: document.getElementsByClassName('OwO-textarea')[0],
176-
api: 'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/assets/json/OwO.json',
176+
api: 'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/json/OwO.json',
177177
position: 'down',
178178
width: '100%',
179179
maxHeight: '250px'
@@ -221,7 +221,7 @@ function okBaidu($url, $baiduPushUrl) {
221221
if(0==el.length)
222222
{$('<ol class="comment-list"></ol>').prependTo($('#comments'));el=$('#comments > .comment-list');}
223223
var html='<li id="comment-{coid}" class="comment-body comment-ajax comment-parent comment-odd"> <div class="comment-author"> <img class="avatar" src="{avatar}" alt="{author}" width="32" height="32"> <div class="comment-info"> <cite class="fn"><a href="{url}" rel="external nofollow" target="_blank">{author}</a></cite> <em class="comment-meta"><a href="{permalink}">{datetime}</a></em> </div> <div class="comment-reply"><a href="{permalink}" rel="nofollow" onclick="return TypechoComment.reply(\'\comment-{coid}\'\, {coid});">回复</a></div> </div> <div class="comment-content">{content}</div> </li>';$.each(comment,function(k,v)
224-
{regExp=new RegExp('{'+k+'}','g');html=html.replace(regExp,v);});var reg1=/@\(([^ ]*)\)/g;html=html.replace(reg1,"<img src=\"https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/alu/$1.png\"\>");$(html).prependTo(el);}
224+
{regExp=new RegExp('{'+k+'}','g');html=html.replace(regExp,v);});var reg1=/@\(([^ ]*)\)/g;html=html.replace(reg1,"<img src=\"https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/alu/$1.png\"\>");$(html).prependTo(el);}
225225
$.ajax({url:'<?php $this->permalink();?>',type:'POST',data:params,dataType:'json',beforeSend:function()
226226
{$(".loading").css("display","block");},complete:function()
227227
{$(".loading").css("display","none");new NoticeJs({text:'评论成功(//▽//)',position:'middleCenter',animation:{open:'animated bounceInRight',close:'animated bounceOutLeft'}}).show();},success:function(result)

footer.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,12 @@
100100
</script>
101101
<?php endif; ?>
102102

103-
<?php if ($this->options->themeAutoDark === 'enable'): ?>
104-
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/js/match-dark-mode.min.js"></script>
105-
<?php endif; ?>
106-
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/js/img-lazy.min.js"></script>
107-
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/js/moment.min.js"></script>
103+
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/js/img-lazy.min.js"></script>
104+
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/js/moment.min.js"></script>
108105
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
109106
<script>mermaid.init({noteMargin: 10}, ".lang-mermaid");</script>
110107
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/nprogress.min.js"></script>
111-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/assets/css/noticejs.min.css" />
108+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/noticejs.min.css" />
112109
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/animate.min.css" />
113110
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/notice.min.js"></script>
114111
<script type="text/javascript">
@@ -125,7 +122,7 @@
125122
<script async src="<?php $this->options->umamiUrl(); ?>" data-website-id="<?php $this->options->umamiId(); ?>" data-do-not-track="<?php $this->options->umamiDoNotTrack(); ?>"></script>
126123
<?php endif; ?>
127124
<?php if ($this->options->returnTop === 'enable'): ?>
128-
<script defer type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/assets/js/lamu-leimu.min.js"></script>
125+
<script defer type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/js/lamu-leimu.min.js"></script>
129126
<?php endif; ?>
130127
</div>
131128
</div>

functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function parseContent($obj) {
188188
$obj->content = str_ireplace($widgetOptions->src_add,$widgetOptions->cdn_add,$obj->content);
189189
}
190190

191-
$obj->content = preg_replace('/<\s*img[\s\S]+?(?:src=[\'"]([\S\s]*?)[\'"]\s*|alt=[\'"]([\S\s]*?)[\'"]\s*|[a-z]+=[\'"][\S\s]*?[\'"]\s*)+[\s\S]*?>/i','<img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/lazyload.jpg" alt="$2" data-src="$1" />', $obj->content);
191+
$obj->content = preg_replace('/<\s*img[\s\S]+?(?:src=[\'"]([\S\s]*?)[\'"]\s*|alt=[\'"]([\S\s]*?)[\'"]\s*|[a-z]+=[\'"][\S\s]*?[\'"]\s*)+[\s\S]*?>/i','<img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/lazyload.jpg" alt="$2" data-src="$1" />', $obj->content);
192192
$obj->content = preg_replace("/<a href=\"([^\"]*)\">/i", "<a href=\"\\1\" target=\"_blank\">", $obj->content);
193193
echo trim($obj->content);
194194
}

header.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,30 @@
1717
<?php if ($this->options->favicon): ?>
1818
<link href="<?php $this->options->favicon(); ?>" rel="shortcut icon" />
1919
<?php else: ?>
20-
<link href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/images/icon.ico" rel="shortcut icon" />
20+
<link href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/images/icon.ico" rel="shortcut icon" />
21+
<?php endif; ?>
22+
<?php if ($this->options->themeAutoDark === 'enable'): ?>
23+
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/js/match-dark-mode.min.js"></script>
2124
<?php endif; ?>
2225
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css" />
23-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/main.min.css" />
24-
<?php if ($this->options->themeColor == '0'): ?>
25-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/gray.min.css" />
26+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/main.min.css" />
27+
<?php
28+
if ($_COOKIE['latest-prefers-color-scheme']) {
29+
setcookie('latest-prefers-color-scheme', $_COOKIE['latest-prefers-color-scheme'], time() + 60 * 60 * 24 * 365, '/');
30+
}
31+
?>
32+
<?php if ($this->options->themeAutoDark === 'enable' && $_COOKIE['latest-prefers-color-scheme'] === 'dark'): ?>
33+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/black.min.css" />
34+
<?php elseif ($this->options->themeColor == '0'): ?>
35+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/gray.min.css" />
2636
<?php elseif ($this->options->themeColor == '1'): ?>
27-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/assets/css/white.min.css" />
37+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/white.min.css" />
2838
<?php elseif ($this->options->themeColor == '2'): ?>
29-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/assets/css/green.min.css" />
39+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/green.min.css" />
3040
<?php elseif ($this->options->themeColor == '3'): ?>
31-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/assets/css/black.min.css" />
41+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/black.min.css" />
3242
<?php else: ?>
33-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/gray.min.css" />
34-
<?php endif; ?>
35-
<?php if ($this->options->themeAutoDark === 'enable'): ?>
36-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/dark.min.css" />
43+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/gray.min.css" />
3744
<?php endif; ?>
3845
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" />
3946
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
@@ -45,7 +52,7 @@
4552
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
4653
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
4754
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
48-
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/assets/js/jQuery.scrollLoad.min.js"></script>
55+
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/js/jQuery.scrollLoad.min.js"></script>
4956
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.pjax.min.js"></script>
5057
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/OwO.min.js"></script>
5158
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/console-ban.min.js"></script>
@@ -59,7 +66,7 @@
5966
<?php if ($this->options->logo): ?>
6067
<img class="user-avatar" src="<?php $this->options->logo(); ?>" alt="头像" />
6168
<?php else: ?>
62-
<img class="user-avatar" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].19/images/avatar.png" alt="头像" />
69+
<img class="user-avatar" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/avatar.png" alt="头像" />
6370
<?php endif; ?>
6471
<div class="site-name gt-c-content-color-first">
6572
<?php $this->options->title(); ?>

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @package Simplecho
66
* @author XiaoXi
7-
* @version 0.1.19
7+
* @version 0.1.20
88
* @link https://soraharu.com/
99
*/
1010
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

0 commit comments

Comments
 (0)