mirror of
https://github.com/SouthFox-D/SouthFox-D.github.io.git
synced 2024-11-25 08:26:51 +01:00
feat: Enable foxsay
This commit is contained in:
parent
b604e5ee14
commit
b9085ba8fa
5 changed files with 46 additions and 94 deletions
|
@ -3,21 +3,11 @@ title: 狐说
|
||||||
date: 2021-07-11 17:45:57
|
date: 2021-07-11 17:45:57
|
||||||
---
|
---
|
||||||
|
|
||||||
<html>
|
|
||||||
<link rel="stylesheet" href="/css/foxsay.css" media="screen" type="text/css">
|
<link rel="stylesheet" href="/css/foxsay.css" media="screen" type="text/css">
|
||||||
<main id="app">
|
<main id='app'>
|
||||||
<aside>
|
<div id="foxsay">
|
||||||
</aside>
|
</div>
|
||||||
<section class="item" v-for="item in contents" v-cloak>
|
<center><a target="_blank" href="https://foxsay.southfox.me/@SouthFox" type="button" class="btn btn-default"><i class="fa fa-paw"></i>到原始站点查看</a></center>
|
||||||
<bb v-html='item.attributes.content'></bb>
|
</main>
|
||||||
<time v-html:datetime="item.attributes.time">{{item.attributes.time}}</time>
|
<script src="../js/rss-parser.min.js"></script>
|
||||||
</section>
|
|
||||||
<div class="load-ctn">
|
|
||||||
<button class="btn btn-default " v-on:click="loadMore" v-if="contents" v-cloak>加载更多</button>
|
|
||||||
<p class="tip" v-else>加载中……</p>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/leancloud-storage@4.5.3/dist/av-min.js"></script>
|
|
||||||
<script src="../js/foxsay.js"></script>
|
<script src="../js/foxsay.js"></script>
|
||||||
</html>
|
|
|
@ -23,6 +23,9 @@ menu:
|
||||||
- title: 友链
|
- title: 友链
|
||||||
url: friends
|
url: friends
|
||||||
intro: "朋友们"
|
intro: "朋友们"
|
||||||
|
- title: 狐说
|
||||||
|
url: foxsay
|
||||||
|
intro: "狐狸怎么叫?"
|
||||||
- title : 开往
|
- title : 开往
|
||||||
url: travellings
|
url: travellings
|
||||||
intro: "一群狼走得更远"
|
intro: "一群狼走得更远"
|
||||||
|
@ -40,6 +43,10 @@ links:
|
||||||
url: /rss2.xml
|
url: /rss2.xml
|
||||||
intro: "Subscribe me."
|
intro: "Subscribe me."
|
||||||
icon: "fas fa-rss"
|
icon: "fas fa-rss"
|
||||||
|
- title: Foxsay
|
||||||
|
url: /foxsay
|
||||||
|
intro: "OWO"
|
||||||
|
icon: "fa fa-paw"
|
||||||
- title: 开往
|
- title: 开往
|
||||||
url: https://travellings.link
|
url: https://travellings.link
|
||||||
intro: "一群狼走得更远"
|
intro: "一群狼走得更远"
|
||||||
|
|
|
@ -31,10 +31,6 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
body,
|
|
||||||
button {
|
|
||||||
font-family: 'Noto Serif SC', serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside {
|
aside {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
|
@ -60,11 +56,15 @@ footer {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
line-height: 1.8rem;
|
line-height: 1.8rem;
|
||||||
|
background: #000;
|
||||||
|
padding: 10px 20px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
|
box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
border-top-color: coral !important;
|
||||||
|
border-top: 6px solid;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
background: #000;
|
white-space: pre-line;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item a {
|
.item a {
|
||||||
|
@ -77,17 +77,3 @@ time {
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb {
|
|
||||||
font-family: 'Noto Serif SC', serif;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.center-text {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.load-ctn {
|
|
||||||
margin-top: 15px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
|
@ -1,60 +1,19 @@
|
||||||
var {
|
let parser = new RSSParser();
|
||||||
Query
|
parser.parseURL('https://foxsay.southfox.me/@SouthFox.rss', function(err, feed) {
|
||||||
} = AV;
|
if (err) throw err;
|
||||||
AV.init({
|
for (let i = 0; i < 10; i++) {
|
||||||
appId: "hINvYWepO1gnhcNIPEycw7o5-MdYXbMMI", //你的 leancloud 应用 id (设置-应用keys-AppID)
|
const entry = feed.items[i];
|
||||||
appKey: "9PFMoeAb7yW62fAyNYdVDHAQ", //你的 leancloud 应用 AppKey (设置-应用keys-AppKey)
|
printPost(entry);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var query = new AV.Query('content');
|
function printPost(entry) {
|
||||||
|
section = document.createElement("section");
|
||||||
var app = new Vue({
|
section.classList.add('item');
|
||||||
el: '#app',
|
popContent = entry.contentSnippet;
|
||||||
data: {
|
|
||||||
page: 0,
|
section.innerHTML = popContent;
|
||||||
count: 0,
|
|
||||||
contents: []
|
blogs = document.getElementById('foxsay');
|
||||||
},
|
blogs.append(section);
|
||||||
methods: {
|
}
|
||||||
loadMore: function(event) {
|
|
||||||
getData(++this.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function urlToLink(str) {
|
|
||||||
var re = /(http|ftp|https):\/\/[\w-]+(.[\w-]+)+([\w-.,@?^=%&:/~+#]*[\w-\@?^=%&/~+#])?/g;;
|
|
||||||
|
|
||||||
str = str.replace(re, function(website) {
|
|
||||||
if (str.indexOf("cf-ipfs") != -1 ) {
|
|
||||||
return "<img src='" + website + "' alt='图片'></img>"
|
|
||||||
} else {
|
|
||||||
return "<a href='" + website + "' target='_blank'> <i class='iconfont icon-lianjie-copy'></i>链接 </a>";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getData(page = 0) {
|
|
||||||
query.descending('createdAt').skip(page * 20).limit(20).find().then(function(results) {
|
|
||||||
if (results.length == 0) {
|
|
||||||
alert('无了。')
|
|
||||||
} else {
|
|
||||||
let resC = results;
|
|
||||||
reqData = false;
|
|
||||||
resC.forEach((i) => {
|
|
||||||
let dateTmp = new Date(i.createdAt);
|
|
||||||
i.attributes.content = "<p>" + urlToLink(i.attributes.content) + "</p>";
|
|
||||||
i.attributes.time = `${dateTmp.getFullYear()}-${(dateTmp.getMonth() + 1) < 10 ? ('0' + (dateTmp.getMonth()+1)) : dateTmp.getMonth()+1}-${(dateTmp.getDate() + 1) < 10 ? ('0' + dateTmp.getDate()) : dateTmp.getDate()} ${(dateTmp.getHours() + 1) <= 10 ? ('0' + dateTmp.getHours()) : dateTmp.getHours()}:${(dateTmp.getMinutes() + 1) <= 10 ? ('0' + dateTmp.getMinutes()) : dateTmp.getMinutes()}`;
|
|
||||||
app.contents.push(i);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}, function(error) {});
|
|
||||||
}
|
|
||||||
|
|
||||||
getData(0);
|
|
||||||
|
|
||||||
query.count().then(function(count) {
|
|
||||||
app.count = count;
|
|
||||||
}, function(error) {});
|
|
||||||
|
|
10
themes/freemind/source/js/rss-parser.min.js
vendored
Normal file
10
themes/freemind/source/js/rss-parser.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue