Skip to content

Commit

Permalink
0.943
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Apr 12, 2020
1 parent a52d087 commit cf29f31
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 20 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ Argon 使用 [GPL V3.0](https://github.com/solstice23/argon-theme/blob/master/LI

# 更新日志

## 20200412 v0.943
+ 增加归档时间轴页面模板
+ 侧栏格言支持调用一言 API
+ 增加对 Wordpress 子目录安装方式的兼容性适配选项
+ 修复和 Prism.js 的一个兼容性问题
+ 修复侧栏图标不对齐问题

## 20200411 v0.941
+ 修复评论 UA 图标错误的 BUG
+ 修复评论编辑历史记录显示错误的 BUG
Expand Down
31 changes: 31 additions & 0 deletions admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#wpadminbar {
background: #5e72e4;
}

#wpadminbar .menupop .ab-sub-wrapper, #wpadminbar .shortlink-input{
border-radius: 5px;
margin-top: 5px;
background: #fff;
}
#wpadminbar .quicklinks .menupop ul.ab-sub-secondary, #wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu {
background: #fff;
border-radius: 5px;
}

#wpadminbar .quicklinks .menupop ul li a, #wpadminbar .quicklinks .menupop ul li a strong, #wpadminbar .quicklinks .menupop.hover ul li a, #wpadminbar.nojs .quicklinks .menupop:hover ul li a {
color: #333;
transition: color .25s ease;
}
#wpadminbar .quicklinks .menupop ul li a:hover, #wpadminbar .quicklinks .menupop ul li a strong:hover, #wpadminbar .quicklinks .menupop.hover ul li a:hover, #wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover {
color: #5e72e4 !important;
}
#wpadminbar .ab-top-menu>li.hover>.ab-item, #wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus, #wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item, #wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus {
background: #7d8ff3;
color: #fff;
}
#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover>a, #wpadminbar .quicklinks .menupop ul li a:focus, #wpadminbar .quicklinks .menupop ul li a:focus strong, #wpadminbar .quicklinks .menupop ul li a:hover, #wpadminbar .quicklinks .menupop ul li a:hover strong, #wpadminbar .quicklinks .menupop.hover ul li a:focus, #wpadminbar .quicklinks .menupop.hover ul li a:hover, #wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:focus, #wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:hover, #wpadminbar li #adminbarsearch.adminbar-focused:before, #wpadminbar li .ab-item:focus .ab-icon:before, #wpadminbar li .ab-item:focus:before, #wpadminbar li a:focus .ab-icon:before, #wpadminbar li.hover .ab-icon:before, #wpadminbar li.hover .ab-item:before, #wpadminbar li:hover #adminbarsearch:before, #wpadminbar li:hover .ab-icon:before, #wpadminbar li:hover .ab-item:before, #wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus, #wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover {
color: #fff;
}
#wpadminbar:not(.mobile)>#wp-toolbar a:focus span.ab-label, #wpadminbar:not(.mobile)>#wp-toolbar li:hover span.ab-label, #wpadminbar>#wp-toolbar li.hover span.ab-label {
color: #fff;
}
30 changes: 24 additions & 6 deletions argontheme.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
if (typeof(wp_path) == "undefined"){
var wp_path = "/";
}
/*Cookies 操作*/
function setCookie(cname, cvalue, exdays) {
var d = new Date();
Expand Down Expand Up @@ -79,7 +82,7 @@ $(document).on("keydown" , "#navbar_search_input_container #navbar_search_input"
return;
}
let scrolltop = $(document).scrollTop();
pjaxLoadUrl("/?s=" + encodeURI(word) , true , 0 , scrolltop);
pjaxLoadUrl(wp_path + "?s=" + encodeURI(word) , true , 0 , scrolltop);
});
/*侧栏搜索*/
$(document).on("click" , "#leftbar_search_container" , function(){
Expand All @@ -103,7 +106,7 @@ $(document).on("keydown" , "#leftbar_search_input" , function(e){
}
$("html").removeClass("leftbar-opened");
let scrolltop = $(document).scrollTop();
pjaxLoadUrl("/?s=" + encodeURI(word) , true , 0 , scrolltop);
pjaxLoadUrl(wp_path + "?s=" + encodeURI(word) , true , 0 , scrolltop);
});

/*左侧栏随页面滚动浮动*/
Expand Down Expand Up @@ -528,7 +531,7 @@ $(document).on("keydown" , "#leftbar_search_input" , function(e){

$.ajax({
type: 'POST',
url: "/wp-admin/admin-ajax.php",
url: wp_path + "wp-admin/admin-ajax.php",
dataType : "json",
data: {
action: "ajax_post_comment",
Expand Down Expand Up @@ -709,7 +712,7 @@ $(document).on("keydown" , "#leftbar_search_input" , function(e){

$.ajax({
type: 'POST',
url: "/wp-admin/admin-ajax.php",
url: wp_path + "wp-admin/admin-ajax.php",
dataType : "json",
data: {
action: "user_edit_comment",
Expand Down Expand Up @@ -818,7 +821,7 @@ function showCommentEditHistory(id){
$("#comment_edit_history").modal(null);
$.ajax({
type: 'POST',
url: "/wp-admin/admin-ajax.php",
url: wp_path + "wp-admin/admin-ajax.php",
dataType : "json",
data: {
action: "get_comment_edit_history",
Expand Down Expand Up @@ -1287,7 +1290,7 @@ $(document).on("click" , ".shuoshuo-upvote" , function(){
ID = $this.attr("data-id");
$this.addClass("shuoshuo-upvoting");
$.ajax({
url : "/wp-admin/admin-ajax.php",
url : wp_path + "wp-admin/admin-ajax.php",
type : "POST",
dataType : "json",
data : {
Expand Down Expand Up @@ -1619,6 +1622,21 @@ function typeEffect(element, text, now, interval){
}
}();

/*一言*/
if ($(".hitokoto").length > 0){
$.ajax({
type: 'GET',
url: "https://v1.hitokoto.cn",
success: function(result){
result = JSON.parse(result);
$(".hitokoto").text(result.hitokoto);
},
error: function(result){
$(".hitokoto").text("Hitokoto 获取失败");
}
});
}

/*Console*/
!function(){
console.log('%cTheme: %cArgon%cBy solstice23', 'color: rgba(255,255,255,.6); background: #5e72e4; font-size: 15px;border-radius:5px 0 0 5px;padding:10px 0 10px 20px;','color: rgba(255,255,255,1); background: #5e72e4; font-size: 15px;border-radius:0;padding:10px 15px 10px 0px;','color: #fff; background: #92A1F4; font-size: 15px;border-radius:0 5px 5px 0;padding:10px 20px 10px 15px;');
Expand Down
36 changes: 30 additions & 6 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ function argon_widgets_init() {
);
}
add_action('widgets_init','argon_widgets_init');
//注册新后台主题配色方案
function argon_add_admin_color(){
wp_admin_css_color(
'argon',
'Argon',
get_bloginfo('template_directory') . "/admin.css",
array("#5e72e4"),
array('base' => '#525f7f', 'focus' => '#5e72e4', 'current' => '#fff')
);
}
/*add_action('admin_init', 'argon_add_admin_color');*/
//输出分页页码
function get_argon_formatted_paginate_links($maxPageNumbers, $extraClasses = ''){
$args = array(
Expand Down Expand Up @@ -1423,15 +1434,19 @@ function argon_get_post_outdated_info(){
if ($delta == -1){
$delta = 2147483647;
}
$post_date_delta = floor((time() - get_the_time("U")) / (60 * 60 * 24));
$modify_date_delta = floor((time() - get_the_modified_time("U")) / (60 * 60 * 24));
if (get_option("argon_outdated_info_time_type") == "createdtime"){
$post_delta = floor((time() - get_the_time("U")) / (60 * 60 * 24));
$date_delta = $post_date_delta;
}else{
$post_delta = floor((time() - get_the_modified_time("U")) / (60 * 60 * 24));
$date_delta = $modify_date_delta;
}
if ($post_delta <= $delta){
if ($date_delta <= $delta){
return "";
}
$content = str_replace("%date_delta%", $post_delta, $content);
$content = str_replace("%date_delta%", $date_delta, $content);
$content = str_replace("%modify_date_delta%", $modify_date_delta, $content);
$content = str_replace("%post_date_delta%", $post_date_delta, $content);
return $before . $content . $after;
}
//主题文章短代码解析
Expand Down Expand Up @@ -2122,6 +2137,14 @@ function themeoptions_page(){
<p class="description">选择主题资源文件的引用地址。使用 CDN 可以加速资源文件的访问并减少服务器压力。</p>
</td>
</tr>
<tr><th class="subtitle"><h3>子目录</h3></th></tr>
<tr>
<th><label>Wordpress 安装目录</label></th>
<td>
<input type="text" class="regular-text" name="argon_wp_path" value="<?php echo (get_option('argon_wp_path') == '' ? '/' : get_option('argon_wp_path')); ?>"/>
<p class="description">如果 Wordpress 安装在子目录中,请在此填写子目录地址(例如 <code>/blog/</code>),注意前后各有一个斜杠。默认为 <code>/</code>。</br>如果不清楚该选项的用处,请保持默认。</p>
</td>
</tr>
<tr><th class="subtitle"><h2>顶栏</h2></th></tr>
<tr><th class="subtitle"><h3>标题</h3></th></tr>
<tr>
Expand Down Expand Up @@ -2273,7 +2296,7 @@ function themeoptions_page(){
<th><label>左侧栏子标题(格言)</label></th>
<td>
<input type="text" class="regular-text" name="argon_sidebar_banner_subtitle" value="<?php echo get_option('argon_sidebar_banner_subtitle'); ?>"/>
<p class="description">留空则不显示</p>
<p class="description">留空则不显示</br>输入 <code>--hitokoto--</code> 调用一言 API</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -2433,7 +2456,7 @@ function themeoptions_page(){
的方式提示
</br>
<textarea type="text" name="argon_outdated_info_tip_content" rows="3" cols="100" style="margin-top: 15px;"><?php echo get_option('argon_outdated_info_tip_content') == '' ? '本文最后更新于 %date_delta% 天前,其中的信息可能已经有所发展或是发生改变。' : get_option('argon_outdated_info_tip_content'); ?></textarea>
<p class="description">天数为 -1 表示永不提示。</br>%date_delta% 表示文章发布/修改时间与当前时间的差距(单位: 天)。</p>
<p class="description">天数为 -1 表示永不提示。</br><code>%date_delta%</code> 表示文章发布/修改时间与当前时间的差距,<code>%post_date_delta%</code> 表示文章发布时间与当前时间的差距,<code>%modify_date_delta%</code> 表示文章修改时间与当前时间的差距(单位: 天)。</p>
</td>
</tr>
<tr><th class="subtitle"><h2>页脚</h2></th></tr>
Expand Down Expand Up @@ -3204,6 +3227,7 @@ function argon_update_themeoptions(){
argon_update_option('argon_enable_pangu');
argon_update_option('argon_assets_path');
argon_update_option('argon_comment_ua');
argon_update_option('argon_wp_path');

//LazyLoad 相关
argon_update_option('argon_enable_lazyload');
Expand Down
4 changes: 4 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
wp_enqueue_script("argonjs", $GLOBALS['assets_path'] . "/assets/js/argon.min.js", null, $GLOBALS['theme_version']);
?>
<?php wp_head(); ?>
<?php $GLOBALS['wp_path'] = get_option('argon_wp_path') == '' ? '/' : get_option('argon_wp_path'); ?>
<script>
var wp_path = "<?php echo $GLOBALS['wp_path']; ?>";
</script>
<script>
var darkmodeAutoSwitch = "<?php echo (get_option("argon_darkmode_autoswitch") == '' ? 'false' : get_option("argon_darkmode_autoswitch"));?>";
function setDarkmode(enable){
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.941",
"version" : "0.943",
"details_url" : "https://github.com/solstice23/argon-theme/releases",
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.941/argon.zip"
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.943/argon.zip"
}
10 changes: 8 additions & 2 deletions sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
<div class="leftbar-banner card-body">
<span class="leftbar-banner-title text-white"><?php echo get_option('argon_sidebar_banner_title') == '' ? bloginfo('name') : get_option('argon_sidebar_banner_title'); ?></span>

<?php if (get_option('argon_sidebar_banner_subtitle') != '') { /*左侧栏子标题/格言(如果选项中开启)*/?>
<span class="leftbar-banner-subtitle text-white"><?php echo get_option('argon_sidebar_banner_subtitle'); ?></span>
<?php
$sidebar_subtitle = get_option('argon_sidebar_banner_subtitle');
if ($sidebar_subtitle == "--hitokoto--"){
$sidebar_subtitle = "<span class='hitokoto'></span>";
}
?>
<?php if ($sidebar_subtitle != '') { /*左侧栏子标题/格言(如果选项中开启)*/?>
<span class="leftbar-banner-subtitle text-white"><?php echo $sidebar_subtitle; ?></span>
<?php } /*顶栏标题*/?>

</div>
Expand Down
54 changes: 50 additions & 4 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.941
Version: 0.943
License: GNU General Public License v3.0
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: 简约, 两栏, 侧栏在左边, 浮动侧栏, 文章目录, 自适应, 夜间模式, 可自定义
Expand Down Expand Up @@ -39,7 +39,7 @@ article h1 , article h2 , article h3 , article h4 , article h5 , article h6 , ar
}
article h1 , article h2 , article h3 , article h4 , article h5 , article h6{
margin-top: 18px !important;
margin-bottom: 15px;
margin-bottom: 15px;
}
article h1{
font-size: 30px;
Expand Down Expand Up @@ -127,9 +127,11 @@ article code{
color: #5e6687;
background: #f5f7ff;
direction: ltr;
padding: 2px 3px;
border-radius: 3px;
}
article > code , article > p > code{
padding: 2px 3px;
}
article .post-content abbr[title]{
text-decoration: none;
cursor: help;
Expand Down Expand Up @@ -538,6 +540,7 @@ html.darkmode.amoled-dark #navbar-main{
.leftbar-menu-item > a > i{
margin-right: 8px;
width: 15px;
text-align: center;
}
.leftbar-menu-item.leftbar-menu-item-haschildren:after {
content: "\f0da";
Expand Down Expand Up @@ -1583,13 +1586,25 @@ background: rgba(var(--themecolor-rgbstr), .1);
border: 1px solid rgba(0, 0, 0, .12);
padding: 14px;
border-radius: 3px;
margin-top: 15px;
}
html.darkmode .comment-item-text pre {
border: 1px solid rgba(255, 255, 255, .12);
background: #525252;
color: #eee;
}
html.darkmode.amoled-dark .comment-item-text pre {
background: #000;
}
.comment-item-text blockquote {
padding-left: 1.2em;
margin: 1em 3em 1em 0;
font-weight: 400;
border-left: 3px solid rgba(0, 0, 0, .12);
}
html.darkmode .comment-item-text blockquote {
border-color: rgba(255, 255, 255, .2);
}
.comment-item-text ol li {
list-style-type: decimal !important;
}
Expand Down Expand Up @@ -2786,6 +2801,38 @@ html[class] , html[lang]{
opacity: 0;
pointer-events: none;
}
/*归档时间轴*/
.archive-timeline{
padding-top: 10px;
}
.archive-timeline-title {
box-shadow: none;
border: none;
background: transparent !important;
font-size: 18px;
padding: 0;
margin-left: 1px;
margin-bottom: 25px;
padding-top: 7px;
}
.archive-timeline-year {
font-size: 30px;
color: var(--themecolor);
}
.archive-timeline-year + .archive-timeline-title {
height: 50px;
margin-top: 30px;
}
.archive-timeline-year + .archive-timeline-title {
height: 50px;
margin-top: 30px;
}
.archive-timeline-title > a:before {
display: none;
}
.argon-timeline-node:first-child > .archive-timeline-year + .archive-timeline-title {
margin-top: 0;
}
/*Loading Dot*/
.loading-css-animation {
text-align: center;
Expand Down Expand Up @@ -3170,7 +3217,6 @@ html.darkmode.amoled-dark article .post-content pre{
}
html.darkmode.amoled-dark article .post-content code{
background: #000;
border: 1px solid rgba(255, 255, 255, .12);
}

html.darkmode.amoled-dark .form-control{
Expand Down
29 changes: 29 additions & 0 deletions timeline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/*
Template Name: 归档时间轴
*/
?>

<?php get_header(); ?>

<?php get_sidebar(); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
while ( have_posts() ) :
the_post();

get_template_part( 'template-parts/content', 'timeline' );

if (get_option("argon_show_sharebtn") != 'false') {
get_template_part( 'template-parts/share' );
}

if (comments_open() || get_comments_number()) {
comments_template();
}
endwhile;
?>

<?php get_footer(); ?>

0 comments on commit cf29f31

Please sign in to comment.