Skip to content

Commit

Permalink
0.870
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Mar 5, 2020
1 parent 83701ff commit 64242dd
Show file tree
Hide file tree
Showing 13 changed files with 278 additions and 52 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ Argon 使用 [GPL V3.0](https://github.com/solstice23/argon-theme/blob/master/LI

# 更新日志

## 20200303 v0.853
## 20200306 v0.870
+ 优化搜索体验,将搜索框嵌入导航栏中,同时搜索支持 Pjax
+ 增加首页文章和说说同时显示的选项
+ 修复 Safari 上的一个性能问题
+ 增加评论禁用 Markdown 选项
+ 优化手机端阅读体验
+ 手机端浮动按钮增加透明度
+ 修复偶现的 Tooltip 乱码问题
+ 修复手机点击导航栏链接菜单不会自动关闭的问题
+ 修复其他小问题

## 20200303 v0.860
+ 编辑文章界面侧栏增加 "隐藏字数及阅读时间提示 Meta 信息" 选项
+ 优化夜间模式相关逻辑
+ 修复赞赏二维码的显示和过渡动画问题
Expand Down
51 changes: 35 additions & 16 deletions argontheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,23 @@ function getCookie(cname) {

function changeToolbarTransparency(){
//let toolbarRgb = "94, 114, 228";
let toolbarRgb = $("meta[name='theme-color-rgb']").attr("content");
if ($("html").hasClass("darkmode")){
toolbarRgb = "33, 33, 33";
}
let scrollTop = $(window).scrollTop();
startTransitionHeight = $bannerContainer.offset().top - 75;
endTransitionHeight = $content.offset().top - 75;
if ($(window).scrollTop() < startTransitionHeight){
$toolbar.css("cssText","background-color: rgba(" + toolbarRgb + ", 0) !important;");
$toolbar.css("cssText","background-color: rgba(var(--toolbar-color) , 0) !important;");
$toolbar.css("box-shadow","none");
$toolbar.addClass("navbar-ontop");
return;
}
if ($(window).scrollTop() > endTransitionHeight){
$toolbar.css("cssText","background-color: rgba(" + toolbarRgb + ", 0.85) !important;");
$toolbar.css("cssText","background-color: rgba(var(--toolbar-color) , 0.85) !important;");
$toolbar.css("box-shadow","");
$toolbar.removeClass("navbar-ontop");
return;
}
let transparency = (scrollTop - startTransitionHeight) / (endTransitionHeight - startTransitionHeight) * 0.85;
$toolbar.css("cssText","background-color: rgba(" + toolbarRgb + ", " + transparency + ") !important;");
$toolbar.css("cssText","background-color: rgba(var(--toolbar-color) , " + transparency + ") !important;");
$toolbar.css("box-shadow","");
$toolbar.removeClass("navbar-ontop");
}
Expand All @@ -62,6 +58,25 @@ function getCookie(cname) {
});
}();

/*顶栏搜索*/
$(document).on("click" , "#navbar_search_input_container" , function(){
$(this).addClass("open");
$("#navbar_search_input").focus();
});
$(document).on("blur" , "#navbar_search_input_container" , function(){
$(this).removeClass("open");
});
$(document).on("keydown" , "#navbar_search_input_container #navbar_search_input" , function(e){
if (e.keyCode != 13){
return;
}
let word = $(this).val();
if (word == ""){
return;
}
let scrolltop = $(document).scrollTop();
pjaxLoadUrl("/?s=" + encodeURI(word) , true , 0 , scrolltop);
});

/*左侧栏随页面滚动浮动*/
!function(){
Expand Down Expand Up @@ -222,7 +237,7 @@ function getCookie(cname) {
range: {
'min': [0],
'max': [30]
}
}
});
slider.noUiSlider.on('update', function (values){
let value = values[0];
Expand Down Expand Up @@ -767,7 +782,7 @@ $(document).on("click" , "#blog_categories .tag" , function(){
$("#blog_categories button.close").trigger("click");
});

/*侧栏手机适配*/
/*侧栏 & 顶栏菜单手机适配*/
!function(){
$(document).on("click" , "#fabtn_open_sidebar" , function(){
$("html").addClass("leftbar-opened");
Expand All @@ -778,6 +793,12 @@ $(document).on("click" , "#blog_categories .tag" , function(){
$(document).on("click" , "#leftbar a[href]:not([no-pjax]):not([href^='#'])" , function(){
$("html").removeClass("leftbar-opened");
});
$(document).on("click" , "#navbar_global .navbar-nav a[href]:not([no-pjax]):not([href^='#'])" , function(){
$("#navbar_global .navbar-toggler").click();
});
$(document).on("click" , "#navbar_global #navbar_search_btn_mobile" , function(){
$("#navbar_global .navbar-toggler").click();
});
}();

/*折叠区块小工具*/
Expand Down Expand Up @@ -1030,11 +1051,11 @@ if ($("meta[name='argon-enable-custom-theme-color']").attr("content") == 'true')
swatches: ['#5e72e4', '#fa7298', '#009688', '#607d8b', '#2196f3', '#3f51b5', '#ff9700', '#109d58', '#dc4437', '#673bb7', '#212121', '#795547'],
defaultRepresentation: 'HEX',
showAlways: false,
closeWithKey: 'Escape',
position: 'top-start',
adjustableNumbers: false,
components: {
palette: true,
closeWithKey: 'Escape',
position: 'top-start',
adjustableNumbers: false,
components: {
palette: true,
preview: true,
opacity: false,
hue: true,
Expand Down Expand Up @@ -1106,8 +1127,6 @@ function updateThemeColor(color, setcookie){
$("meta[name='theme-color']").attr("content", themecolor);
$("meta[name='theme-color-rgb']").attr("content", themecolor_rgbstr);

$(window).trigger("scroll");

if (setcookie){
setCookie("argon_custom_theme_color", themecolor, 365);
}
Expand Down
2 changes: 1 addition & 1 deletion assets/argon_css_merged.css

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@
</div></div>
<div class="row" style="margin-top: 5px; margin-bottom: 10px;">
<div class="col-md-12">
<div class="custom-control custom-checkbox comment-post-use-markdown">
<input class="custom-control-input" id="comment_post_use_markdown" type="checkbox" checked="true">
<label class="custom-control-label" for="comment_post_use_markdown" style="line-height: 25px;">Markdown</label>
</div>
<?php if (get_option("argon_comment_allow_markdown") != "false") {?>
<div class="custom-control custom-checkbox comment-post-use-markdown">
<input class="custom-control-input" id="comment_post_use_markdown" type="checkbox" checked="true">
<label class="custom-control-label" for="comment_post_use_markdown" style="line-height: 25px;">Markdown</label>
</div>
<?php } ?>
<button id="post_comment_send" class="btn btn-icon btn-primary pull-right" type="button">
<span class="btn-inner--icon"><i class="fa fa-send"></i></span>
<span class="btn-inner--text">发送</span>
Expand Down
27 changes: 27 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ function comment_markdown_render($comment_content){
if ($_POST['use_markdown'] != 'true'){
return $comment_content;
}
if (get_option("argon_comment_allow_markdown") == "false"){
return $comment_content;
}
//HTML 过滤
global $allowedtags;
//$comment_content = wp_kses($comment_content, $allowedtags);
Expand Down Expand Up @@ -1773,6 +1776,17 @@ function themeoptions_page(){
<p class="description"></p>
</td>
</tr>
<tr>
<th><label>是否允许在评论中使用 Markdown 语法</label></th>
<td>
<select name="argon_comment_allow_markdown">
<?php $argon_comment_allow_markdown = get_option('argon_comment_allow_markdown'); ?>
<option value="true" <?php if ($argon_comment_allow_markdown=='true'){echo 'selected';} ?>>允许</option>
<option value="false" <?php if ($argon_comment_allow_markdown=='false'){echo 'selected';} ?>>不允许</option>
</select>
<p class="description"></p>
</td>
</tr>
<tr><th class="subtitle"><h3>评论区</h3></th></tr>
<tr>
<th><label>评论头像垂直位置</label></th>
Expand All @@ -1797,6 +1811,17 @@ function themeoptions_page(){
<p class="description">Pjax 可以增强页面的跳转体验</p>
</td>
</tr>
<tr>
<th><label>博客首页是否显示说说</label></th>
<td>
<select name="argon_home_show_shuoshuo">
<?php $argon_home_show_shuoshuo = get_option('argon_home_show_shuoshuo'); ?>
<option value="false" <?php if ($argon_home_show_shuoshuo=='false'){echo 'selected';} ?>>不显示</option>
<option value="true" <?php if ($argon_home_show_shuoshuo=='true'){echo 'selected';} ?>>显示</option>
</select>
<p class="description">开启后,博客首页文章和说说穿插显示</p>
</td>
</tr>
<tr>
<th><label>是否使用 v2ex CDN 代理的 gravatar</label></th>
<td>
Expand Down Expand Up @@ -1997,6 +2022,8 @@ function themeoptions_page(){
update_option('argon_card_radius', $_POST['argon_card_radius']);
update_option('argon_comment_avatar_vcenter', $_POST['argon_comment_avatar_vcenter']);
update_option('argon_pjax_disabled', $_POST['argon_pjax_disabled']);
update_option('argon_comment_allow_markdown', $_POST['argon_comment_allow_markdown']);
update_option('argon_home_show_shuoshuo', $_POST['argon_home_show_shuoshuo']);

//LazyLoad 相关
update_option('argon_enable_lazyload', $_POST['argon_enable_lazyload']);
Expand Down
14 changes: 11 additions & 3 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function toggleDarkmode(){
}
$(window).trigger("scroll");
}
console.log(localStorage.getItem("Argon_Enable_Dark_Mode"));
if (localStorage.getItem("Argon_Enable_Dark_Mode") == "true"){
toggleDarkmode();
}
Expand All @@ -94,7 +93,6 @@ function toggleDarkmode(){
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/smoothscroll/smoothscroll1.js"></script>
<?php }?>

<script src="<?php bloginfo('template_url'); ?>/assets/vendor/nouislider/js/nouislider.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/assets/js/argon.min.js"></script>
<?php wp_head(); ?>
</head>
Expand Down Expand Up @@ -227,7 +225,17 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
}
?>
<ul class="navbar-nav align-items-lg-center ml-lg-auto">
<li class="nav-item" data-toggle="modal" data-target="#argon_search_modal">
<li id="navbar_search_container" class="nav-item" data-toggle="modal">
<div id="navbar_search_input_container">
<div class="input-group input-group-alternative">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-search"></i></span>
</div>
<input name="s" class="form-control" placeholder="搜索什么..." type="text" autocomplete="off" id="navbar_search_input">
</div>
</div>
</li>
<li id="navbar_search_btn_mobile" class="nav-item" data-toggle="modal" data-target="#argon_search_modal">
<a class="nav-link nav-link-icon">
<i class="fa fa-search"></i>
<span class="nav-link-inner--text d-lg-none">搜索</span>
Expand Down
13 changes: 12 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,22 @@

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if (get_option("argon_home_show_shuoshuo") == "true"){
global $wp_query;
$args = array_merge($wp_query->query_vars, array('post_type' => array('post','shuoshuo')));
query_posts($args);
}
?>
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', get_post_format() );
if (get_post_type() == 'post'){
get_template_part( 'template-parts/content', get_post_format() );
}else{
get_template_part( 'template-parts/content-shuoshuo-preview', get_post_format() );
}
endwhile;
?>
<?php
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.860",
"version" : "0.870",
"details_url" : "https://github.com/solstice23/argon-theme/releases",
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.860/argon.zip"
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.870/argon.zip"
}
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 64242dd

Please sign in to comment.