Skip to content

Commit

Permalink
0.925
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Apr 3, 2020
1 parent 717957f commit fef378b
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Argon 使用 [GPL V3.0](https://github.com/solstice23/argon-theme/blob/master/LI

# 更新日志

## 20200403 v0.925
+ Github 短代码增加可选的后端获取模式
+ 修复 "暗化" 滤镜不生效的问题

## 20200403 v0.924
+ 修复顶栏菜单 "在新标签页打开" 选项不生效的 BUG

Expand Down
9 changes: 9 additions & 0 deletions argontheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,15 @@ $(document).on("click" , ".collapse-block .collapse-block-title" , function(){
function getGithubInfoCardContent(){
$(".github-info-card").each(function(){
(function($this){
if ($this.attr("data-getdata") == "backend"){
$(".github-info-card-description" , $this).html($this.attr("data-description"));
$(".github-info-card-stars" , $this).html($this.attr("data-stars"));
$(".github-info-card-forks" , $this).html($this.attr("data-forks"));
return;
}
$(".github-info-card-description" , $this).html("Loading...");
$(".github-info-card-stars" , $this).html("-");
$(".github-info-card-forks" , $this).html("-");
author = $this.attr("data-author");
project = $this.attr("data-project");
$.ajax({
Expand Down
49 changes: 44 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function theme_slug_setup() {
);
}else{
$argonThemeUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://raw.githubusercontent.com/solstice23/argon-theme/master/info.json',
'https://api.solstice23.top/argon/info.json?source=github',
get_template_directory() . '/functions.php',
'argon'
);
Expand Down Expand Up @@ -1783,22 +1783,61 @@ function shortcode_github($attr,$content=""){
$github_info_card_id = mt_rand(1000000000 , 9999999999);
$author = isset($attr['author']) ? $attr['author'] : '';
$project = isset($attr['project']) ? $attr['project'] : '';
$out = "<div class='github-info-card card shadow-sm' data-author='" . $author . "' data-project='" . $project . "' githubinfo-card-id='" . $github_info_card_id . "'>";
$getdata = isset($attr['getdata']) ? $attr['getdata'] : 'frontend';

$description = "";
$stars = "";
$forks = "";

if ($getdata == "backend"){
set_error_handler(function($errno, $errstr, $errfile, $errline, $errcontext) {
if (error_reporting() === 0) {
return false;
}
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
try{
$contexts = stream_context_create(
array(
'http' => array(
'method'=>"GET",
'header'=>"User-Agent: ArgonTheme\r\n"
)
)
);
$json = file_get_contents("https://api.github.com/repos/" . $author . "/" . $project, false, $contexts);
if (empty($json)){
throw new Exception("");
}
$json = json_decode($json);
$description = esc_html($json -> description);
if (!empty($json -> homepage)){
$description .= esc_html(" <a href='" . $json -> homepage . "' target='_blank' no-pjax>" . $json -> homepage . "</a>");
}
$stars = $json -> stargazers_count;
$forks = $json -> forks_count;
}catch (Exception $e){
$getdata = "frontend";
}
restore_error_handler();
}

$out = "<div class='github-info-card card shadow-sm' data-author='" . $author . "' data-project='" . $project . "' githubinfo-card-id='" . $github_info_card_id . "' data-getdata='" . $getdata . "' data-description='" . $description . "' data-stars='" . $stars . "' data-forks='" . $forks . "'>";
$out .= "<div class='github-info-card-header'><a href='https://github.com/' ref='nofollow' target='_blank' title='Github' no-pjax><span><i class='fa fa-github'></i> Github</span></a></div>";
$out .= "<div class='github-info-card-body'>
<div class='github-info-card-name-a'>
<a href='https://github.com/" . $author . "/" . $project . "' target='_blank' no-pjax>
<span class='github-info-card-name'>" . $author . "/" . $project . "</span>
</a>
</div>
<div class='github-info-card-description'>Loading...</div>
<div class='github-info-card-description'></div>
</div>";
$out .= "<div class='github-info-card-bottom'>
<span class='github-info-card-meta'>
<i class='fa fa-star'></i> <span class='github-info-card-stars'>-</span>
<i class='fa fa-star'></i> <span class='github-info-card-stars'></span>
</span>
<span class='github-info-card-meta'>
<i class='fa fa-code-fork'></i> <span class='github-info-card-forks'>-</span>
<i class='fa fa-code-fork'></i> <span class='github-info-card-forks'></span>
</span>
</div>";
$out .= "</div>";
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.924",
"version" : "0.925",
"details_url" : "https://github.com/solstice23/argon-theme/releases",
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.924/argon.zip"
"download_url" : "https://github.com/solstice23/argon-theme/releases/download/v0.925/argon.zip"
}
4 changes: 2 additions & 2 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.924
Version: 0.925
License: GNU General Public License v3.0
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: 简约, 两栏, 侧栏在左边, 浮动侧栏, 文章目录, 自适应, 夜间模式, 可自定义
Expand Down Expand Up @@ -1020,7 +1020,7 @@ html.use-big-shadow #blog_setting_shadow_big{
html.filter-sunset{
filter: sepia(30%);
}
html.filter-darkness body #content:after{
html.filter-darkness #primary:after{
content: '';
position: fixed;
left: 0;
Expand Down

0 comments on commit fef378b

Please sign in to comment.