Skip to content

Commit

Permalink
0.999.beta.3
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Aug 12, 2020
1 parent 1c4a6e0 commit c1ebab2
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 35 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ Argon 使用 [GPL V3.0](https://github.com/solstice23/argon-theme/blob/master/LI

# 更新日志

## 20200813 v0.999.beta.3
+ 修复较深颜色作为主题色时夜间模式下的对比度问题
+ 修复文章中 WP 引用卡片溢出问题
+ 修复小屏幕时评论区显示重叠问题

## 20200812 v0.999.beta.2
+ 评论支持发表情
+ 增加评论区表情键盘
Expand Down
15 changes: 14 additions & 1 deletion argontheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ function showCommentEditHistory(id){
});
}
$(document).on("click" , ".comment-edited.comment-edithistory-accessible" , function(){
showCommentEditHistory($(this).parent().parent().parent().data("id"));
showCommentEditHistory($(this).parent().parent().parent().parent().data("id"));
});
/*过长评论折叠*/
function foldLongComments(){
Expand Down Expand Up @@ -1649,6 +1649,13 @@ function hex2rgb(hex){
'b': (dec[hex.substr(5,1)] * 16 + dec[hex.substr(6,1)]) / 255
};
}
function rgb2gray(R,G,B){
return Math.round(R * 0.299 + G * 0.587 + B * 0.114);
}
function hex2gray(hex){
let rgb_array = hex2rgb(hex);
return hex2gray(rgb_array['R'], rgb_array['G'], rgb_array['B']);
}
function rgb2str(rgb){
return rgb['R'] + "," + rgb['G'] + "," + rgb['B'];
}
Expand Down Expand Up @@ -1749,6 +1756,12 @@ function updateThemeColor(color, setcookie){
document.documentElement.style.setProperty('--themecolor-light', themecolor_light);
document.documentElement.style.setProperty('--themecolor-rgbstr', themecolor_rgbstr);

if (rgb2gray(RGB['R'], RGB['G'], RGB['B']) < 50){
$("html").addClass("themecolor-toodark");
}else{
$("html").removeClass("themecolor-toodark");
}

$("meta[name='theme-color']").attr("content", themecolor);
$("meta[name='theme-color-rgb']").attr("content", themecolor_rgbstr);

Expand Down
57 changes: 33 additions & 24 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -750,35 +750,37 @@ function argon_comment_format($comment, $args, $depth){
</div>
<div class="comment-item-inner" id="comment-inner-<?php comment_ID();?>">
<div class="comment-item-title">
<?php echo get_comment_author_link();?>
<?php if (user_can($comment -> user_id , "update_core")){
echo '<span class="badge badge-primary badge-admin">' . __('博主', 'argon') . '</span>';}
?>
<?php if (is_comment_private_mode(get_comment_ID()) && user_can_view_comment(get_comment_ID())){
echo '<span class="badge badge-success badge-private-comment">' . __('悄悄话', 'argon') . '</span>';}
?>
<?php if ($comment -> comment_approved == 0){
echo '<span class="badge badge-warning badge-unapproved">' . __('待审核', 'argon') . '</span>';}
?>
<?php
echo parse_ua_and_icon($comment -> comment_agent);
?>
<div class="comment-name">
<?php echo get_comment_author_link();?>
<?php if (user_can($comment -> user_id , "update_core")){
echo '<span class="badge badge-primary badge-admin">' . __('博主', 'argon') . '</span>';}
?>
<?php if (is_comment_private_mode(get_comment_ID()) && user_can_view_comment(get_comment_ID())){
echo '<span class="badge badge-success badge-private-comment">' . __('悄悄话', 'argon') . '</span>';}
?>
<?php if ($comment -> comment_approved == 0){
echo '<span class="badge badge-warning badge-unapproved">' . __('待审核', 'argon') . '</span>';}
?>
<?php
echo parse_ua_and_icon($comment -> comment_agent);
?>
</div>
<div class="comment-info">
<?php if (get_comment_meta(get_comment_ID(), "edited", true) == "true") { ?>
<div class="comment-edited<?php if (can_visit_comment_edit_history(get_comment_ID())){echo ' comment-edithistory-accessible';}?>">
<i class="fa fa-pencil" aria-hidden="true"></i><?php _e('已编辑', 'argon')?>
</div>
<?php } ?>
<div class="comment-time">
<span class="human-time" data-time="<?php echo get_comment_time('U', true);?>"><?php echo human_time_diff(get_comment_time('U') , current_time('timestamp')) . __("", "argon");?></span>
<div class="comment-time-details"><?php echo get_comment_time('Y-n-d G:i:s');?></div>
</div>
</div>
</div>
<div class="comment-item-text">
<?php echo argon_get_comment_text();?>
</div>
<div class="comment-item-source" style="display: none;" aria-hidden="true"><?php echo htmlspecialchars(get_comment_meta(get_comment_ID(), "comment_content_source", true));?></div>
<div class="comment-info">
<?php if (get_comment_meta(get_comment_ID(), "edited", true) == "true") { ?>
<div class="comment-edited<?php if (can_visit_comment_edit_history(get_comment_ID())){echo ' comment-edithistory-accessible';}?>">
<i class="fa fa-pencil" aria-hidden="true"></i><?php _e('已编辑', 'argon')?>
</div>
<?php } ?>
<div class="comment-time">
<span class="human-time" data-time="<?php echo get_comment_time('U', true);?>"><?php echo human_time_diff(get_comment_time('U') , current_time('timestamp')) . __("", "argon");?></span>
<div class="comment-time-details"><?php echo get_comment_time('Y-n-d G:i:s');?></div>
</div>
</div>

<div class="comment-operations">
<?php if ((check_comment_token(get_comment_ID()) || check_login_user_same($comment -> user_id)) && (get_option("argon_comment_allow_editing") != "false")) { ?>
Expand Down Expand Up @@ -1566,6 +1568,13 @@ function rgb2str($rgb){
function hex2str($hex){
return rgb2str(hex2rgb($hex));
}
function rgb2gray($R,$G,$B){
return round($R * 0.299 + $G * 0.587 + $B * 0.114);
}
function hex2gray($hex){
$rgb_array = hex2rgb($hex);
return rgb2gray($rgb_array['R'], $rgb_array['G'], $rgb_array['B']);
}
function checkHEX($hex){
if (strlen($hex) != 7){
return False;
Expand Down
3 changes: 3 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
$themecolor = $_COOKIE["argon_custom_theme_color"];
}
}
if (hex2gray($themecolor) < 50){
echo '<script>document.getElementsByTagName("html")[0].classList.add("themecolor-toodark");</script>';
}
?>
<?php
$cardradius = get_option('argon_card_radius');
Expand Down
4 changes: 2 additions & 2 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version" : "0.999.beta.2",
"version" : "0.999.beta.3",
"details_url" : "https://github.com/solstice23/argon-theme/releases",
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.999.beta.2/argon.zip"
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.999.beta.3/argon.zip"
}
29 changes: 21 additions & 8 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Theme Name: argon
Author: solstice23
Author URI: https://solstice23.top/
Description: 轻盈、简洁、美观的 Wordpress 主题
Version: 0.999.beta.2
Version: 0.999.beta.3
License: GNU General Public License v3.0
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: 简约, 两栏, 侧栏在左边, 浮动侧栏, 文章目录, 自适应, 夜间模式, 可自定义
Expand All @@ -15,6 +15,10 @@ Tags: 简约, 两栏, 侧栏在左边, 浮动侧栏, 文章目录, 自适应,
--themecolor: #5e72e4;
--card-radius: 4px;
}
html.themecolor-toodark.darkmode{
--themecolor: #5e72e4 !important;
--themecolor-light: #8a98eb !important;
}

body{
background: #f4f5f7 !important;
Expand Down Expand Up @@ -149,6 +153,9 @@ article .post-content kbd{
background-color: #333;
border-radius: 3px;
}
article .wp-embedded-content {
max-width: 100%;
}
article table{
max-width: 100%;
word-break: break-word;
Expand Down Expand Up @@ -1473,7 +1480,7 @@ background: rgba(var(--themecolor-rgbstr), .1);
width: 16px;
height: 16px;
content: '';
transform: translate(-50%,8px) rotate(-45deg);
transform: translate(-50%,8px) rotate(-45deg);
border-radius: .2rem;
background: #fff;
z-index: 1;
Expand Down Expand Up @@ -1535,19 +1542,25 @@ background: rgba(var(--themecolor-rgbstr), .1);
.comment-item-title{
font-size: 16px;
font-weight: bold;
display: flex;
margin-bottom: 3px;
}
.comment-item-title .badge-admin , .comment-item-title .badge-private-comment , .comment-item-title .badge-unapproved{
transform: translateY(-2px);
margin-left: 3px;
margin-left: 5px;
}
.comment-name{
flex: 1;
}
.comment-info{
position: absolute;
right: 0;
top: 2px;
margin-top: 2px;
font-size: 12px;
font-weight: normal;
margin-left: 3px;
}
.comment-info > div{
display: inline-block;
white-space: nowrap;
}
.comment-time-details{
pointer-events: none;
Expand Down Expand Up @@ -2043,7 +2056,7 @@ html.darkmode #post_comment.post-comment-force-privatemode-off .comment-post-pri
}
.emotion-keyboard {
max-width: min(500px, 100vw);
min-width: min(300px, 100vw);
min-width: min(300px, 100vw);
display: flex;
height: 300px;
flex-direction: column;
Expand All @@ -2061,7 +2074,7 @@ html.darkmode #post_comment.post-comment-force-privatemode-off .comment-post-pri
#comment_emotion_btn.comment-emotion-keyboard-open + .emotion-keyboard{
opacity: 1;
transform: translateY(100%);
pointer-events: all;
pointer-events: all;
}
.emotion-keyboard-content {
flex: 1;
Expand Down

0 comments on commit c1ebab2

Please sign in to comment.