Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
11-2-2019
Browse files Browse the repository at this point in the history
  • Loading branch information
ttttonyhe committed Feb 11, 2019
1 parent 79a218f commit 50210be
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 25 deletions.
43 changes: 30 additions & 13 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<nav class="header-nav reveal">

<a class="top1 header-logo" style="text-decoration:none;" href="https://www.ouorz.com">XXXXX</a>
<p class="top2 lead" style="margin-top: 0px;display:block">XXXXXXXXXXXXXXXXXXXXXXXXXXX</p>
<p class="top2 lead archive-p">XXXXXXXXXXXXXXXXXXXXXXXXXXX</p>

<div class="btn-group" style="float: right;margin-top: -80px;">
<div class="btn-group" style="margin-top: -77px;margin-left: 180px;">
<button type="button" class="btn btn-primary"><a href="https://www.ouorz.com/" style="text-decoration:none;color:white"><i class="czs-hand-slide" style="margin-right:5px" ></i>回到首页</a></button>
</div>
</nav>
Expand Down Expand Up @@ -42,20 +42,19 @@
</li>
<!-- 占位DIV -->

<li class="article-list-item reveal index-post-list" uk-scrollspy="cls:uk-animation-slide-left-small" v-for="post in posts">
<li class="article-list-item reveal index-post-list" uk-scrollspy="cls:uk-animation-slide-left-small" v-for="post in posts" :style="post.post_categories[0].term_id | link_style">

<em v-if="post.post_categories[0].term_id === 7" class="article-list-type1">{{ post.post_categories[0].name }}</em>
<div v-if="post.post_categories[0].term_id === 2 || post.post_categories[0].term_id === 5" style="float: left;margin-right: 40px;"><img :src="post.post_metas.img[0]" style="width: 110px;height: 110px;border-radius: 8px;margin: 8px 0;"></div>

<a v-if="post.post_categories[0].term_id === 2 || post.post_categories[0].term_id === 5" :href="post.post_metas.link" style="text-decoration: none;"><h5 style="margin-top: 10px;" v-html="post.title.rendered"></h5></a>
<a v-else :href="post.link" style="text-decoration: none;"><h5 v-html="post.title.rendered"></h5></a>


<p v-html="post.post_excerpt"></p>
<div v-if="post.post_categories[0].term_id === 2 || post.post_categories[0].term_id === 5" class="link-list-left"><img :src="post.post_metas.img[0]" class="link-list-img"></div>
<div class="link-list-right">
<a v-if="post.post_categories[0].term_id === 2 || post.post_categories[0].term_id === 5" :href="post.post_metas.link" style="text-decoration: none;"><h5 style="margin-top: 10px;" v-html="post.title.rendered"></h5></a>
<a v-else :href="post.link" style="text-decoration: none;"><h5 v-html="post.title.rendered"></h5></a>
<p v-html="post.post_excerpt"></p>
<div class="article-list-footer">
<span class="article-list-date" style="color: #ada8a8;">{{ post.post_date }}</span>
<span class="article-list-divider">-</span>
<span class="article-list-minutes">{{ post.post_metas.views }}&nbsp;Views</span>
<span class="article-list-date" style="color: #ada8a8;">{{ post.post_categories[0].term_id | link_page }}{{ post.post_date }}</span>
<span class="article-list-divider" v-if="post.post_categories[0].term_id !== 2 && post.post_categories[0].term_id !== 5">-</span>
<span class="article-list-minutes" v-if="post.post_categories[0].term_id !== 2 && post.post_categories[0].term_id !== 5">{{ post.post_metas.views }}&nbsp;Views</span>
</div>
</div>
</li>

Expand Down Expand Up @@ -156,6 +155,24 @@
})
}
},
filters: {
link_page : function(cate_id){
if(cate_id == 2){
return '添加于 ';
}else if(cate_id == 5){
return '创造于 ';
}else{
return '';
}
},
link_style : function(cate_id){
if(cate_id == 2 || cate_id == 5){
return 'display: flex;';
}else{
return '';
}
}
}
});


Expand Down
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function wp_rest_get_plain_excerpt($post){
}

function wp_rest_get_normal_date($post){
$date = get_the_date( 'y-m-d',$post['id']);
$date = get_the_date( 'd-m-y',$post['id']);
return $date;
}

Expand Down
30 changes: 28 additions & 2 deletions header.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<html lang="zh">
<head>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php if ( is_home() ) {
Expand All @@ -14,6 +14,8 @@
} else {
wp_title('',true);
} ?></title>
<meta http-equiv="x-dns-prefetch-control" content="on" />
<link rel="dns-prefetch" href="https://static.ouorz.com" />
<meta name="keywords" content="<?php echo get_option('king_gjc');?>"/>
<meta name="description" content="<?php echo get_option('king_ms');?>">
<link rel="Shortcut Icon" href="https://static.ouorz.com/tonyhe.ico" type="image/x-icon" />
Expand All @@ -28,6 +30,16 @@
<script type="text/javascript" src="https://static.zeo.im/uikit.min.js"></script>
<script type="text/javascript" src="https://static.ouorz.com/vue.min.js"></script>
<script type="text/javascript" src="https://static.ouorz.com/axios.min.js"></script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?20265c137ab04d39313561665f1ae7a1";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>

</head>
<body id="body">

Expand Down Expand Up @@ -70,10 +82,24 @@
var to_top_header = $(document).scrollTop();
if (to_top_header <= 0) {
$('#header-div').attr('class','tony-header-fixed');

$('#header-div').hover(function(){
$('#header-div').attr('class','tony-header-scoll');
},function(){
$('#header-div').attr('class','tony-header-fixed');
})

}else{
$('#header-div').attr('class','tony-header-scoll');

$('#header-div').hover(function(){
$('#header-div').attr('class','tony-header-scoll');
},function(){
$('#header-div').attr('class','tony-header-scoll');
})
}
});
});

</script>


Expand Down
40 changes: 36 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id="header_info">
<nav class="header-nav reveal">
<a style="text-decoration:none;" href="https://www.ouorz.com" class="header-logo" title="TonyHe">TonyHe</a>
<p class="lead" style="margin-top: 0px;">Just A Poor Lifesinger</p>
<p class="lead" style="margin-top: 0px;margin-left:5px">Just A Poor Lifesinger</p>
</nav>
<div class="index-cates">
<li class="cat-item cat-item-4 cat-real" style="display:none" v-for="cate in cates" v-if="cate.count !== 0"> <a :href="cate.link" :title="cate.description">{{ cate.name }}</a>
Expand All @@ -27,9 +27,12 @@
<!-- 占位DIV -->

<li class="article-list-item reveal index-post-list" uk-scrollspy="cls:uk-animation-slide-left-small" v-for="post in posts">
<em v-if="post.post_categories[0].term_id === 7" class="article-list-type1">{{ post.post_categories[0].name }}</em>
<div class="list-show-div">
<em v-if="post.post_categories[0].term_id === 7" class="article-list-type1">{{ post.post_categories[0].name }}</em>
<button type="button" class="list-show-btn" @click="preview(post.id)" :id="'btn'+post.id">全文速览</button>
</div>
<a :href="post.link" style="text-decoration: none;"><h5 v-html="post.title.rendered"></h5></a>
<p v-html="post.post_excerpt"></p>
<p v-html="post.post_excerpt" :id="post.id"></p>
<div class="article-list-footer">
<span class="article-list-date">{{ post.post_date }}</span>
<span class="article-list-divider">-</span>
Expand All @@ -52,6 +55,10 @@
<script>
window.onload = function(){ //避免爆代码

var pre_post = 0;
var pre_post_con = '';
var pre_status = 1;
var now = 20;
var click = 0; //初始化加载次数
var paged = 1; //获取当前页数

Expand Down Expand Up @@ -129,8 +136,33 @@
$('.bottom h5').html('暂无更多文章了 O__O "…').css({'background':'#fff','color':'#999'});
}
})
},
preview : function(post){ //预览文章内容
if(post !== pre_post && pre_status){ //点开当前预览
pre_post = post;
pre_status = 0; //屏蔽其余预览按钮
$('#'+post).html('<div uk-spinner></div><h7 class="loading-text">加载中...</h7>');
axios.get('https://www.ouorz.com/wp-json/wp/v2/posts/'+post)
.then(response => {
if(response.data.length !== 0){ //判断是否最后一页
$('#btn'+post).html('收起速览'); //更改按钮
$('#'+post).attr('class','preview-p').html(response.data.content.rendered); //更改内容
pre_post_con = response.data.post_excerpt; //保存摘录
}else{
$('#'+post).html('Nothing Here');
}
});
}else if(post !== pre_post && pre_status == 0){ //点击了其余预览按钮,报错
UIkit.modal.dialog('<h3 style="margin: 0px;font-weight: 600;">错误</h3><p style="margin: 5px 0;">请先收起当前预览</p>');
}else{ //点击收起按钮
$('#btn'+post).html('全文速览');
$('#'+post).html(pre_post_con).attr('class','');
pre_post_con = '';
pre_post = 0;
pre_status = 1; //开放其他预览按钮
}
}
}
},
});


Expand Down
89 changes: 84 additions & 5 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ img {
.article-header {
display: block;
padding-bottom: 35px;
margin-bottom: 50px;
margin-bottom: 25px;
}
.article-header p {
display:block;
Expand Down Expand Up @@ -1418,7 +1418,7 @@ table{
top: 0px;
display: flex;
background: transparent;
z-index: 99999;
z-index: 2;
padding: 0 35px;
transition: ease-in-out .2s;
}
Expand All @@ -1431,7 +1431,7 @@ table{
box-shadow: rgba(0, 0, 0, 0.04) 0px 4px 8px;
display: flex;
background: #fff;
z-index: 99999;
z-index: 2;
padding: 0 35px;
transition: ease-in-out .2s;
}
Expand All @@ -1441,7 +1441,6 @@ table{
display: inline-block;
margin-bottom: 0px;
color: rgb(136, 136, 136);
margin-left: 5px;
}

.index-post-list{
Expand All @@ -1450,7 +1449,7 @@ table{
box-shadow: rgba(0, 0, 0, 0.08) 0px 1px 2px !important;
background: rgb(255, 255, 255);
border-radius: 6px;
transition: all 0.15s ease-out 0s;
transition: all .2s ease-out 0s;
}

.single-h2{
Expand Down Expand Up @@ -1523,13 +1522,93 @@ table{
transition: all .05s !important;
}

.uk-spinner>*>*{
animation: uk-spinner-dash 2s ease-in-out infinite !important;
stroke-width: 2 !important;
}

@media screen and (max-width:767px){
.tony-header-fixed{
display: none;
}
.tony-header-scoll{
display: none;
}
.link-list-img{
display: none;
}
.link-list-right{
flex-basis: 100% !important;
}
.link-list-left{
flex-basis: 0% !important;
}
}

.link-list-img{
width: 110px;height: 110px;border-radius: 8px;margin: 8px 0;
}

.link-list-right{
flex-basis: 70%;
}

.link-list-left{
float: left;flex-basis: 28.5%;
}

.archive-p{
margin-top: 0px;
display:block;
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}

.list-show-btn{
color: #999;
background: rgb(246, 247, 248);
border: none;
font-weight: 500;
font-style: normal;
padding: 3.5px 16px 4px 16px;
margin-top: -3px;
font-size: 1rem;
float: right;
vertical-align: top;
border-radius: 100px;
}

.list-show-div{
margin-bottom: 20px;
}

.preview-p{
margin: 30px 0 !important;
}

.uk-modal-dialog{
padding: 20px 30px !important;
top: 30px !important;
}

.preview-p blockquote{
font-style: normal;
background: rgb(247, 248, 249);
border: none;
padding: 10px 20px;
}

.preview-p blockquote p{
margin: 0px;
color: rgb(119, 119, 119);
}

.loading-text{
margin-left: 15px;
font-weight: 600;
font-size: 1rem;
}

/* End of The Tony Vershion */

0 comments on commit 50210be

Please sign in to comment.