Skip to content

Commit

Permalink
0.800
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Jan 28, 2020
1 parent 01c3d59 commit 87a0ab6
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 50 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -59,6 +59,14 @@ Argon 使用 [GPL V3.0](https://github.com/solstice23/argon-theme/blob/master/LI

# 更新日志

## 20200128 v0.800
+ 大幅提升前端加载速度
+ SEO 优化
+ 增加 SEO Description Meta 标签和 Keywords Meta 标签设置选项
+ 增强页面可访问性,优化无障碍体验
+ 修复一些问题
+ 针对打印进行优化

## 20200125 v0.703
+ Github 用户名更换适配 (abc2237512422 -> solstice23)

Expand Down
8 changes: 8 additions & 0 deletions assets/argon_css_merged.css

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions assets/argon_js_merged.js

Large diffs are not rendered by default.

51 changes: 47 additions & 4 deletions functions.php
Expand Up @@ -117,10 +117,10 @@ function get_argon_formatted_paginate_links(){
//生成新页码
$html = "";
if ($from > 1){
$html .= '<li class="page-item"><a class="page-link" href="' . $urls[1] . '"><i class="fa fa-angle-double-left"></i></a></li>';
$html .= '<li class="page-item"><a aria-label="First Page" class="page-link" href="' . $urls[1] . '"><i class="fa fa-angle-double-left" aria-hidden="true"></i></a></li>';
}
if ($current > 1){
$html .= '<li class="page-item"><a class="page-link" href="' . $urls[$current - 1] . '"><i class="fa fa-angle-left"></i></a></li>';
$html .= '<li class="page-item"><a aria-label="Previous Page" class="page-link" href="' . $urls[$current - 1] . '"><i class="fa fa-angle-left" aria-hidden="true"></i></a></li>';
}
for ($i = $from; $i <= $to; $i++){
if ($current == $i){
Expand All @@ -130,13 +130,27 @@ function get_argon_formatted_paginate_links(){
}
}
if ($current < $total){
$html .= '<li class="page-item"><a class="page-link" href="' . $urls[$current + 1] . '"><i class="fa fa-angle-right"></i></a></li>';
$html .= '<li class="page-item"><a aria-label="Next Page" class="page-link" href="' . $urls[$current + 1] . '"><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>';
}
if ($to < $total){
$html .= '<li class="page-item"><a class="page-link" href="' . $urls[$total] . '"><i class="fa fa-angle-double-right"></i></a></li>';
$html .= '<li class="page-item"><a aria-label="Last Page" class="page-link" href="' . $urls[$total] . '"><i class="fa fa-angle-double-right" aria-hidden="true"></i></a></li>';
}
return '<nav><ul class="pagination">' . $html . '</ul></nav>';
}
//页面 Description Meta
function get_seo_description(){
global $post;
if ((is_single() || is_page())){
if (!post_password_required()){
return
htmlspecialchars(mb_substr(str_replace("\n", '', strip_tags(get_post($post -> ID) -> post_content)), 0, 50)) . "...";
}else{
return "这是一个加密页面,需要密码来查看";
}
}else{
return get_option('argon_seo_description');
}
}
//页面浏览量
function get_post_views($post_id){
$count_key = 'views';
Expand Down Expand Up @@ -1288,6 +1302,21 @@ function themeoptions_page(){
<p class="description">如果开启了设置按钮显示,建议关闭此选项。(夜间模式选项在设置菜单中已经存在)</p>
</td>
</tr>
<tr><th class="subtitle"><h2>SEO</h2></th></tr>
<tr>
<th><label>网站描述 (Description Meta 标签)</label></th>
<td>
<textarea type="text" rows="5" cols="100" name="argon_seo_description"><?php echo htmlspecialchars(get_option('argon_seo_description')); ?></textarea>
<p class="description">设置针对搜索引擎的 Description Meta 标签内容。</br>在文章中,Argon 会自动根据文章内容生成描述。在其他页面中,Argon 将使用这里设置的内容。如不填,Argon 将不会在其他页面输出 Description Meta 标签。</p>
</td>
</tr>
<tr>
<th><label>搜索引擎关键词(Keywords Meta 标签)</label></th>
<td>
<input type="text" class="regular-text" name="argon_seo_keywords" value="<?php echo get_option('argon_seo_keywords'); ?>"/>
<p class="description">设置针对搜索引擎使用的关键词(Keywords Meta 标签内容)。用英文逗号隔开。不设置则不输出该 Meta 标签。</p>
</td>
</tr>
<tr><th class="subtitle"><h2>文章 Meta 信息</h2></th></tr>
<tr>
<th><label>显示字数和预计阅读时间</label></th>
Expand Down Expand Up @@ -1550,6 +1579,17 @@ function themeoptions_page(){
<p class="description"></p>
</td>
</tr>
<tr>
<th><label>是否允许移动端缩放页面</label></th>
<td>
<select name="argon_enable_mobile_scale">
<?php $argon_enable_mobile_scale = get_option('argon_enable_mobile_scale'); ?>
<option value="false" <?php if ($argon_enable_mobile_scale=='false'){echo 'selected';} ?>></option>
<option value="true" <?php if ($argon_enable_mobile_scale=='true'){echo 'selected';} ?>></option>
</select>
<p class="description"></p>
</td>
</tr>
<tr>
<th><label>检测更新源</label></th>
<td>
Expand Down Expand Up @@ -1681,6 +1721,9 @@ function themeoptions_page(){
update_option('argon_show_headindex_number', $_POST['argon_show_headindex_number']);
update_option('argon_theme_color', $_POST['argon_theme_color']);
update_option('argon_show_customize_theme_color_picker', ($_POST['argon_show_customize_theme_color_picker'] == 'true')?'true':'false');
update_option('argon_seo_description', stripslashes($_POST['argon_seo_description']));
update_option('argon_seo_keywords', $_POST['argon_seo_keywords']);
update_option('argon_enable_mobile_scale', $_POST['argon_enable_mobile_scale']);

//LazyLoad 相关
update_option('argon_enable_lazyload', $_POST['argon_enable_lazyload']);
Expand Down
62 changes: 23 additions & 39 deletions header.php
Expand Up @@ -12,13 +12,23 @@
?>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php if (get_option('argon_enable_mobile_scale') != 'true'){ ?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<?php }else{ ?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
<?php } ?>
<meta property="og:title" content="<?php echo wp_get_document_title();?>">
<meta property="og:type" content="article">
<meta property="og:url" content="<?php echo home_url(add_query_arg(array(),$wp->request));?>">
<?php if ((is_single() || is_page()) && !post_password_required()){?>
<meta property="og:description" content="<?php global $post;echo
htmlspecialchars(mb_substr(str_replace("\n", '', strip_tags(get_post($post -> ID) -> post_content)), 0, 30)) . "...";?>">
<?php
$seo_description = get_seo_description();
if ($seo_description != ''){ ?>
<meta name="description" content="<?php echo $seo_description?>">
<meta property="og:description" content="<?php echo $seo_description?>">
<?php } ?>

<?php if (get_option('argon_seo_keywords') != ''){ ?>
<meta name="keywords" content="<?php echo get_option('argon_seo_keywords');?>">
<?php } ?>

<meta name="theme-color" content="<?php echo $themecolor; ?>">
Expand All @@ -30,19 +40,10 @@
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
<link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>">
<?php endif; ?>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/nprogress/nprogress.js"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
<link href="<?php bloginfo('template_url'); ?>/assets/vendor/nucleo/css/nucleo.css" rel="stylesheet">
<link href="<?php bloginfo('template_url'); ?>/assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/argon.min.css" rel="stylesheet">
<link href="<?php bloginfo('template_url'); ?>/style.css?v<?php echo wp_get_theme('argon')-> Version; ?>" type='text/css' media='all' rel='stylesheet'>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/jquery/jquery.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/bootstrap/bootstrap.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/popper/popper.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/headindex/headindex.js"></script>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/headroom/headroom.min.js"></script>
<link href="<?php bloginfo('template_url'); ?>/assets/vendor/izitoast/css/iziToast.css" rel="stylesheet">
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/izitoast/js/iziToast.min.js"></script>
<link href="<?php bloginfo('template_url'); ?>/assets/argon_css_merged.css?v<?php echo wp_get_theme('argon') -> Version; ?>" rel="stylesheet">
<link href="<?php bloginfo('template_url'); ?>/style.css?v<?php echo wp_get_theme('argon') -> Version; ?>" type='text/css' media='all' rel='stylesheet'>
<script src="<?php bloginfo('template_url'); ?>/assets/argon_js_merged.js"></script>
<link href="https://fonts.googleapis.com/css?family=Noto+Serif+SC:300&display=swap" rel="stylesheet">

<?php if (get_option('argon_enable_smoothscroll_type') == '2') { /*平滑滚动*/?>
Expand All @@ -55,23 +56,6 @@
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/smoothscroll/smoothscroll1.js"></script>
<?php }?>

<?php if (get_option('argon_enable_lazyload') != 'false') { /*LazyLoad*/?>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/lazyload/jquery.lazyload.min.js"></script>
<?php }?>

<?php if (get_option('argon_enable_zoomify') != 'false') { /*Zoomify*/?>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/zoomify/zoomify.js"></script>
<?php }?>

<?php if (get_option('argon_show_sharebtn') != 'false') { /*Share.js*/?>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/sharejs/share.min.js"></script>
<?php }?>

<?php if (get_option('argon_show_customize_theme_color_picker') != 'false') { /*Pickr*/?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/assets/vendor/pickr/themes/monolith.min.css"/>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/pickr/pickr.es5.min.js"></script>
<?php }?>

<script src="<?php bloginfo('template_url'); ?>/assets/js/argon.min.js"></script>
<?php wp_head(); ?>
</head>
Expand Down Expand Up @@ -253,17 +237,17 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
</section>

<div id="float_action_buttons" class="float-action-buttons fabs-unloaded">
<button id="fab_toggle_sides" class="btn btn-icon btn-neutral fab shadow-sm" type="button">
<button id="fab_toggle_sides" class="btn btn-icon btn-neutral fab shadow-sm" type="button" aria-hidden="true">
<span class="btn-inner--icon fab-show-on-right"><i class="fa fa-caret-left"></i></span>
<span class="btn-inner--icon fab-show-on-left"><i class="fa fa-caret-right"></i></span>
</button>
<button id="fab_back_to_top" class="btn btn-icon btn-neutral fab shadow-sm" type="button">
<button id="fab_back_to_top" class="btn btn-icon btn-neutral fab shadow-sm" type="button" aria-label="Back To Top">
<span class="btn-inner--icon"><i class="fa fa-angle-up"></i></span>
</button>
<button id="fab_toggle_darkmode" class="btn btn-icon btn-neutral fab shadow-sm" type="button" <?php if (get_option('argon_fab_show_darkmode_button') != 'true') echo " style='display: none;'";?>>
<button id="fab_toggle_darkmode" class="btn btn-icon btn-neutral fab shadow-sm" type="button" <?php if (get_option('argon_fab_show_darkmode_button') != 'true') echo " style='display: none;'";?> aria-label="Switch Darkmode">
<span class="btn-inner--icon"><i class="fa fa-moon-o"></i></span>
</button>
<button id="fab_toggle_blog_settings_popup" class="btn btn-icon btn-neutral fab shadow-sm" type="button" <?php if (get_option('argon_fab_show_settings_button') == 'false') echo " style='display: none;'";?>>
<button id="fab_toggle_blog_settings_popup" class="btn btn-icon btn-neutral fab shadow-sm" type="button" <?php if (get_option('argon_fab_show_settings_button') == 'false') echo " style='display: none;'";?> aria-label="Open Blog Settings Menu">
<span class="btn-inner--icon"><i class="fa fa-cog"></i></span>
</button>
<div id="fab_blog_settings_popup" class="card shadow-sm" style="opacity: 0;">
Expand Down Expand Up @@ -304,10 +288,10 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
</div>
<?php }?>
</div>
<button id="fab_open_sidebar" class="btn btn-icon btn-neutral fab shadow-sm" type="button">
<button id="fab_open_sidebar" class="btn btn-icon btn-neutral fab shadow-sm" type="button" aria-label="Open Sidebar Menu">
<span class="btn-inner--icon"><i class="fa fa-bars"></i></span>
</button>
<button id="fab_reading_progress" class="btn btn-icon btn-neutral fab shadow-sm" type="button">
<button id="fab_reading_progress" class="btn btn-icon btn-neutral fab shadow-sm" type="button" aria-hidden="true">
<div id="fab_reading_progress_bar" style="width: 0%;"></div>
<span id="fab_reading_progress_details">0%</span>
</button>
Expand Down
4 changes: 2 additions & 2 deletions info.json
@@ -1,5 +1,5 @@
{
"version" : "0.703",
"version" : "0.800",
"details_url" : "https://github.com/solstice23/argon-theme/releases",
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.703/argon.zip"
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.800/argon.zip"
}

0 comments on commit 87a0ab6

Please sign in to comment.