This commit is contained in:
杜恒 2021-01-20 18:28:15 +08:00
parent b835bca92d
commit 10d5b45193
8 changed files with 172 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -551,7 +551,7 @@
right: 0;
bottom: 0;
padding: 10px;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.45));
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75));
font-size: 12px;
color: var(--seat);
h6 {

View File

@ -92,6 +92,8 @@ window.Joe = function () {
const aqiColor = { 1: 'FFFFFF', 2: '4A4A4A', 3: 'FFFFFF' };
window.WIDGET = { CONFIG: { layout: 2, width: '220', height: '270', background: style, dataColor: aqiColor[style], language: 'zh', key: key } };
}
new LazyLoad('.lazyload');
};
document.addEventListener('DOMContentLoaded', () => Joe());

26
core/api.php Normal file
View File

@ -0,0 +1,26 @@
<?php
$_requestType = _getParam('type');
switch ($_requestType) {
case 'getRank':
_getRank();
break;
}
function _getRank()
{
}
function _getParam($key, $default = '')
{
return trim($key && is_string($key) ? (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $default)) : $default);
}
function _echoJson($data = null, $code = 1)
{
die(array(
"code" => $code,
"data" => $data
));
}

View File

@ -1,5 +1,32 @@
<?php
function themeInit($self)
{
$path_info = $self->request->getPathinfo();
switch ($path_info) {
case '/action/ranking':
_getRanking($self);
break;
};
}
function _getRanking($self)
{
header("HTTP/1.1 200 OK");
$ranking_txt = Helper::options()->JAside_Ranking;
$ranking_arr = explode("$", $ranking_txt);
$arrContextOptions = ['ssl' => ['verify_peer' => false, 'verify_peer_name' => false,]];
$json = file_get_contents("https://the.top/v1/{$ranking_arr[1]}/1/9", false, stream_context_create($arrContextOptions));
$res = json_decode($json, TRUE);
if ($res['code'] === 0) {
$self->response->throwJson([
"title" => $ranking_arr[0],
"data" => $res["data"]
]);
} else {
$self->response->throwJson(null);
}
}
function _getVersion()
{
@ -67,6 +94,13 @@ function _getThumbnail($item)
echo $randomThumb;
}
function _getViews($item)
{
$db = Typecho_Db::get();
$result = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $item->cid))['views'];
echo number_format($result);
}
function _getLazyload()
{
echo Helper::options()->JLazyload;

View File

@ -81,7 +81,8 @@ function themeConfig($form)
'author' => '作者栏',
'timelife' => '计时栏',
'weather' => '天气栏需先在下方填写KEY值',
'hot' => '热门文章栏'
'hot' => '热门文章栏',
'ranking' => '排行榜栏',
),
null,
'选择首页需要显示的侧边栏栏目',
@ -190,6 +191,99 @@ function themeConfig($form)
$JAside_Hot_Num->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Hot_Num->multiMode());
$JAside_Ranking = new Typecho_Widget_Helper_Form_Element_Select(
'JAside_Ranking',
array(
'知乎全站排行榜$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' => '新浪图片榜'
),
'知乎全站排行榜$zhihu_total',
'选择排行榜类型',
'介绍:用于控制侧边栏排行榜所显示的类型'
);
$JAside_Ranking->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Ranking->multiMode());
$JThumbnail = new Typecho_Widget_Helper_Form_Element_Textarea(
'JThumbnail',
NULL,

View File

@ -42,7 +42,7 @@
<?php endif; ?>
<?php if (in_array('hot', $this->options->JAside)) : ?>
<div class="joe_aside__item hot">
<section class="joe_aside__item hot">
<div class="joe_aside__item-title">
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M512 938.666667A426.666667 426.666667 0 0 1 85.333333 512a421.12 421.12 0 0 1 131.2-306.133333 58.88 58.88 0 0 1 42.666667-16.64c33.28 1.066667 58.026667 28.16 84.266667 56.96 7.893333 8.533333 19.626667 21.333333 28.373333 29.013333a542.933333 542.933333 0 0 0 24.533333-61.866667c18.133333-52.266667 35.413333-101.76 75.306667-121.6C526.72 64 583.253333 129.706667 654.933333 213.333333c16.213333 18.773333 38.613333 44.8 53.546667 59.52 1.706667-4.48 3.2-8.96 4.48-12.373333 8.533333-24.32 18.986667-54.613333 51.2-61.653333a57.813333 57.813333 0 0 1 55.68 20.053333A426.666667 426.666667 0 0 1 512 938.666667zM260.693333 282.453333A336.64 336.64 0 0 0 170.666667 512a341.333333 341.333333 0 1 0 614.826666-203.733333 90.24 90.24 0 0 1-42.666666 50.56 68.266667 68.266667 0 0 1-53.546667 1.706666c-25.6-9.173333-51.626667-38.4-99.2-93.226666a826.666667 826.666667 0 0 0-87.253333-91.733334 507.733333 507.733333 0 0 0-26.24 64c-18.133333 52.266667-35.413333 101.76-75.946667 119.253334-48.853333 21.333333-88.32-21.333333-120.106667-56.96-5.76-4.693333-13.226667-13.013333-19.84-19.413334z" p-id="14764"></path>
@ -54,27 +54,29 @@
<?php $this->widget('Widget_Contents_Hot', 'pageSize=' . $this->options->JAside_Hot_Num)->to($item); ?>
<ol class="joe_aside__item-contain">
<?php if ($item->have()) : ?>
<?php $index = 1; ?>
<?php while ($item->next()) : ?>
<li class="item">
<a class="link" href="<?php $item->permalink() ?>" title="<?php $item->title() ?>">
<i class="sort"><?php ?></i>
<img class="image lazyload" src="<?php _getLazyload() ?>" data-original="<?php _getThumbnail($item); ?>" alt="<?php $item->title() ?>" />
<a class="link" href="<?php $item->permalink(); ?>" title="<?php $item->title(); ?>">
<i class="sort"><?php echo $index; ?></i>
<img class="image lazyload" src="<?php _getLazyload(); ?>" data-original="<?php _getThumbnail($item); ?>" alt="<?php $item->title() ?>" />
<div class="describe">
<h6><?php $item->title() ?></h6>
<span> 阅读 - <?php $item->date('m/d'); ?></span>
<h6><?php $item->title(); ?></h6>
<span><?php _getViews($item); ?> 阅读 - <?php $item->date('m/d'); ?></span>
</div>
</a>
</li>
<?php $index++; ?>
<?php endwhile; ?>
<?php else : ?>
<li class="empty">这个博主很懒!</li>
<?php endif; ?>
</ol>
</div>
</section>
<?php endif; ?>
<?php if (in_array('weather', $this->options->JAside) && $this->options->JAside_Weather_Key) : ?>
<div class="joe_aside__item weather" data-key="<?php $this->options->JAside_Weather_Key() ?>" data-style="<?php $this->options->JAside_Weather_Style() ?>">
<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">
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M773.12 757.76h-79.872c-15.36 0-29.696-15.36-29.696-29.696s15.36-29.696 29.696-29.696h79.872c100.352 0 180.224-79.872 180.224-180.224S873.472 337.92 773.12 337.92c-25.6 0-50.176 5.12-74.752 15.36-10.24 5.12-20.48 5.12-25.6 0-10.24-5.12-15.36-15.36-15.36-20.48-15.36-100.352-100.352-175.104-200.704-175.104C346.112 155.648 256 245.76 250.88 356.352c0 15.36-10.24 29.696-29.696 29.696-79.872 5.12-145.408 74.752-145.408 160.768 0 90.112 70.656 160.768 160.768 160.768h75.776c15.36 0 29.696 15.36 29.696 29.696s-15.36 30.72-30.72 30.72h-79.872C110.592 757.76 10.24 662.528 10.24 541.696c0-105.472 75.776-195.584 175.104-216.064 15.36-130.048 130.048-235.52 266.24-235.52 120.832 0 225.28 79.872 256 195.584 20.48-5.12 45.056-10.24 65.536-10.24C908.288 276.48 1013.76 387.072 1013.76 517.12S903.168 757.76 773.12 757.76z" fill="" p-id="13873"></path>
@ -86,7 +88,7 @@
<div class="joe_aside__item-contain">
<div id="weather-v2-plugin-standard"></div>
</div>
</div>
</section>
<?php endif; ?>
</aside>
<?php endif; ?>

View File

@ -12,5 +12,6 @@
<link rel="stylesheet" href="https://apip.weatherdt.com/standard/static/css/weather-standard.css">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.lazyload.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.js'); ?>"></script>
<script async src="https://apip.weatherdt.com/standard/static/js/weather-standard.js?v=2.0"></script>