Skip to content

Commit

Permalink
🎨 beautify codes
Browse files Browse the repository at this point in the history
  • Loading branch information
idealclover committed May 31, 2019
1 parent 6f042b0 commit 72ba01a
Show file tree
Hide file tree
Showing 16 changed files with 822 additions and 891 deletions.
60 changes: 29 additions & 31 deletions archive.php
@@ -1,57 +1,55 @@
<?php if ( ! defined( '__TYPECHO_ROOT_DIR__' ) ) {
exit;
<?php if (!defined('__TYPECHO_ROOT_DIR__')) {
exit;
} ?>

<?php $this->need( 'components/header.php' ); ?>
<?php $this->need('components/header.php'); ?>


<div class="container col-10" id="main">

<!-- <div class="col-12" id="title">-->
<!-- <h1 class="archive-title">-->
<!-- --><?php //$this->archiveTitle( array(
// 'category' => _t( '%s' ),
// 'search' => _t( '包含关键字 %s 的文章' ),
// 'tag' => _t( '标签 %s 下的文章' ),
// 'author' => _t( '%s 发布的文章' )
// ), '', '' ); ?>
<!-- </h1>-->
<!-- <hr>-->
<!-- </div>-->
<!-- <div class="col-12" id="title">
<h1 class="archive-title">
<?php // $this->archiveTitle(array(
// 'category' => _t('%s'),
// 'search' => _t('包含关键字 %s 的文章'),
// 'tag' => _t('标签 %s 下的文章'),
// 'author' => _t('%s 发布的文章')
// ));
?>
</h1>
<hr>
</div> -->

<div class="row">
<!-- <div class="col-12 col-lg-8" id="main" role="main">-->
<div class="col-12 col-lg-8">
<?php if ( $this->have() ): ?>
<?php while ( $this->next() ): ?>
<?php if ($this->have()) : ?>
<?php while ($this->next()) : ?>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<h2 class="post-title" itemprop="name headline">
<a itemprop="url" href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
</h2>
<p id="post-meta">
<i class="fa fa-clock-o"></i> <?php $this->date( 'Y.m.d' ); ?> |
<i class="fa fa-clock-o"></i> <?php $this->date('Y.m.d'); ?> |
<i class="fa fa-tags"></i> <?php $this->category(','); ?> |
<i class="fa fa-thumbs-o-up"></i> <?php AnotherLike_Plugin::theLike(false, $this->cid);?> <?php _e("") ?> |
<i class="fa fa-comments-o"></i> <?php $this->commentsNum( _t(' 0 条评论'), _t(' 1 条评论'), _t(' %d 条评论') ); ?>

<i class="fa fa-thumbs-o-up"></i> <?php AnotherLike_Plugin::theLike(false, $this->cid); ?> <?php _e("") ?> |
<i class="fa fa-comments-o"></i> <?php $this->commentsNum(_t(' 0 条评论'), _t(' 1 条评论'), _t(' %d 条评论')); ?>
<!-- TODO: 输出点赞&浏览数-->
</p>
<div class="post-content" itemprop="articleBody">
<?php $this->content( _t('查看更多 ->') ); ?>
<!-- --><?php //$this->excerpt( 100 ); ?>
<?php $this->content(_t('查看更多 ->')); ?>
</div>
<hr/>
<hr />
</article>
<?php endwhile; ?>
<?php else: ?>
<?php endwhile; ?>
<?php else : ?>
<article class="post">
<h2 class="post-title"><?php _e( '没有找到内容' ); ?></h2>
<h2 class="post-title"><?php _e('没有找到内容'); ?></h2>
</article>
<?php endif; ?>
<?php $this->pageNav( _t('&laquo; 前一页'), _t('后一页 &raquo;') ); ?>
<?php endif; ?>
<?php $this->pageNav(_t('&laquo; 前一页'), _t('后一页 &raquo;')); ?>
</div><!-- end #main -->
<?php $this->need('components/sidebar.php'); ?>
<?php $this->need('components/sidebar.php'); ?>
</div><!-- end #row -->
</div><!-- end #container -->

<?php $this->need( 'components/footer.php' ); ?>
<?php $this->need('components/footer.php'); ?>
45 changes: 31 additions & 14 deletions assets/clover.css
Expand Up @@ -17,15 +17,24 @@ h2 {
font-size: 1.7rem;
}

h3, h4, h5, h6 {
h3,
h4,
h5,
h6 {
font-size: 1.4rem;
}

h1, h2 {
h1,
h2 {
margin-bottom: 1rem;
}

h1, h2, h3, h4, h5, h6 {
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: normal;
}

Expand All @@ -50,27 +59,34 @@ img {
transition: filter .3s;
}

.page-title, .edit-link {
.page-title,
.edit-link {
display: inline-block;
}

.post-content img, .comment-content img, .post-content video, .comment-content video {
.post-content img,
.comment-content img,
.post-content video,
.comment-content video {
max-width: 100%;
}

.post-content h1:before, .page-content h1:before {
.post-content h1:before,
.page-content h1:before {
opacity: .5;
content: "#";
margin-right: .3rem;
}

.post-content h2:before, .page-content h2:before {
.post-content h2:before,
.page-content h2:before {
opacity: .5;
content: "##";
margin-right: .3rem;
}

.post-content h3:before, .page-content h3:before {
.post-content h3:before,
.page-content h3:before {
opacity: .5;
content: "###";
margin-right: .3rem;
Expand Down Expand Up @@ -158,7 +174,7 @@ blockquote p {
padding: 0;
}

.comment-children > .comment-list {
.comment-children>.comment-list {
margin-top: 1.5em;
margin-bottom: 0;
}
Expand Down Expand Up @@ -199,7 +215,7 @@ blockquote p {
clear: both;
}

.comment-content p{
.comment-content p {
margin: 0;
}

Expand All @@ -210,7 +226,7 @@ blockquote p {
padding: 14px;
margin-top: 0;
/*border: 1px solid #EEE;*/
border:0;
border: 0;
border-bottom: 1px solid #EEE;
}

Expand All @@ -235,7 +251,7 @@ blockquote p {
clear: both;
}

.moment-meta p{
.moment-meta p {
margin: 0;
}

Expand All @@ -247,7 +263,8 @@ blockquote p {
}


.list-group-root > .list-group-item , .list-group-wrapper > .list-group-item {
.list-group-root>.list-group-item,
.list-group-wrapper>.list-group-item {
padding-top: 10px;
padding-bottom: 10px;
}
Expand All @@ -256,7 +273,7 @@ blockquote p {
margin-top: 1px;
}

.list-group-wrapper > li{
.list-group-wrapper>li {
padding-left: 40px;
}

Expand Down
5 changes: 2 additions & 3 deletions assets/clover.js
Expand Up @@ -3,10 +3,9 @@ function turn_up() {
var btn = document.getElementsByClassName("turn-up")[0];
var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;

if(scroll >= window.innerHeight / 2) {
if (scroll >= window.innerHeight / 2) {
btn.classList.add("active");
}
else {
} else {
btn.classList.remove("active");
}
}
Expand Down
66 changes: 33 additions & 33 deletions bilibili.php
Expand Up @@ -9,28 +9,29 @@
exit;
}
?>
<?php $this->need('components/header.php');?>
<?php $this->need('components/header.php'); ?>

<?php
require 'libs/ParserDom/ParserDom.php';

//获取书籍清单数据

function getBookData($mid){
function getBookData($mid)
{
$url = "https://space.bilibili.com/ajax/Bangumi/getList?mid=$mid";
// $url = "https://api.douban.com/v2/book/user/$userID/collections?count=100"; //最多取100条数据
$res=json_decode(curl_get_contents($url),true); //读取api得到json
$res = json_decode(curl_get_contents($url), true); //读取api得到json
$res = $res['data']['result'];
if ($res == null || $res ==""){
if ($res == null || $res == "") {
echo '<script>$(function(){$(".douban_book_tips").text("获取书籍数据失败,可能原因是:1. 豆瓣API发生故障 2. 豆瓣id配置错误")})</script>';
return [];
}
foreach($res as $v){
$book_name=$v['title'];
foreach ($res as $v) {
$book_name = $v['title'];
$book_img = $v['cover'];
// $book_img = str_replace("/view/subject/m/public/","/lpic/",$book_img);
$book_url = $v['share_url'];
$readlist[] = array("name"=>$book_name,"img"=>$book_img,"url"=>$book_url);
$readlist[] = array("name" => $book_name, "img" => $book_img, "url" => $book_url);
}

return $readlist;
Expand All @@ -50,27 +51,26 @@ function curl_get_contents($url)
?>

<style>
.moviecard{
margin: 1rem 1.4rem;
}

.movieimg{
object-fit: cover;
width:100%;
}
.moviecard {
margin: 1rem 1.4rem;
}

.movietitle{
height: 4rem;
}
.movieimg {
object-fit: cover;
width: 100%;
}

.moviename{
height: 4rem;
overflow: hidden;
display: block;
text-overflow: ellipsis;
white-space: nowrap;
}
.movietitle {
height: 4rem;
}

.moviename {
height: 4rem;
overflow: hidden;
display: block;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

<div class="container col-lg-8 col-10" id="main" role="main">
Expand All @@ -83,26 +83,26 @@ function curl_get_contents($url)
<div class="row">
<?php
$readList = getBookData($this->fields->mid);
foreach($readList as $v):?>
foreach ($readList as $v) : ?>
<div class="card moviecard" style="width: 10rem;">
<img class="card-img-top movieimg" src="<?php echo $v['img']; ?>" alt="Card image cap" style="height:12rem;">
<!-- <div class="card-body moviename">
<a target="_blank" href="<?php echo $v['url'];?>"><?php echo $v['name']; ?></a>
</div> -->
<a target="_blank" href="<?php echo $v['url']; ?>"><?php echo $v['name']; ?></a>
</div> -->
<div class="card-body movietitle">
<a class="card-title moviename" target="_blank" target="_blank" href="<?php echo $v['url'];?>"><?php echo $v['name']; ?></a>
<a class="card-title moviename" target="_blank" target="_blank" href="<?php echo $v['url']; ?>"><?php echo $v['name']; ?></a>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</article>
<?php $this->need( 'components/comments.php' ); ?>
<?php $this->need('components/comments.php'); ?>
</div>
<?php $this->need( 'components/sidebar.php' ); ?>
<?php $this->need('components/sidebar.php'); ?>
</div>
</div><!-- end #main-->

<!-- footer -->
<?php $this->need('components/footer.php');?>
<!-- / footer -->
<?php $this->need('components/footer.php'); ?>
<!-- / footer -->

0 comments on commit 72ba01a

Please sign in to comment.