This commit is contained in:
杜恒 2021-05-12 10:44:36 +08:00
parent 87b9be6b26
commit 144804ecb7
14 changed files with 128 additions and 240 deletions

File diff suppressed because one or more lines are too long

View File

@ -988,58 +988,71 @@
}
}
}
&.ranking {
&.today {
background: var(--background);
.item {
display: flex;
align-items: center;
line-height: 32px;
overflow: hidden;
&:nth-child(1) .sort {
color: #fe2d46;
}
&:nth-child(2) .sort {
color: #f60;
}
&:nth-child(3) .sort {
color: #faa90e;
}
.sort {
color: var(--minor);
font-weight: 700;
font-size: 18px;
width: 18px;
min-width: 18px;
max-width: 18px;
}
.link {
.joe_aside__item-contain {
.item {
position: relative;
color: var(--routine);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&::after {
.tail {
position: absolute;
content: '';
bottom: 0;
left: 0;
width: 0;
height: 1px;
background: var(--theme);
transition: width 0.5s;
left: 6px;
top: 0;
height: 100%;
border-left: 1px solid var(--classC);
}
&:hover {
color: var(--theme);
&::after {
width: 100%;
.head {
position: absolute;
width: 13px;
height: 13px;
border-radius: 50%;
background: var(--background);
}
.desc {
position: relative;
top: -2px;
padding-left: 24px;
padding-bottom: 15px;
time {
display: block;
font-weight: 600;
margin-bottom: 7px;
}
a {
display: block;
color: var(--routine);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
transition: color 0.25s;
font-size: 13px;
&:hover {
color: var(--theme);
}
}
}
&:nth-child(even) {
.head {
border: 1px solid #f48b29;
}
.desc {
color: #f48b29;
}
}
&:nth-child(odd) {
.head {
border: 1px solid #f05454;
}
.desc {
color: #f05454;
}
}
&:last-child {
.desc {
padding-bottom: 0;
}
}
}
}
.error {
text-align: center;
color: var(--routine);
}
}
&.newreply {
background: var(--background);

View File

@ -154,35 +154,6 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
/* 激活侧边栏排行榜功能 */
{
if ($('.joe_aside__item.ranking').length) {
$.ajax({
url: Joe.BASE_API,
type: 'POST',
dataType: 'json',
data: { routeType: 'aside_ranking' },
success(res) {
$('.joe_aside__item.ranking .joe_aside__item-title .text').html(res.title);
let htmlStr = '';
if (res.code === 1) {
res.data.forEach((item, index) => {
htmlStr += `
<li class="item">
<span class="sort">${index + 1}</span>
<a class="link" href="${item.url}" title="${item.title}" target="_blank" rel="noopener noreferrer nofollow">${item.title}</a>
</li>
`;
});
} else {
htmlStr += `<li class="error">数据抓取异常!</li>`;
}
$('.joe_aside__item.ranking .joe_aside__item-contain').html(htmlStr);
}
});
}
}
/* 3d云标签 */
{
if ($('.joe_aside__item.tags').length) {

File diff suppressed because one or more lines are too long

View File

@ -36,9 +36,6 @@ function themeInit($self)
if ($path_info == "/joe/api") {
switch ($self->request->routeType) {
case 'aside_ranking':
_getRanking($self);
break;
case 'publish_list':
_getPost($self);
break;

View File

@ -74,7 +74,7 @@ class Editor
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210507') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210512') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js') ?>"></script>
<?php
}

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */
function _getVersion()
{
return "6.9.0";
return "6.9.1";
};
/* 判断是否是手机 */
@ -248,28 +248,6 @@ function _getParentReply($parent)
}
}
function _getHistoryToday($created)
{
$date = date('m/d', $created);
$time = time();
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
$sql = "SELECT * FROM `{$prefix}contents` WHERE DATE_FORMAT(FROM_UNIXTIME(created), '%m/%d') = '{$date}' and created <= {$time} and created != {$created} and type = 'post' and status = 'publish' and (password is NULL or password = '') LIMIT 5";
$result = $db->query($sql);
if ($result instanceof Traversable) {
foreach ($result as $item) {
$item = Typecho_Widget::widget('Widget_Abstract_Contents')->push($item);
$title = htmlspecialchars($item['title']);
$permalink = $item['permalink'];
echo "
<li class='item'>
<a class='link' href='{$permalink}' title='{$title}'>{$title}</a>
</li>
";
}
}
}
/* 获取侧边栏作者随机文章 */
function _getAsideAuthorNav()
{

View File

@ -1,30 +1,5 @@
<?php
/* 侧边栏热门排行榜 已测试 √ */
function _getRanking($self)
{
header("HTTP/1.1 200 OK");
header('Access-Control-Allow-Origin:*');
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
$ranking_txt = Helper::options()->JAside_Ranking;
$ranking_arr = explode("$", $ranking_txt);
$json = _curl("https://rank.the.top/v1/{$ranking_arr[1]}/1/9");
$res = json_decode($json, TRUE);
if ($res['code'] === 0) {
$self->response->throwJson([
"code" => 1,
"title" => $ranking_arr[0],
"data" => $res["data"]
]);
} else {
$self->response->throwJson([
"code" => 0,
"title" => $ranking_arr[0],
"data" => null
]);
}
}
/* 获取文章列表 已测试 √ */
function _getPost($self)
{

View File

@ -479,100 +479,6 @@ function themeConfig($form)
$JAside_Newreply_Status->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Newreply_Status->multiMode());
/* --------------------------------------- */
$JAside_Ranking = new Typecho_Widget_Helper_Form_Element_Select(
'JAside_Ranking',
array(
'off' => '关闭(默认)',
'知乎全站排行榜$zhihu_total' => '知乎全站排行榜',
'知乎科学排行榜$zhihu_science' => '知乎科学排行榜',
'知乎数码排行榜$zhihu_digital' => '知乎数码排行榜',
'知乎体育排行榜$zhihu_sport' => '知乎体育排行榜',
'知乎时尚排行榜$zhihu_fashion' => '知乎时尚排行榜',
'微博热搜榜$weibo' => '微博热搜榜',
'微博新闻榜$weibo_news' => '微博新闻榜',
'360实时热点$so_hotnews' => '360实时热点',
'百度实时热点$baidu_ssrd' => '百度实时热点',
'百度今日热点$baidu_today' => '百度今日热点',
'百度七日热点$baidu_week' => '百度七日热点',
'百度体育热点$baidu_sport' => '百度体育热点',
'百度娱乐热点$baidu_yule' => '百度娱乐热点',
'百度民生热点$baidu_minsheng' => '百度民生热点',
'历史今天$lssdjt' => '历史今天',
'网易24H新闻点击榜$t_en_dianji' => '网易24H新闻点击榜',
'网易今日跟贴榜$t_en_today' => '网易今日跟贴榜',
'网易1小时前点击榜$t_en_hour' => '网易1小时前点击榜',
'网易娱乐跟贴榜$t_en_yule' => '网易娱乐跟贴榜',
'CNBA点击榜$cnbeta_hot' => 'CNBA点击榜',
'CNBA评论榜$cnbeta_comment' => 'CNBA评论榜',
'虎嗅热文榜$huxiu' => '虎嗅热文榜',
'IT之家24H最热榜$ithome_day' => 'IT之家24H最热榜',
'IT之家一周最热榜$ithome_week' => 'IT之家一周最热榜',
'IT之家月度热文榜$ithome_month' => 'IT之家月度热文榜',
'36KR人气榜$kr_renqi' => '36KR人气榜',
'36KR收藏榜$kr_shoucang' => '36KR收藏榜',
'36KR综合榜$kr_zonghe' => '36KR综合榜',
'少数派热文榜$sspai' => '少数派热文榜',
'豆瓣新片榜$douban_day' => '豆瓣新片榜',
'豆瓣口碑榜$douban_week' => '豆瓣口碑榜',
'豆瓣北美榜$douban_na' => '豆瓣北美榜',
'豆瓣京东畅销榜$douban_jd' => '豆瓣京东畅销榜',
'豆瓣当当畅销榜$douban_dd' => '豆瓣当当畅销榜',
'观察者24H最热榜$guancha_day' => '观察者24H最热榜',
'观察者3天最热榜$guancha_three' => '观察者3天最热榜',
'观察者一周最热榜$guancha_week' => '观察者一周最热榜',
'晋江文学月排行榜$jjwxc_month' => '晋江文学月排行榜',
'晋江文学季度榜$jjwxc_quater' => '晋江文学季度榜',
'晋江文学总分榜$jjwxc_rank' => '晋江文学总分榜',
'澎湃热门新闻榜$ppnews_day' => '澎湃热门新闻榜',
'澎湃3天最热新闻榜$ppnews_three' => '澎湃3天最热新闻榜',
'澎湃一周最热新闻榜$ppnews_week' => '澎湃一周最热新闻榜',
'起点24小时畅销榜$qidian_day' => '起点24小时畅销榜',
'起点周阅读指数榜$qidian_week' => '起点周阅读指数榜',
'起点风云榜$qidian_fy' => '起点风云榜',
'爱范儿热文排行榜$ifanr' => '爱范儿热文排行榜',
'ACFun日榜$acfun_day' => 'ACFun日榜',
'ACFun三日榜$acfun_three_days' => 'ACFun三日榜',
'ACFun三日榜$acfun_three_days' => 'ACFun三日榜',
'ACFun七日榜$acfun_week' => 'ACFun七日榜',
'ACFun七日榜$acfun_week' => 'ACFun七日榜',
'腾讯视频热门榜$qq_v' => '腾讯视频热门榜',
'bilibili排行榜$bsite' => 'bilibili排行榜',
'V2EX热门榜$vsite' => 'V2EX热门榜',
'52破解热门榜$t_pj_hot' => '52破解热门榜',
'52破解人气榜$t_pj_renqi' => '52破解人气榜',
'52破解精品榜$t_pj_soft' => '52破解精品榜',
'抖音视频榜$t_dy_hot' => '抖音视频榜',
'抖音正能量榜$t_dy_right' => '抖音正能量榜',
'抖音搜索榜$t_dy_s' => '抖音搜索榜',
'汽车之家热门榜$t_auto_art' => '汽车之家热门榜',
'汽车之家3日最热榜$t_auto_video' => '汽车之家3日最热榜',
'今日头条周热榜$t_tt_week' => '今日头条周热榜',
'看看新闻热点榜$kankan' => '看看新闻热点榜',
'新京报今日热门榜$xingjing' => '新京报今日热门榜',
'新京报本周热门榜$xingjing_week' => '新京报本周热门榜',
'新京报本月热门榜$xingjing_month' => '新京报本月热门榜',
'Zaker新闻榜$zaker' => 'Zaker新闻榜',
'雪球话题榜$xueqiu' => '雪球话题榜',
'天涯论坛热帖榜$tianya_retie' => '天涯论坛热帖榜',
'钛媒体热文榜$tmtpost' => '钛媒体热文榜',
'techweb排行榜$techweb' => 'techweb排行榜',
'爱卡汽车热点榜$xcar_ssrd' => '爱卡汽车热点榜',
'爱卡汽车人气榜$xcar_rq' => '爱卡汽车人气榜',
'爱卡汽车关注榜$xcar_gz' => '爱卡汽车关注榜',
'太平洋汽车热文榜$pcauto_art' => '太平洋汽车热文榜',
'太平洋汽车热贴榜$pcauto_tie' => '太平洋汽车热贴榜',
'新浪点击榜$sina_dj' => '新浪点击榜',
'新浪评论榜$sina_pl' => '新浪评论榜',
'新浪视频榜$sina_vd' => '新浪视频榜',
'新浪图片榜$sina_pic' => '新浪图片榜'
),
'off',
'是否开启排行榜栏 - PC',
'介绍:用于控制是否开启排行榜栏'
);
$JAside_Ranking->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Ranking->multiMode());
/* --------------------------------------- */
$JAside_Weather_Key = new Typecho_Widget_Helper_Form_Element_Text(
'JAside_Weather_Key',
NULL,
@ -650,6 +556,20 @@ function themeConfig($form)
);
$JAside_Flatterer->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Flatterer->multiMode());
/* --------------------------------------- */
$JAside_History_Today = new Typecho_Widget_Helper_Form_Element_Select(
'JAside_History_Today',
array(
'off' => '关闭(默认)',
'on' => '开启'
),
'off',
'是否开启那年今日 - PC',
'介绍:用于设置侧边栏是否显示往年今日的文章 <br />
其他:如果往年今日有文章则显示,没有则不显示!'
);
$JAside_History_Today->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_History_Today->multiMode());
$JThumbnail = new Typecho_Widget_Helper_Form_Element_Textarea(

View File

@ -1,6 +1,6 @@
{
"name": "typecho-joe-next",
"version": "6.9.0",
"version": "6.9.1",
"description": "A Theme Of Typecho",
"main": "index.php",
"keywords": [

View File

@ -37,6 +37,55 @@
<?php if ($this->options->JCustomAside) : ?>
<section class="joe_aside__item"><?php $this->options->JCustomAside() ?></section>
<?php endif; ?>
<?php if ($this->options->JAside_History_Today === 'on') : ?>
<?php
$time = time();
$todayDate = date('m/d', $time);
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
$sql = "SELECT * FROM `{$prefix}contents` WHERE DATE_FORMAT(FROM_UNIXTIME(created), '%m/%d') = '{$todayDate}' and created < {$time} and type = 'post' and status = 'publish' and (password is NULL or password = '') LIMIT 10";
$result = $db->query($sql);
$historyTodaylist = [];
if ($result instanceof Traversable) {
foreach ($result as $item) {
$item = Typecho_Widget::widget('Widget_Abstract_Contents')->push($item);
$historyTodaylist[] = array(
"title" => htmlspecialchars($item['title']),
"permalink" => $item['permalink'],
"date" => $item['year'] . ' ' . $item['month'] . '/' . $item['day']
);
}
}
?>
<?php if (count($historyTodaylist) > 0) : ?>
<section class="joe_aside__item today">
<div class="joe_aside__item-title">
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M701.217 207.026H304.974v26.713c0 17.809-13.357 33.391-33.391 33.391-17.81 0-33.392-13.356-33.392-33.39v-26.714h-91.27c-33.39 0-60.104 26.713-60.104 60.104v601.044c0 33.391 26.713 60.104 60.105 60.104h739.06a60.817 60.817 0 0 0 60.105-60.104V267.13c0-33.39-26.713-60.104-60.104-60.104h-120.21v26.713c0 17.809-13.356 33.391-33.39 33.391-17.81 0-33.392-13.356-33.392-33.39v-26.714zm64.557-64.556h120.209c69.008 0 124.66 55.652 124.66 124.66v601.044c0 33.391-13.356 64.556-35.617 89.043-22.26 22.261-55.652 35.618-89.043 35.618H146.922c-33.392 0-64.557-13.357-89.044-35.618-22.26-22.26-35.617-55.652-35.617-89.043V267.13c0-69.008 55.652-124.66 124.66-124.66h91.27V53.426c0-17.809 13.357-33.391 33.392-33.391 17.808 0 33.39 13.356 33.39 33.391v89.044h396.244V53.426c0-17.809 15.583-31.165 33.392-31.165S768 35.617 768 55.652v86.818zm0 0" />
<path d="M471.93 460.8c46.748 20.035 91.27 44.522 129.113 73.46l-26.713 44.523c-42.295-31.166-86.817-57.879-129.113-75.687L471.93 460.8zm-153.6 129.113h396.244v40.07c-33.391 89.043-106.852 155.826-215.93 202.574l-35.618-46.748c91.27-35.618 153.6-84.592 189.217-149.148H318.33v-46.748zm180.313-269.356h37.844c66.783 75.686 149.148 135.79 240.417 180.313l-26.713 48.973c-91.27-46.747-166.956-106.852-231.513-180.313-57.878 69.01-135.791 129.113-231.513 180.313l-26.713-48.973c93.496-46.748 173.635-109.079 238.191-180.313zm0 0" />
</svg>
<span class="text">那年今日</span>
<span class="line"></span>
</div>
<ul class="joe_aside__item-contain">
<?php foreach ($historyTodaylist as $item) : ?>
<li class="item">
<div class="tail"></div>
<div class="head"></div>
<div class="desc">
<time datetime="<?php echo $item['date'] ?>"><?php echo $item['date'] ?></time>
<a href="<?php echo $item['permalink'] ?>" title="<?php echo $item['title'] ?>">
<?php echo $item['title'] ?>
</a>
</div>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->options->JAside_Hot_Num && $this->options->JAside_Hot_Num !== 'off') : ?>
<section class="joe_aside__item hot">
<div class="joe_aside__item-title">
@ -105,21 +154,6 @@
</ul>
</section>
<?php endif; ?>
<?php if ($this->options->JAside_Ranking && $this->options->JAside_Ranking !== 'off') : ?>
<section class="joe_aside__item ranking">
<div class="joe_aside__item-title">
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M939.855 202.778H832.418V124.41A124.32 124.32 0 0 0 708.368 0H315.27a124.411 124.411 0 0 0-124.05 124.411v78.367H83.874A84.145 84.145 0 0 0 0 286.922C0 410.07 82.249 486.36 194.562 519.403a321.862 321.862 0 0 0 281.415 273.47v158.9H308.68a36.114 36.114 0 0 0 0 72.227h406.277a36.114 36.114 0 0 0 0-72.227H547.662v-158.9a321.682 321.682 0 0 0 281.415-273.47C941.39 486.36 1023.73 410.07 1023.73 286.923a84.145 84.145 0 0 0-83.874-84.145zM67.442 286.922a16.612 16.612 0 0 1 16.432-16.07H191.22v175.602c-72.678-31.148-123.779-75.477-123.779-159.532zM511.82 727.237a254.15 254.15 0 0 1-252.794-253.969V124.411a56.698 56.698 0 0 1 56.246-56.698h393.096a56.698 56.698 0 0 1 56.608 56.698v348.857a254.15 254.15 0 0 1-252.794 253.969zm320.599-280.783V270.852h107.437a16.612 16.612 0 0 1 16.342 16.431c0 83.694-51.1 128.023-123.78 159.17z" />
<path d="M696.54 469.476a33.676 33.676 0 0 0-43.426 19.772 153.483 153.483 0 0 1-92.541 90.284 33.856 33.856 0 0 0 11.014 65.817 32.954 32.954 0 0 0 10.925-1.805 218.938 218.938 0 0 0 133.71-130.641 33.856 33.856 0 0 0-19.682-43.427zm-179.123-311.57l-2.438 2.71a163.956 163.956 0 0 1-33.856 27.084 183.999 183.999 0 0 1-39.815 16.342l-6.41 1.625v64.914l10.743-3.07a180.568 180.568 0 0 0 55.254-25.911v223.272h64.282V157.907z" />
</svg>
<span class="text">loading...</span>
<span class="line"></span>
</div>
<ul class="joe_aside__item-contain">
<li class="error">数据获取中...</li>
</ul>
</section>
<?php endif; ?>
<?php if ($this->options->JAside_Weather_Key) : ?>
<section class="joe_aside__item weather" data-key="<?php $this->options->JAside_Weather_Key() ?>" data-style="<?php $this->options->JAside_Weather_Style() ?>">
<div class="joe_aside__item-title">

View File

@ -18,7 +18,7 @@
<?php endif; ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=20210507'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=20210512'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css'); ?>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/qmsg/qmsg.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
"@codemirror/lang-markdown": "^0.18.2",
"@codemirror/matchbrackets": "^0.18.0",
"@codemirror/state": "^0.18.7",
"@codemirror/view": "^0.18.11",
"@codemirror/view": "^0.18.12",
"@rollup/plugin-node-resolve": "^13.0.0",
"rollup-plugin-uglify": "^6.0.4"
}