Skip to content

Commit d20ae53

Browse files
committed
fix: 修正首次访问变浅色主题问题;修正代码框对比度低的问题
1 parent 0789ffe commit d20ae53

File tree

9 files changed

+30
-148
lines changed

9 files changed

+30
-148
lines changed

assets/css/black.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ a {
8484
}
8585

8686
.gt-post-content code {
87-
background: RGBA(100,181,135,0.14)!important;
87+
background: RGBA(100,181,135,0.34)!important;
8888
}
8989

9090
input::placeholder {

assets/css/dark.css

Lines changed: 0 additions & 123 deletions
This file was deleted.

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

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

assets/js/match-dark-mode.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ const expiredTime = new Date()
22
expiredTime.setTime(new Date().getTime() + 365 * 24 * 60 * 60 * 1000)
33
if (matchMedia('(prefers-color-scheme: dark)').matches) {
44
document.cookie = 'latest-prefers-color-scheme=dark; expires=' + expiredTime.toUTCString();
5+
document.getElementsByTagName('body')[0].classList.add('dark');
6+
document.getElementsByTagName('body')[0].classList.remove('light');
7+
document.getElementById('theme-css').setAttribute('href', 'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/assets/css/black.min.css');
58
} else if (matchMedia('(prefers-color-scheme: light)').matches) {
69
document.cookie = 'latest-prefers-color-scheme=light; expires=' + expiredTime.toUTCString();
10+
document.getElementsByTagName('body')[0].classList.add('light');
11+
document.getElementsByTagName('body')[0].classList.remove('dark');
712
}

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].20/images/alu/$1.png">', $comments->content); // 替换关键词为表情 ?>
72+
<?php echo preg_replace('#\@\((.*?)\)#', '<img src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/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].20/assets/json/OwO.json',
176+
api: 'https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/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].20/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].21/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: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,15 @@
100100
</script>
101101
<?php endif; ?>
102102

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>
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>
105108
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
106109
<script>mermaid.init({noteMargin: 10}, ".lang-mermaid");</script>
107110
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/nprogress.min.js"></script>
108-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/noticejs.min.css" />
111+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/noticejs.min.css" />
109112
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/animate.min.css" />
110113
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/notice.min.js"></script>
111114
<script type="text/javascript">
@@ -122,7 +125,7 @@
122125
<script async src="<?php $this->options->umamiUrl(); ?>" data-website-id="<?php $this->options->umamiId(); ?>" data-do-not-track="<?php $this->options->umamiDoNotTrack(); ?>"></script>
123126
<?php endif; ?>
124127
<?php if ($this->options->returnTop === 'enable'): ?>
125-
<script defer type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/js/lamu-leimu.min.js"></script>
128+
<script defer type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/js/lamu-leimu.min.js"></script>
126129
<?php endif; ?>
127130
</div>
128131
</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].20/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].21/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: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,27 @@
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" />
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>
20+
<link href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected]/images/icon.ico" rel="shortcut icon" />
2421
<?php endif; ?>
2522
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css" />
26-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/main.min.css" />
23+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/main.min.css" />
2724
<?php
2825
if ($_COOKIE['latest-prefers-color-scheme']) {
2926
setcookie('latest-prefers-color-scheme', $_COOKIE['latest-prefers-color-scheme'], time() + 60 * 60 * 24 * 365, '/');
3027
}
3128
?>
3229
<?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].20/assets/css/black.min.css" />
30+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/black.min.css" id="theme-css" />
3431
<?php elseif ($this->options->themeColor == '0'): ?>
35-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/gray.min.css" />
32+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/gray.min.css" id="theme-css" />
3633
<?php elseif ($this->options->themeColor == '1'): ?>
37-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/white.min.css" />
34+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/white.min.css" id="theme-css" />
3835
<?php elseif ($this->options->themeColor == '2'): ?>
39-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/green.min.css" />
36+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/green.min.css" id="theme-css" />
4037
<?php elseif ($this->options->themeColor == '3'): ?>
41-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/black.min.css" />
38+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/black.min.css" id="theme-css" />
4239
<?php else: ?>
43-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/assets/css/gray.min.css" />
40+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/css/gray.min.css" id="theme-css" />
4441
<?php endif; ?>
4542
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" />
4643
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
@@ -52,7 +49,7 @@
5249
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
5350
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
5451
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@fancyapps/[email protected]/dist/jquery.fancybox.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>
52+
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/assets/js/jQuery.scrollLoad.min.js"></script>
5653
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.pjax.min.js"></script>
5754
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/OwO.min.js"></script>
5855
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/console-ban.min.js"></script>
@@ -66,7 +63,7 @@
6663
<?php if ($this->options->logo): ?>
6764
<img class="user-avatar" src="<?php $this->options->logo(); ?>" alt="头像" />
6865
<?php else: ?>
69-
<img class="user-avatar" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].20/images/avatar.png" alt="头像" />
66+
<img class="user-avatar" src="https://cdn.jsdelivr.net/gh/yanranxiaoxi/[email protected].21/images/avatar.png" alt="头像" />
7067
<?php endif; ?>
7168
<div class="site-name gt-c-content-color-first">
7269
<?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.20
7+
* @version 0.1.21
88
* @link https://soraharu.com/
99
*/
1010
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

0 commit comments

Comments
 (0)