Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e69663dad4 | |||
| fcd1fa1d67 | |||
| 2082a070a9 | |||
| a79b0ac312 | |||
| 40a20f585e | |||
| 6f23f1daae | |||
| f44fd96544 | |||
| 9d4433a74d |
@@ -2,8 +2,21 @@
|
|||||||
|
|
||||||
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
||||||
精简部分 JS.
|
精简部分 JS.
|
||||||
|
|
||||||
- 2024.6.5
|
- 2024.6.12
|
||||||
|
|
||||||
|
更新豆瓣API获取方式
|
||||||
|
[Docker 自动同步豆瓣书影音记录](https://fatesinger.com/103483)
|
||||||
|
主题设置处填入API
|
||||||
|
|
||||||
|
- 2024.6.7
|
||||||
|
|
||||||
|
用自带评论做的说说页面,来自
|
||||||
|
https://github.com/gogobody/typecho-whisper
|
||||||
|
删减部分内容只能发表文字
|
||||||
|
|
||||||
|
- 2024.6.5 v0.5.3
|
||||||
|
|
||||||
新增了好物的页面 还是通过memos来获取
|
新增了好物的页面 还是通过memos来获取
|
||||||
|
|
||||||
- 2024.6.4 v0.5.1
|
- 2024.6.4 v0.5.1
|
||||||
@@ -43,15 +56,17 @@ https://github.com/bigfa/hugo-theme-farallon
|
|||||||
|
|
||||||
|
|
||||||
### 豆瓣观影
|
### 豆瓣观影
|
||||||
|
|
||||||
使用原版的获取方式
|
|
||||||
|
|
||||||
>豆瓣收藏使用方法
|
|
||||||
微信扫码登录https://node.wpista.com/
|
|
||||||
输入你的豆瓣数字 id,点击保存即可自动同步豆瓣记录。
|
|
||||||
点击 Get integration token 会生成一个 token。
|
|
||||||
|
|
||||||
获取`token`之后填入主题设置项中
|
更新 获取方式
|
||||||
|
|
||||||
|
~~使用原版的获取方式~~
|
||||||
|
|
||||||
|
~~豆瓣收藏使用方法~~
|
||||||
|
~~微信扫码登录https://node.wpista.com/~~
|
||||||
|
~~输入你的豆瓣数字 id,点击保存即可自动同步豆瓣记录。~~
|
||||||
|
~~点击 Get integration token 会生成一个 token。~~
|
||||||
|
|
||||||
|
~~获取`token`之后填入主题设置项中~~
|
||||||
|
|
||||||
### 友情链接
|
### 友情链接
|
||||||
|
|
||||||
@@ -66,8 +81,11 @@ https://github.com/bigfa/hugo-theme-farallon
|
|||||||
### 说说 by Memos
|
### 说说 by Memos
|
||||||
|
|
||||||
使用自定义字段设置memos
|
使用自定义字段设置memos
|
||||||
|
|
||||||
在自定义字段中填入`memos`值为memos地址,不带`/`
|
在自定义字段中填入`memos`值为memos地址,不带`/`
|
||||||
|
|
||||||
在自定义字段中填入`memosID`默认值为`1`,不为`1`时才需要设置
|
在自定义字段中填入`memosID`默认值为`1`,不为`1`时才需要设置
|
||||||
|
|
||||||
在自定义字段中填入`memosnum`默认值为`20`,默认获取20条最近的memo
|
在自定义字段中填入`memosnum`默认值为`20`,默认获取20条最近的memo
|
||||||
|
|
||||||
### 说说 by Mastodon
|
### 说说 by Mastodon
|
||||||
@@ -77,6 +95,10 @@ https://github.com/bigfa/hugo-theme-farallon
|
|||||||
|
|
||||||
在自定义字段中填入`tooot`值为Mastodon API 地址
|
在自定义字段中填入`tooot`值为Mastodon API 地址
|
||||||
|
|
||||||
|
### 好物 by memos
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 预览地址
|
## 预览地址
|
||||||
|
|
||||||
https://www.imsun.org
|
https://www.imsun.org
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@
|
|||||||
d="M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z">
|
d="M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z">
|
||||||
</path>
|
</path>
|
||||||
</g>
|
</g>
|
||||||
</svg><a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论', '1 评论', '%d 评论'); ?></a>
|
</svg><a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0 ', '1 ', '%d '); ?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
+23
-25
@@ -55,30 +55,6 @@
|
|||||||
</svg><?php $this->commentsNum(_t('0'), _t('1'), _t('%d')); ?>
|
</svg><?php $this->commentsNum(_t('0'), _t('1'), _t('%d')); ?>
|
||||||
</h3>
|
</h3>
|
||||||
<ol class="commentlist sulliComment--list"></ol>
|
<ol class="commentlist sulliComment--list"></ol>
|
||||||
<?php if ($comments->have()): ?>
|
|
||||||
<?php $comments->listComments(); ?>
|
|
||||||
<?php
|
|
||||||
$comments->pageNav(
|
|
||||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z" fill="var(--main)"></path></svg>',
|
|
||||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.1714 12.0007L8.22168 7.05093L9.63589 5.63672L15.9999 12.0007L9.63589 18.3646L8.22168 16.9504L13.1714 12.0007Z" fill="var(--main)"></path></svg>',
|
|
||||||
1,
|
|
||||||
'...',
|
|
||||||
array(
|
|
||||||
'wrapTag' => 'div',
|
|
||||||
'wrapClass' => 'pagination_page',
|
|
||||||
'itemTag' => '',
|
|
||||||
'textTag' => 'a',
|
|
||||||
'currentClass' => 'active',
|
|
||||||
'prevClass' => 'prev',
|
|
||||||
'nextClass' => 'next'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
<?php else: ?>
|
|
||||||
|
|
||||||
<center><h3><?php _e('暂无评论'); ?></h3></center>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
<div id="<?php $this->respondId(); ?>" class="comment-respond">
|
<div id="<?php $this->respondId(); ?>" class="comment-respond">
|
||||||
<div class="cancel-comment-reply cancel-comment-reply-link"><?php $comments->cancelReply(); ?></div>
|
<div class="cancel-comment-reply cancel-comment-reply-link"><?php $comments->cancelReply(); ?></div>
|
||||||
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form" class="comment-form">
|
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form" class="comment-form">
|
||||||
@@ -112,6 +88,29 @@
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php _e(''); ?>
|
<?php _e(''); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($comments->have()): ?>
|
||||||
|
<?php $comments->listComments(); ?>
|
||||||
|
<?php
|
||||||
|
$comments->pageNav(
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z" fill="var(--main)"></path></svg>',
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.1714 12.0007L8.22168 7.05093L9.63589 5.63672L15.9999 12.0007L9.63589 18.3646L8.22168 16.9504L13.1714 12.0007Z" fill="var(--main)"></path></svg>',
|
||||||
|
1,
|
||||||
|
'...',
|
||||||
|
array(
|
||||||
|
'wrapTag' => 'div',
|
||||||
|
'wrapClass' => 'pagination_page',
|
||||||
|
'itemTag' => '',
|
||||||
|
'textTag' => 'a',
|
||||||
|
'currentClass' => 'active',
|
||||||
|
'prevClass' => 'prev',
|
||||||
|
'nextClass' => 'next'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<?php else: ?>
|
||||||
|
<center><h3><?php _e('暂无评论'); ?></h3></center>
|
||||||
|
<?php endif; ?>
|
||||||
<?php $this->options->twikoo(); ?>
|
<?php $this->options->twikoo(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -142,7 +141,6 @@ function threadedComments($comments, $options) {
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $comments->gravatar('40', ''); ?>
|
<?php echo $comments->gravatar('40', ''); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="comment--meta">
|
<div class="comment--meta">
|
||||||
<div class="comment--author"><?php echo $comments->author; ?><span class="dot"></span>
|
<div class="comment--author"><?php echo $comments->author; ?><span class="dot"></span>
|
||||||
|
|||||||
Vendored
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
is_single = false;
|
is_single = false;
|
||||||
post_id = 0;
|
post_id = 0;
|
||||||
is_archive = false;
|
is_archive = false;
|
||||||
VERSION = "0.5.0";
|
VERSION = "0.5.4";
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.initCopyright();
|
this.initCopyright();
|
||||||
|
|||||||
Vendored
+350
@@ -0,0 +1,350 @@
|
|||||||
|
class Douban {
|
||||||
|
constructor(config) {
|
||||||
|
this.container = config.container;
|
||||||
|
this.types = config.types ?? [
|
||||||
|
"movie",
|
||||||
|
"book",
|
||||||
|
"music",
|
||||||
|
"game",
|
||||||
|
"drama",
|
||||||
|
];
|
||||||
|
this.baseAPI = config.baseAPI;
|
||||||
|
this.ver = "1.0.6";
|
||||||
|
this.type = "movie";
|
||||||
|
this.status = "done";
|
||||||
|
this.finished = false;
|
||||||
|
this.paged = 1;
|
||||||
|
this.genre_list = [
|
||||||
|
{
|
||||||
|
name: "已看",
|
||||||
|
value: "done",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "在看",
|
||||||
|
value: "doing",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "想看",
|
||||||
|
value: "mark",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
this.subjects = [];
|
||||||
|
this._create();
|
||||||
|
}
|
||||||
|
|
||||||
|
on(event, element, callback) {
|
||||||
|
const nodeList = document.querySelectorAll(element);
|
||||||
|
nodeList.forEach((item) => {
|
||||||
|
item.addEventListener(event, callback);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleGenreClick() {
|
||||||
|
this.on("click", ".db--genreItem", (t) => {
|
||||||
|
const self = t.currentTarget;
|
||||||
|
if (self.classList.contains("is-active")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
document.querySelector(".db--list").innerHTML = "";
|
||||||
|
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
||||||
|
|
||||||
|
this.status = self.dataset.status || ""; // Provide a default value of an empty string if self.dataset.status is undefined
|
||||||
|
this._renderGenre();
|
||||||
|
this.paged = 1;
|
||||||
|
this.finished = false;
|
||||||
|
this.subjects = [];
|
||||||
|
this._fetchData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_reanderTypes() {
|
||||||
|
document.querySelector(".db--nav").innerHTML = this.types
|
||||||
|
.map((item) => {
|
||||||
|
return `<span class="db--navItem JiEun${
|
||||||
|
this.type == item ? " current" : ""
|
||||||
|
}" data-type="${item}">${item}</span>`;
|
||||||
|
})
|
||||||
|
.join("");
|
||||||
|
this._handleNavClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderGenre() {
|
||||||
|
document.querySelector(".db--genres").innerHTML = this.genre_list
|
||||||
|
.map((item) => {
|
||||||
|
return `<span class="db--genreItem${
|
||||||
|
this.status == item.value ? " is-active" : ""
|
||||||
|
}" data-status="${item.value}">${item.name}</span>`;
|
||||||
|
})
|
||||||
|
.join("");
|
||||||
|
this._handleGenreClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
_fetchData() {
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
paged: this.paged.toString(),
|
||||||
|
type: this.type,
|
||||||
|
status: this.status,
|
||||||
|
});
|
||||||
|
fetch(this.baseAPI + "list?" + params.toString())
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((t) => {
|
||||||
|
console.log(t.results);
|
||||||
|
if (t.results.length) {
|
||||||
|
if (
|
||||||
|
document
|
||||||
|
.querySelector(".db--list")
|
||||||
|
.classList.contains("db--list__card")
|
||||||
|
) {
|
||||||
|
this.subjects = [...this.subjects, ...t.results];
|
||||||
|
this._randerDateTemplate();
|
||||||
|
} else {
|
||||||
|
this.subjects = [...this.subjects, ...t.results];
|
||||||
|
this._randerListTemplate();
|
||||||
|
}
|
||||||
|
document
|
||||||
|
.querySelector(".lds-ripple")
|
||||||
|
.classList.add("u-hide");
|
||||||
|
} else {
|
||||||
|
this.finished = true;
|
||||||
|
document
|
||||||
|
.querySelector(".lds-ripple")
|
||||||
|
.classList.add("u-hide");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_randerDateTemplate() {
|
||||||
|
const result = this.subjects.reduce((result, item) => {
|
||||||
|
const date = new Date(item.create_time);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = date.getMonth() + 1;
|
||||||
|
const key = `${year}-${month.toString().padStart(2, "0")}`;
|
||||||
|
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
||||||
|
result[key].push(item);
|
||||||
|
} else {
|
||||||
|
result[key] = [item];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
let html = ``;
|
||||||
|
for (let key in result) {
|
||||||
|
const date = key.split("-");
|
||||||
|
html += `<div class="db--listBydate"><div class="db--titleDate"><div class="db--titleDate__day">${date[1]}</div><div class="db--titleDate__month">${date[0]}</div></div><div class="db--dateList__card">`;
|
||||||
|
html += result[key]
|
||||||
|
.map((movie) => {
|
||||||
|
return `<div class="db--item${
|
||||||
|
this.type == "music" ? " db--item__music" : ""
|
||||||
|
}"><img src="${
|
||||||
|
movie.poster
|
||||||
|
}" referrerpolicy="no-referrer" class="db--image"><div class="db--score ">${
|
||||||
|
movie.douban_score > 0
|
||||||
|
? '<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" ><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>' +
|
||||||
|
movie.douban_score
|
||||||
|
: ""
|
||||||
|
}${
|
||||||
|
movie.year > 0 ? " · " + movie.year : ""
|
||||||
|
}</div><div class="db--title"><a href="${
|
||||||
|
movie.link
|
||||||
|
}" target="_blank">${movie.name}</a></div></div>`;
|
||||||
|
})
|
||||||
|
.join("");
|
||||||
|
html += `</div></div>`;
|
||||||
|
}
|
||||||
|
document.querySelector(".db--list").innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
_randerListTemplate() {
|
||||||
|
document.querySelector(".db--list").innerHTML = this.subjects
|
||||||
|
.map((item) => {
|
||||||
|
return `<div class="db--item"><img src="${
|
||||||
|
item.poster
|
||||||
|
}" referrerpolicy="no-referrer" class="db--image"><div class="ipc-signpost ">${
|
||||||
|
item.create_time
|
||||||
|
}</div><div class="db--score ">${
|
||||||
|
item.douban_score
|
||||||
|
? '<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" ><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>' +
|
||||||
|
item.douban_score
|
||||||
|
: ""
|
||||||
|
}${
|
||||||
|
item.year ? " · " + item.year : ""
|
||||||
|
}</div><div class="db--title"><a href="${
|
||||||
|
item.link
|
||||||
|
}" target="_blank">${item.name}</a></div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
})
|
||||||
|
.join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleScroll() {
|
||||||
|
window.addEventListener("scroll", () => {
|
||||||
|
var t = window.scrollY || window.pageYOffset;
|
||||||
|
const moreElement = document.querySelector(
|
||||||
|
".block-more"
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
moreElement.offsetTop + -window.innerHeight < t &&
|
||||||
|
document
|
||||||
|
.querySelector(".lds-ripple")
|
||||||
|
.classList.contains("u-hide") &&
|
||||||
|
!this.finished
|
||||||
|
) {
|
||||||
|
document
|
||||||
|
.querySelector(".lds-ripple")
|
||||||
|
.classList.remove("u-hide");
|
||||||
|
this.paged++;
|
||||||
|
this._fetchData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleNavClick() {
|
||||||
|
this.on("click", ".db--navItem", (t) => {
|
||||||
|
const self = t.currentTarget;
|
||||||
|
if (self.classList.contains("current")) return;
|
||||||
|
this.status = "done";
|
||||||
|
this.type = self.dataset.type;
|
||||||
|
this._renderGenre();
|
||||||
|
document.querySelector(".db--list").innerHTML = "";
|
||||||
|
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
||||||
|
document
|
||||||
|
.querySelector(".db--navItem.current")
|
||||||
|
.classList .remove("current");
|
||||||
|
self.classList.add("current");
|
||||||
|
this.paged = 1;
|
||||||
|
this.finished = false;
|
||||||
|
this.subjects = [];
|
||||||
|
this._fetchData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_create() {
|
||||||
|
if (document.querySelector(".db--container")) {
|
||||||
|
const container = document.querySelector(
|
||||||
|
this.container
|
||||||
|
);
|
||||||
|
if (!container) return;
|
||||||
|
container.innerHTML = `<nav class="db--nav">
|
||||||
|
</nav>
|
||||||
|
<div class="db--genres">
|
||||||
|
</div>
|
||||||
|
<div class="db--list db--list__card">
|
||||||
|
</div>
|
||||||
|
<div class="block-more block-more__centered">
|
||||||
|
<div class="lds-ripple">
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
this._renderGenre();
|
||||||
|
this._reanderTypes();
|
||||||
|
this._fetchData();
|
||||||
|
this._handleScroll();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.querySelector(".js-db")) {
|
||||||
|
document.querySelectorAll(".js-db").forEach((item) => {
|
||||||
|
const db = item;
|
||||||
|
const id = db.dataset.id;
|
||||||
|
const type = db.dataset.type;
|
||||||
|
const nodeParent = db.parentNode;
|
||||||
|
fetch(this.baseAPI + `${type}/${id}`).then((response) => {
|
||||||
|
response.json().then((t) => {
|
||||||
|
if (t.data) {
|
||||||
|
const data = t.data;
|
||||||
|
const node = document.createElement("div");
|
||||||
|
node.classList.add("doulist-item");
|
||||||
|
node.innerHTML = `<div class="doulist-subject">
|
||||||
|
<div class="doulist-post"><img decoding="async" referrerpolicy="no-referrer" src="${data.poster}"></div>
|
||||||
|
<div class="doulist-content">
|
||||||
|
<div class="doulist-title"><a href="${data.link}" class="cute" target="_blank" rel="external nofollow">${data.name}</a></div>
|
||||||
|
<div class="rating"><span class="allstardark"><span class="allstarlight" style="width:55%"></span></span><span class="rating_nums"> ${data.douban_score} </span></div>
|
||||||
|
<div class="abstract">${data.card_subtitle}</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
nodeParent.replaceWith(node);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.querySelector(".db--collection")) {
|
||||||
|
document
|
||||||
|
.querySelectorAll(".db--collection")
|
||||||
|
.forEach((item) => {
|
||||||
|
this._fetchCollection(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_fetchCollection(item) {
|
||||||
|
const type = item.dataset.style ? item.dataset.style : "card";
|
||||||
|
fetch(
|
||||||
|
this.baseAPI +
|
||||||
|
"/list?type=" +
|
||||||
|
item.dataset.type +
|
||||||
|
"&paged=1&start_time=" +
|
||||||
|
item.dataset.start +
|
||||||
|
"&end_time=" +
|
||||||
|
item.dataset.end
|
||||||
|
)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((t) => {
|
||||||
|
if (t.length) {
|
||||||
|
if (type == "card") {
|
||||||
|
item.innerHTML += t
|
||||||
|
.map((movie) => {
|
||||||
|
return `<div class="doulist-item">
|
||||||
|
<div class="doulist-subject">
|
||||||
|
<div class="db--viewTime ">Marked ${movie.create_time}</div>
|
||||||
|
<div class="doulist-post"><img referrerpolicy="no-referrer" src="${movie.poster}"></div><div class="doulist-content"><div class="doulist-title"><a href="${movie.link}" class="cute" target="_blank" rel="external nofollow">${movie.name}</a></div><div class="rating"><span class="allstardark"><span class="allstarlight" style="width:75%"></span></span><span class="rating_nums">${movie.douban_score}</span></div><div class="abstract">${movie.card_subtitle}</div></div></div></div>`;
|
||||||
|
})
|
||||||
|
.join("");
|
||||||
|
} else {
|
||||||
|
const result = t.reduce(
|
||||||
|
(result, item) => {
|
||||||
|
if (
|
||||||
|
Object.prototype.hasOwnProperty.call(
|
||||||
|
result,
|
||||||
|
item.create_time
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
result[item.create_time].push(item);
|
||||||
|
} else {
|
||||||
|
result[item.create_time] = [item];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
let html = ``;
|
||||||
|
for (let key in result) {
|
||||||
|
html += `<div class="db--date">${key}</div><div class="db--dateList">`;
|
||||||
|
html += result[key]
|
||||||
|
.map((movie) => {
|
||||||
|
return `<div class="db--card__list">
|
||||||
|
<img referrerpolicy="no-referrer" src="${
|
||||||
|
movie.poster
|
||||||
|
}">
|
||||||
|
<div>
|
||||||
|
<div class="title"><a href="${
|
||||||
|
movie.link
|
||||||
|
}" class="cute" target="_blank" rel="external nofollow">${
|
||||||
|
movie.name
|
||||||
|
}</a></div>
|
||||||
|
<div class="rating"><span class="allstardark"><span class="allstarlight" style="width:75%"></span></span><span class="rating_nums">${
|
||||||
|
movie.douban_score
|
||||||
|
}</span></div>
|
||||||
|
${movie.remark || movie.card_subtitle}
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
})
|
||||||
|
.join("");
|
||||||
|
html += `</div>`;
|
||||||
|
}
|
||||||
|
item.innerHTML = html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -27,7 +27,7 @@ function themeConfig($form) {
|
|||||||
$form->addInput($cnavatar);
|
$form->addInput($cnavatar);
|
||||||
$donate = new Typecho_Widget_Helper_Form_Element_Text('donate', NULL, 'https://blogcdn.loliko.cn/donate/wx.png', _t('赞赏二维码'), _t('不填写则不显示'));
|
$donate = new Typecho_Widget_Helper_Form_Element_Text('donate', NULL, 'https://blogcdn.loliko.cn/donate/wx.png', _t('赞赏二维码'), _t('不填写则不显示'));
|
||||||
$form->addInput($donate);
|
$form->addInput($donate);
|
||||||
$doubanID = new Typecho_Widget_Helper_Form_Element_Text('doubanID', NULL, '322dba2a3a27524b97c06d941d9631d153fc', _t('豆瓣页面必需Token'), _t('从<a href="https://node.wpista.com/" target="_blank">https://node.wpista.com/</a>获得token'));
|
$doubanID = new Typecho_Widget_Helper_Form_Element_Text('doubanID', NULL, 'https://db.imsun.org/', _t('豆瓣页面必需API,包含"/"'), _t(' '));
|
||||||
$form->addInput($doubanID);
|
$form->addInput($doubanID);
|
||||||
$twikoo = new Typecho_Widget_Helper_Form_Element_Textarea('twikoo', NULL, NULL, _t('引用第三方评论'), _t('不填写则不显示'));
|
$twikoo = new Typecho_Widget_Helper_Form_Element_Textarea('twikoo', NULL, NULL, _t('引用第三方评论'), _t('不填写则不显示'));
|
||||||
$form->addInput($twikoo);
|
$form->addInput($twikoo);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* 移植自HUGO主题 farallon 原作者 bigfa
|
* 移植自HUGO主题 farallon 原作者 bigfa
|
||||||
* @package farallon
|
* @package farallon
|
||||||
* @author 老孙
|
* @author 老孙
|
||||||
* @version 0.5.1
|
* @version 0.5.4
|
||||||
* @link https://imsun.org
|
* @link https://imsun.org
|
||||||
*/
|
*/
|
||||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||||
|
|||||||
+8
-321
@@ -6,333 +6,20 @@
|
|||||||
*/
|
*/
|
||||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<?php $this->need('header.php'); ?>
|
<?php $this->need('header.php'); ?>
|
||||||
|
<script src="<?php $this->options->themeUrl('/dist/js/db.js'); ?>"></script>
|
||||||
<section class="site--main">
|
<section class="site--main">
|
||||||
<header class="archive--header">
|
<header class="archive--header">
|
||||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
<h2 class="post--single__subtitle">数据来源于豆瓣</h2>
|
<h2 class="post--single__subtitle">数据来源于豆瓣</h2>
|
||||||
</header>
|
</header>
|
||||||
<div class="site--main">
|
<div class="site--main">
|
||||||
<div class="db--container" data-token="<?php $this->options->doubanID() ?>">
|
<div class="db--container"></div>
|
||||||
<nav class="db--nav">
|
<script>
|
||||||
<div class="db--navItem JiEun current" data-type="movie">Movie</div>
|
new Douban({
|
||||||
<div class="db--navItem JiEun" data-type="book">Book</div>
|
baseAPI: '<?php $this->options->doubanID() ?>', // api
|
||||||
<div class="db--navItem JiEun" data-type="music">Music</div>
|
container: ".db--container", // 容器名
|
||||||
</nav>
|
});
|
||||||
<div class="db--genres">
|
</script>
|
||||||
</div>
|
|
||||||
<div class="db--list db--list__card">
|
|
||||||
</div>
|
|
||||||
<div class="block-more block-more__centered">
|
|
||||||
<div class="lds-ripple">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
class APIHandler {
|
|
||||||
constructor(token) {
|
|
||||||
this.ver = "1.0.1";
|
|
||||||
this.type = "movie";
|
|
||||||
this.finished = false;
|
|
||||||
this.paged = 1;
|
|
||||||
this.genre_list = [];
|
|
||||||
this.genre = [];
|
|
||||||
this.subjects = [];
|
|
||||||
this.baseAPI = "https://node.wpista.com/v1/outer/";
|
|
||||||
this.token = token;
|
|
||||||
this._create();
|
|
||||||
}
|
|
||||||
on(event, selector, handler) {
|
|
||||||
const elements = document.querySelectorAll(selector);
|
|
||||||
elements.forEach(element => {
|
|
||||||
element.addEventListener(event, handler);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_fetchGenres() {
|
|
||||||
document.querySelector(".db--genres").innerHTML = "";
|
|
||||||
fetch(`${this.baseAPI}genres?token=${this.token}&type=${this.type}`)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.data.length) {
|
|
||||||
this.genre_list = data.data;
|
|
||||||
this._renderGenre();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_handleGenreClick() {
|
|
||||||
this.on("click", ".db--genreItem", event => {
|
|
||||||
const target = event.currentTarget;
|
|
||||||
if (target.classList.contains("is-active")) {
|
|
||||||
const index = this.genre.indexOf(target.innerText);
|
|
||||||
target.classList.remove("is-active");
|
|
||||||
this.genre.splice(index, 1);
|
|
||||||
this.paged = 1;
|
|
||||||
this.finished = false;
|
|
||||||
this.subjects = [];
|
|
||||||
this._fetchData();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
document.querySelector(".db--list").innerHTML = "";
|
|
||||||
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
|
||||||
target.classList.add("is-active");
|
|
||||||
this.genre.push(target.innerText);
|
|
||||||
this.paged = 1;
|
|
||||||
this.finished = false;
|
|
||||||
this.subjects = [];
|
|
||||||
this._fetchData();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_renderGenre() {
|
|
||||||
document.querySelector(".db--genres").innerHTML = this.genre_list.map(genre =>
|
|
||||||
`<span class="db--genreItem${this.genre.includes(genre.name) ? " is-active" : ""}">${genre.name}</span>`
|
|
||||||
).join("");
|
|
||||||
this._handleGenreClick();
|
|
||||||
}
|
|
||||||
_fetchData() {
|
|
||||||
fetch(`${this.baseAPI}faves?token=${this.token}&type=${this.type}&paged=${this.paged}&genre=${JSON.stringify(this.genre)}`)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.data.length) {
|
|
||||||
if (document.querySelector(".db--list").classList.contains("db--list__card"))
|
|
||||||
{
|
|
||||||
this.subjects = [...this.subjects, ...data.data];
|
|
||||||
this._randerDateTemplate();
|
|
||||||
} else {
|
|
||||||
this.subjects = [...this.subjects, ...data.data];
|
|
||||||
this._randerListTemplate();
|
|
||||||
}
|
|
||||||
document
|
|
||||||
.querySelector(".lds-ripple").classList.add("u-hide");
|
|
||||||
} else {
|
|
||||||
this.finished = true;
|
|
||||||
document.querySelector(".lds-ripple").classList.add("u-hide");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_randerDateTemplate() {
|
|
||||||
const result = this.subjects.reduce((result, item) => {
|
|
||||||
const date = new Date(item.create_time);
|
|
||||||
const year = date.getFullYear();
|
|
||||||
const month = date.getMonth() + 1;
|
|
||||||
const key = `${year}-${month.toString().padStart(2, "0")}`;
|
|
||||||
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
||||||
result[key].push(item);
|
|
||||||
} else {
|
|
||||||
result[key] = [item];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}, {});
|
|
||||||
let html = ``;
|
|
||||||
for (let key in result) {
|
|
||||||
const date = key.split("-");
|
|
||||||
html += `<div class="db--listBydate"><div class="db--titleDate "><div class="db--titleDate__day">${date[1]}</div><div class="db--titleDate__month">${date[0]}</div></div><div class="db--dateList__card">`;
|
|
||||||
html += result[key]
|
|
||||||
.map(subject => {
|
|
||||||
return `<div class="db--item">${
|
|
||||||
subject.is_top250
|
|
||||||
? '<span class="top250">Top 250</span>'
|
|
||||||
: ""
|
|
||||||
}<img src="${
|
|
||||||
subject.poster
|
|
||||||
}" referrerpolicy="no-referrer" class="db--image"><div class="db--score ">${
|
|
||||||
subject.douban_score > 0
|
|
||||||
? '<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" ><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>' +
|
|
||||||
subject.douban_score
|
|
||||||
: ""
|
|
||||||
}${
|
|
||||||
subject.year > 0 ? " · " + subject.year : ""
|
|
||||||
}</div><div class="db--title"><a href="${
|
|
||||||
subject.link
|
|
||||||
}" target="_blank">${subject.name}</a></div></div>`;
|
|
||||||
})
|
|
||||||
.join("");
|
|
||||||
html += `</div></div>`;
|
|
||||||
}
|
|
||||||
document.querySelector(".db--list").innerHTML = html;
|
|
||||||
}
|
|
||||||
_renderListTemplate() {
|
|
||||||
document.querySelector(".db--list").innerHTML = this.subjects.map(subject =>
|
|
||||||
`<div class="db--item">
|
|
||||||
${subject.is_top250 ? '<span class="top250">Top 250</span>' : ""}
|
|
||||||
<img src="${subject.poster}" referrerpolicy="no-referrer" class="db--image">
|
|
||||||
<div class="ipc-signpost">${subject.create_time}</div>
|
|
||||||
<div class="db--score">${subject.douban_score > 0 ?
|
|
||||||
`<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
|
|
||||||
<path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path>
|
|
||||||
</svg>` + subject.douban_score : ""}
|
|
||||||
${subject.year > 0 ? " · " + subject.year : ""}
|
|
||||||
</div>
|
|
||||||
<div class="db--title"><a href="${subject.link}" target="_blank">${subject.name}</a></div>
|
|
||||||
</div>`
|
|
||||||
).join("");
|
|
||||||
}
|
|
||||||
_handleScroll() {
|
|
||||||
window.addEventListener("scroll", () => {
|
|
||||||
const scrollY = window.scrollY || window.pageYOffset;
|
|
||||||
const blockMoreOffsetTop = document.querySelector(".block-more").offsetTop;
|
|
||||||
if (blockMoreOffsetTop - window.innerHeight < scrollY && document.querySelector(".lds-ripple").classList.contains("u-hide") && !this.finished) {
|
|
||||||
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
|
||||||
this.paged++;
|
|
||||||
this._fetchData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_handleNavClick() {
|
|
||||||
this.on("click", ".db--navItem", event => {
|
|
||||||
if (event.currentTarget.classList.contains("current")) return;
|
|
||||||
this.genre = [];
|
|
||||||
this.type = event.currentTarget.dataset.type;
|
|
||||||
if (this.type != "book") {
|
|
||||||
this._fetchGenres();
|
|
||||||
document.querySelector(".db--genres").classList.remove("u-hide");
|
|
||||||
} else {
|
|
||||||
document.querySelector(".db--genres").classList.add("u-hide");
|
|
||||||
}
|
|
||||||
document.querySelector(".db--list").innerHTML = "";
|
|
||||||
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
|
||||||
document.querySelector(".db--navItem.current").classList.remove("current");
|
|
||||||
event.target.classList.add("current");
|
|
||||||
this.paged = 1;
|
|
||||||
this.finished = false;
|
|
||||||
this.subjects = [];
|
|
||||||
this._fetchData();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_create() {
|
|
||||||
if (document.querySelector(".db--container")) {
|
|
||||||
const container = document.querySelector(".db--container");
|
|
||||||
if (container.dataset.token) {
|
|
||||||
this.token = container.dataset.token;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const currentNavItem = document.querySelector(".db--navItem.current");
|
|
||||||
if (currentNavItem instanceof HTMLElement) {
|
|
||||||
this.type = currentNavItem.dataset.type;
|
|
||||||
}
|
|
||||||
const list = document.querySelector(".db--list");
|
|
||||||
if (list.dataset.type) {
|
|
||||||
this.type = list.dataset.type;
|
|
||||||
}
|
|
||||||
if (this.type == "movie") {
|
|
||||||
document.querySelector(".db--genres").classList.remove("u-hide");
|
|
||||||
}
|
|
||||||
this._fetchGenres();
|
|
||||||
this._fetchData();
|
|
||||||
this._handleScroll();
|
|
||||||
this._handleNavClick();
|
|
||||||
}
|
|
||||||
if (document.querySelector(".js-db")) {
|
|
||||||
document.querySelectorAll(".js-db").forEach(element => {
|
|
||||||
const id = element.dataset.id;
|
|
||||||
const type = element.dataset.type;
|
|
||||||
const parentNode = element.parentNode;
|
|
||||||
fetch(`${this.baseAPI}${type}/${id}?token=${this.token}`)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.data) {
|
|
||||||
const itemData = data.data;
|
|
||||||
const div = document.createElement("div");
|
|
||||||
div.classList.add("doulist-item");
|
|
||||||
div.innerHTML = `
|
|
||||||
<div class="doulist-subject">
|
|
||||||
<div class="doulist-post">
|
|
||||||
<img decoding="async" referrerpolicy="no-referrer" src="${itemData.poster}">
|
|
||||||
</div>
|
|
||||||
<div class="doulist-content">
|
|
||||||
<div class="doulist-title">
|
|
||||||
<a href="${itemData.link}" class="cute" target="_blank" rel="external nofollow">${itemData.name}</a>
|
|
||||||
</div>
|
|
||||||
<div class="rating">
|
|
||||||
<span class="allstardark">
|
|
||||||
<span class="allstarlight" style="width:55%"></span>
|
|
||||||
</span>
|
|
||||||
<span class="rating_nums"> ${itemData.douban_score} </span>
|
|
||||||
</div>
|
|
||||||
<div class="abstract">${itemData.card_subtitle}</div>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
parentNode.replaceWith(div);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (document.querySelector(".db--collection")) {
|
|
||||||
document.querySelectorAll(".db--collection").forEach(collection => {
|
|
||||||
this._fetchCollection(collection);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fetchCollection(collection) {
|
|
||||||
const style = collection.dataset.style ? collection.dataset.style : "card";
|
|
||||||
fetch(`${this.baseAPI}v1/movies?type=${collection.dataset.type}&paged=1&genre=&start_time=${collection.dataset.start}&end_time=${collection.dataset.end}`)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.length) {
|
|
||||||
if (style === "card") {
|
|
||||||
collection.innerHTML += data.map(item => `
|
|
||||||
<div class="doulist-item">
|
|
||||||
<div class="doulist-subject">
|
|
||||||
<div class="db--viewTime">Marked ${item.create_time}</div>
|
|
||||||
<div class="doulist-post">
|
|
||||||
<img referrerpolicy="no-referrer" src="${item.poster}">
|
|
||||||
</div>
|
|
||||||
<div class="doulist-content">
|
|
||||||
<div class="doulist-title">
|
|
||||||
<a href="${item.link}" class="cute" target="_blank" rel="external nofollow">${item.name}</a>
|
|
||||||
</div>
|
|
||||||
<div class="rating">
|
|
||||||
<span class="allstardark">
|
|
||||||
<span class="allstarlight" style="width:75%"></span>
|
|
||||||
</span>
|
|
||||||
<span class="rating_nums">${item.douban_score}</span>
|
|
||||||
</div>
|
|
||||||
<div class="abstract">${item.remark || item.card_subtitle}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>`).join("");
|
|
||||||
} else {
|
|
||||||
const groupedData = data.reduce((acc, item) => {
|
|
||||||
if (acc[item.create_time]) {
|
|
||||||
acc[item.create_time].push(item);
|
|
||||||
} else {
|
|
||||||
acc[item.create_time] = [item];
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
let html = "";
|
|
||||||
for (const date in groupedData) {
|
|
||||||
html += `<div class="db--date">${date}</div><div class="db--dateList">`;
|
|
||||||
html += groupedData[date].map(item => `
|
|
||||||
<div class="db--card__list">
|
|
||||||
<img referrerpolicy="no-referrer" src="${item.poster}">
|
|
||||||
<div>
|
|
||||||
<div class="title">
|
|
||||||
<a href="${item.link}" class="cute" target="_blank" rel="external nofollow">${item.name}</a>
|
|
||||||
</div>
|
|
||||||
<div class="rating">
|
|
||||||
<span class="allstardark">
|
|
||||||
<span class="allstarlight" style="width:75%"></span>
|
|
||||||
</span>
|
|
||||||
<span class="rating_nums">${item.douban_score}</span>
|
|
||||||
</div>
|
|
||||||
${item.remark || item.card_subtitle}
|
|
||||||
</div>
|
|
||||||
</div>`).join("");
|
|
||||||
html += "</div>";
|
|
||||||
}
|
|
||||||
collection.innerHTML = html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 在页面加载完成后实例化APIHandler类
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
|
||||||
const token = "<?php $this->options->doubanID() ?>"; // 替换为你的API令牌
|
|
||||||
new APIHandler(token);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</section>
|
</section>
|
||||||
<?php $this->need('footer.php'); ?>
|
<?php $this->need('footer.php'); ?>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* 说说页面 - 时光机
|
||||||
|
*
|
||||||
|
* @package custom
|
||||||
|
*/
|
||||||
|
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
|
<?php $this->need('header.php'); ?>
|
||||||
|
<section class="site--main">
|
||||||
|
<header class="archive--header">
|
||||||
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
|
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||||
|
</header>
|
||||||
|
<article class="post--single">
|
||||||
|
<?php $this->need('times/dycomment.php'); ?>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
<?php $this->need('footer.php'); ?>
|
||||||
@@ -26,13 +26,12 @@
|
|||||||
d="M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z">
|
d="M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z">
|
||||||
</path>
|
</path>
|
||||||
</g>
|
</g>
|
||||||
</svg> <a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0', '1', '%d '); ?></a>
|
</svg> <a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0 ', '1 ', '%d '); ?></a>
|
||||||
<?php if($this->user->hasLogin() && $this->user->pass('editor', true)): ?>
|
<?php if($this->user->hasLogin() && $this->user->pass('editor', true)): ?>
|
||||||
<a href="<?php $this->options->adminUrl('write-post.php?cid=' . $this->cid); ?>" target="_blank" title="编辑文章">
|
|
||||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16">
|
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16">
|
||||||
<path
|
<path
|
||||||
d="M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z"/>
|
d="M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z"/>
|
||||||
</svg></a>
|
</svg><a href="<?php $this->options->adminUrl('write-post.php?cid=' . $this->cid); ?>" target="_blank" title="编辑文章">Edit</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="post--single__title"><?php $this->title() ?></h2>
|
<h2 class="post--single__title"><?php $this->title() ?></h2>
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@
|
|||||||
</path>
|
</path>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
<a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论', '1 评论', '%d 评论'); ?></a>
|
<a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0 ', '1 ', '%d '); ?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||||
|
class Content
|
||||||
|
{
|
||||||
|
public static function postCommentContent($content, $isLogin, $rememberEmail, $currentEmail, $parentEmail, $isTime = false)
|
||||||
|
{
|
||||||
|
//解析私密评论
|
||||||
|
$flag = true;
|
||||||
|
if (strpos($content, '[secret]') !== false) {//提高效率,避免每篇文章都要解析
|
||||||
|
$pattern = self::get_shortcode_regex(array('secret'));
|
||||||
|
$content = preg_replace_callback("/$pattern/", array('Content', 'secretContentParseCallback'), $content);
|
||||||
|
if ($isLogin || ($currentEmail == $rememberEmail && $currentEmail != "") || ($parentEmail == $rememberEmail && $rememberEmail != "")) {
|
||||||
|
$flag = true;
|
||||||
|
} else {
|
||||||
|
$flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($flag) {
|
||||||
|
$content = Content::parseContentPublic($content);
|
||||||
|
return $content;
|
||||||
|
} else {
|
||||||
|
if ($isTime) {
|
||||||
|
return '<div class="hideContent">此条为私密说说,仅发布者可见</div>';
|
||||||
|
} else {
|
||||||
|
return '<div class="hideContent">该评论仅登录用户及评论双方可见</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 解析时光机页面的评论内容
|
||||||
|
* @param $content
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function timeMachineCommentContent($content)
|
||||||
|
{
|
||||||
|
return Content::parseContentPublic($content);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 一些公用的解析,文章、评论、时光机公用的,与用户状态无关
|
||||||
|
* @param $content
|
||||||
|
* @return null|string|string[]
|
||||||
|
*/
|
||||||
|
public static function parseContentPublic($content)
|
||||||
|
{
|
||||||
|
$options = Helper::options();
|
||||||
|
//倒计时
|
||||||
|
if (strpos($content, '[countdown') !== false) {
|
||||||
|
$pattern = self::get_shortcode_regex(array('countdown'));
|
||||||
|
$content = preg_replace_callback("/$pattern/", array('Content', 'countdownParseCallback'),
|
||||||
|
$content);
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
+256
@@ -0,0 +1,256 @@
|
|||||||
|
<?php
|
||||||
|
class UA{
|
||||||
|
public $ua;
|
||||||
|
public function __construct($ua = '')
|
||||||
|
{
|
||||||
|
$this->ua = $ua;
|
||||||
|
}
|
||||||
|
public function returnBrowser(){
|
||||||
|
$ua = $this->ua;
|
||||||
|
if(preg_match('/rv:(11.0)/i', $ua, $matches)){
|
||||||
|
$title = 'Internet Explorer '. $matches[1];
|
||||||
|
$icon = 'fa fa-internet-explorer';//ie11
|
||||||
|
}elseif (preg_match('#MSIE ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'Internet Explorer '. $matches[1];
|
||||||
|
|
||||||
|
if ( strpos($matches[1], '7') !== false || strpos($matches[1], '8') !== false)
|
||||||
|
$icon = 'fa fa-internet-explorer';//ie8
|
||||||
|
elseif ( strpos($matches[1], '9') !== false)
|
||||||
|
$icon = 'fa fa-internet-explorer';//ie9
|
||||||
|
elseif ( strpos($matches[1], '10') !== false)
|
||||||
|
$icon = 'fa fa-internet-explorer';//ie10
|
||||||
|
}elseif (preg_match('#Edge/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'Edge '. $matches[1];
|
||||||
|
$icon = 'fa fa-edge';
|
||||||
|
}elseif (preg_match('#TheWorld ([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||||
|
$title = 'TheWorld(世界之窗) '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-theworld';
|
||||||
|
}elseif (preg_match('#JuziBrowser#i', $ua, $matches)){
|
||||||
|
$title = 'Juzi(桔子) '.$matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('#KBrowser#i', $ua, $matches)){
|
||||||
|
$title = 'KBrowser(超快) '.$matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('#MyIE#i', $ua, $matches)){
|
||||||
|
$title = 'MyIE(蚂蚁) '.$matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('#(Firefox|Phoenix|Firebird|BonEcho|GranParadiso|Minefield|Iceweasel)/([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||||
|
$title = 'Firefox '. $matches[1];
|
||||||
|
$icon = 'fa fa-firefox';
|
||||||
|
}elseif (preg_match('#CriOS/([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||||
|
$title = 'Chrome for iOS '. $matches[1];
|
||||||
|
$icon = 'fa fa-chrome';
|
||||||
|
} elseif (preg_match('#LBBROWSER#i', $ua, $matches)) {
|
||||||
|
$title = '猎豹';
|
||||||
|
$icon = 'iconfont icon-liebaoliulanqi';
|
||||||
|
}elseif (preg_match('#Opera.(.*)Version[ /]([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'Opera '. $matches[2];
|
||||||
|
$icon = 'fa fa-opera';
|
||||||
|
if (preg_match('#opera mini#i', $ua))
|
||||||
|
$title = 'Opera Mini '. $matches[2];
|
||||||
|
}elseif (preg_match('#Maxthon( |\/)([a-zA-Z0-9.]+)#i', $ua,$matches)) {
|
||||||
|
$title = 'Maxthon(遨游) '. $matches[2];
|
||||||
|
$icon = 'iconfont icon-liulanqi-aoyou';
|
||||||
|
}elseif (preg_match('#360([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = '360 Browser '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-liulanqi-jisu';
|
||||||
|
}elseif (preg_match('#SE 2([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'SouGou Browser 2 '.$matches[1];
|
||||||
|
$icon = 'iconfont icon-liulanqi-sougou';
|
||||||
|
}elseif (preg_match('#QQBrowser/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'QQBrowser '.$matches[1];
|
||||||
|
$icon = 'iconfont icon-QQliulanqi';
|
||||||
|
if (preg_match('#Mobile MQQBrowser/([a-zA-Z0-9.]+)#i', $ua,$matches)) {
|
||||||
|
$title = 'Mobile MQQBrowser '. $matches[1];
|
||||||
|
$icon = 'fa fa-qq';
|
||||||
|
}elseif (preg_match('#MicroMessenger/([a-zA-Z0-9.]+)#i', $ua,$matches)) {
|
||||||
|
$title = 'Wechat Browser '. $matches[1];
|
||||||
|
$icon = 'weixin';
|
||||||
|
}
|
||||||
|
}elseif (preg_match('#QQ/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'QQ '.$matches[1];
|
||||||
|
$icon = 'fa fa-qq';
|
||||||
|
}elseif (preg_match('#YYE/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'YYE '.$matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('#115Browser/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = '115 '.$matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('#37abc/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = '37abc '.$matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('#TheWorld ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = '世界之窗 '.$matches[1];
|
||||||
|
$icon = 'iconfont icon-theworld';
|
||||||
|
}elseif (preg_match('#UCWEB([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'UCWEB '. $matches[1];
|
||||||
|
$icon = 'icon-win8 icon-ucliulanqi';
|
||||||
|
}elseif (preg_match('#UBrowser/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'UBrowser '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-ucliulanqi';
|
||||||
|
}elseif (preg_match('#Quark/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'Quark '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-ucliulanqi'; //
|
||||||
|
}elseif (preg_match('#2345Explorer/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = '2345Explorer '. $matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('#XiaoMi/MiuiBrowser/([0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = '小米 '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-xiaomi';
|
||||||
|
}elseif (preg_match('/WeiBo/i', $ua, $matches)) {
|
||||||
|
$title = '微博 '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-weibo';
|
||||||
|
}elseif (preg_match('/BIDU/i', $ua, $matches)) {
|
||||||
|
$title = '百度 '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-setting';
|
||||||
|
}elseif (preg_match('/mailapp/i', $ua, $matches)) {
|
||||||
|
$title = 'EmailApp '. $matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('/Sleipnir/i', $ua, $matches)) {
|
||||||
|
$title = '神马 '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-weibiaoti--';
|
||||||
|
}elseif (preg_match('/MZBrowser/i', $ua, $matches)) {
|
||||||
|
$title = '魅族 '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-meizu';
|
||||||
|
}elseif (preg_match('/VivoBrowser/i', $ua, $matches)) {
|
||||||
|
$title = 'Vivo '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-VIVO';
|
||||||
|
}elseif (preg_match('/mixia/i', $ua, $matches)) {
|
||||||
|
$title = '米侠 '. $matches[1];
|
||||||
|
$icon = 'fa fa-globe';
|
||||||
|
}elseif (preg_match('/CoolMarket/i', $ua, $matches)) {
|
||||||
|
$title = '酷安 '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-coolapk';
|
||||||
|
}elseif (preg_match('/YaBrowser/i', $ua, $matches)) {
|
||||||
|
$title = 'Yandex '. $matches[1];
|
||||||
|
$icon = 'iconfont icon-yandex';
|
||||||
|
}elseif (preg_match('/Kraitnabo\/([^\s|;]+)/i', $ua, $matches)) {
|
||||||
|
$title = '南博 '. $matches[1];
|
||||||
|
$icon = 'anzhuo';
|
||||||
|
}elseif (preg_match('#Chrome/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'Google Chrome '. $matches[1];
|
||||||
|
$icon = 'fa fa-chrome';
|
||||||
|
if (preg_match('#OPR/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'Opera '. $matches[1];
|
||||||
|
$icon = 'fa fa-opera';
|
||||||
|
}
|
||||||
|
}elseif (preg_match('#Safari/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||||
|
$title = 'Safari '. $matches[1];
|
||||||
|
$icon = 'fa fa-safari';
|
||||||
|
}
|
||||||
|
return array("title"=>$title,
|
||||||
|
"icon"=>$icon);
|
||||||
|
}
|
||||||
|
public function returnOS(){
|
||||||
|
$ua = $this->ua;
|
||||||
|
$title = "未知浏览器";
|
||||||
|
$icon = "";
|
||||||
|
if (preg_match('/win/i', $ua)) {
|
||||||
|
if (preg_match('/Windows NT 6.1/i', $ua)) {
|
||||||
|
$title = "Windows 7";
|
||||||
|
$icon = "iconfont icon-win";
|
||||||
|
}elseif (preg_match('/Windows 98/i', $ua)) {
|
||||||
|
$title = "Windows 98";
|
||||||
|
$icon = "iconfont icon-win2";
|
||||||
|
}elseif (preg_match('/Windows NT 5.0/i', $ua)) {
|
||||||
|
$title = "Windows 2000";
|
||||||
|
$icon = "iconfont icon-win2";
|
||||||
|
}elseif (preg_match('/Windows NT 5.1/i', $ua)) {
|
||||||
|
$title = "Windows XP";
|
||||||
|
$icon = "iconfont icon-win";
|
||||||
|
}elseif (preg_match('/Windows NT 5.2/i', $ua)) {
|
||||||
|
if (preg_match('/Win64/i', $ua)) {
|
||||||
|
$title = "Windows XP 64 bit";
|
||||||
|
} else {
|
||||||
|
$title = "Windows Server 2003";
|
||||||
|
}
|
||||||
|
$icon = 'iconfont icon-win';
|
||||||
|
}elseif (preg_match('/Windows NT 6.0/i', $ua)) {
|
||||||
|
$title = "Windows Vista";
|
||||||
|
$icon = "fa fa-windows";
|
||||||
|
}elseif (preg_match('/Windows NT 6.2/i', $ua)) {
|
||||||
|
$title = "Windows 8";
|
||||||
|
$icon = "iconfont icon-win8";
|
||||||
|
}elseif (preg_match('/Windows NT 6.3/i', $ua)) {
|
||||||
|
$title = "Windows 8.1";
|
||||||
|
$icon = "iconfont icon-win8";
|
||||||
|
}elseif (preg_match('/Windows NT 10.0/i', $ua)) {
|
||||||
|
$title = "Windows 10";
|
||||||
|
$icon = "iconfont icon-win3";
|
||||||
|
}elseif (preg_match('/Windows Phone/i', $ua)) {
|
||||||
|
$matches = explode(';',$ua);
|
||||||
|
$title = $matches[2];
|
||||||
|
$icon = "iconfont icon-winphone";
|
||||||
|
}
|
||||||
|
} elseif (preg_match('#iPod.*.CPU.([a-zA-Z0-9.( _)]+)#i', $ua, $matches)) {
|
||||||
|
$title = "iPod ";//.$matches[1]
|
||||||
|
$icon = "iconfont icon-ipod";
|
||||||
|
} elseif (preg_match('/iPhone OS ([_0-9]+)/i', $ua, $matches)) {
|
||||||
|
$title = "Iphone ";//.$matches[1]
|
||||||
|
$icon = "iconfont icon-iphone";
|
||||||
|
} elseif (preg_match('/iPad; CPU OS ([_0-9]+)/i', $ua, $matches)) {
|
||||||
|
$title = "iPad ";//.$matches[1]
|
||||||
|
$icon = "iconfont icon-ipad";
|
||||||
|
} elseif (preg_match('/Mac OS X ([0-9_]+)/i', $ua, $matches)) {
|
||||||
|
if(count(explode(7,$matches[1]))>1) $matches[1] = 'Lion '.$matches[1];
|
||||||
|
elseif(count(explode(8,$matches[1]))>1) $matches[1] = 'Mountain Lion '.$matches[1];
|
||||||
|
$title = "Mac OSX";
|
||||||
|
$icon = "iconfont icon-macosdeicon";
|
||||||
|
} elseif (preg_match('/Macintosh/i', $ua)) {
|
||||||
|
$title = "Mac OS";
|
||||||
|
$icon = "iconfont icon-iconmacos";
|
||||||
|
} elseif (preg_match('/CrOS/i', $ua)){
|
||||||
|
$title = "Google Chrome OS";
|
||||||
|
$icon = "iconfont icon-iconchromeos";
|
||||||
|
} elseif (preg_match('/Linux/i', $ua)) {
|
||||||
|
$title = 'Linux';
|
||||||
|
$icon = 'fa fa-linux';
|
||||||
|
if (preg_match('/Ubuntu/i', $ua)) {
|
||||||
|
$title = "Ubuntu Linux";
|
||||||
|
$icon = "iconfont icon-ubuntu";
|
||||||
|
}elseif(preg_match('#Debian#i', $ua)) {
|
||||||
|
$title = "Debian GNU/Linux";
|
||||||
|
$icon = "iconfont icon-debian";
|
||||||
|
}elseif (preg_match('#Fedora#i', $ua)) {
|
||||||
|
$title = "Fedora Linux";
|
||||||
|
$icon = "iconfont icon-fedora";
|
||||||
|
}elseif (preg_match('/Kraitnabo\/([^\s|;]+)/i', $ua, $matches)) {
|
||||||
|
$title = '南博app '. $matches[1];
|
||||||
|
$icon = 'anzhuo';
|
||||||
|
}elseif (preg_match('/Android.([0-9. _]+)/i',$ua, $matches)) {
|
||||||
|
$title= "Android";
|
||||||
|
$icon = "iconfont icon-android";
|
||||||
|
}
|
||||||
|
} elseif (preg_match('/Android.([0-9. _]+)/i',$ua, $matches)) {
|
||||||
|
$title= "Android";
|
||||||
|
$icon = "iconfont icon-android";
|
||||||
|
}
|
||||||
|
return array("title"=>$title,
|
||||||
|
"icon"=>$icon);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 时光机页面ua,如果是手机设备,只显示设备类型,如果是电脑设备只显示电脑设备类型,如果是扩展发送,显示发送自「扩展」,如果是微信公众号,显示
|
||||||
|
*/
|
||||||
|
public function returnTimeUa(){
|
||||||
|
if ($this->ua == "weixin" || $this->ua == "weChat"){
|
||||||
|
return array("title"=>("微信公众号"),
|
||||||
|
"icon"=>"weixin");
|
||||||
|
}elseif ($this->ua == "crx"){
|
||||||
|
return array("title"=>("Chrome扩展"),
|
||||||
|
"icon"=>"liulanqi");
|
||||||
|
}elseif ($this->ua == "yearcross"){
|
||||||
|
return array("title"=>("YearCross"),
|
||||||
|
"icon"=>"QQ");
|
||||||
|
}elseif ($this->ua == "Kraitnabo"){
|
||||||
|
return array("title"=>("南博app"),
|
||||||
|
"icon"=>"anzhuo");
|
||||||
|
}elseif ($this->ua == "python"){
|
||||||
|
return array("title"=>("python脚本"),
|
||||||
|
"icon"=>"python");
|
||||||
|
}else{
|
||||||
|
$ua = $this->returnOS();
|
||||||
|
$ua["icon"] = "anzhuo";
|
||||||
|
return $ua;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'UA.php';
|
||||||
|
require_once 'Content.php';
|
||||||
|
if ($this->user->hasLogin()){
|
||||||
|
$GLOBALS['isLogin'] = true;
|
||||||
|
}else{
|
||||||
|
$GLOBALS['isLogin'] = false;
|
||||||
|
}
|
||||||
|
function threadedComments($comments, $options)
|
||||||
|
{
|
||||||
|
$db = Typecho_Db::get();
|
||||||
|
?>
|
||||||
|
<article class='post--item post--item__status'>
|
||||||
|
<div class='content'>
|
||||||
|
<header>
|
||||||
|
<?php $ua = new UA($comments->agent); ?>
|
||||||
|
<div class="comment--avatar"><?php echo $comments->gravatar('48', ''); ?></div>
|
||||||
|
<?php $comments->author(); ?>
|
||||||
|
<span class="dot"></span>
|
||||||
|
<p class="humane--time"><?php $comments->date('Y年m月d日 H:i'); ?></p>
|
||||||
|
<span class="dot"></span>
|
||||||
|
<?php echo "发自" . $ua->returnTimeUa()['title'];?>
|
||||||
|
</header>
|
||||||
|
<div class="description" itemprop="about">
|
||||||
|
<?php echo Content::postCommentContent(Content::timeMachineCommentContent($comments->text),$GLOBALS['isLogin'] ,"","","",true); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
<?php } ?>
|
||||||
|
<?php $this->comments()->to($comments); ?>
|
||||||
|
<input type="hidden" class="j-comment-url" value="<?php $this->commentUrl() ?>">
|
||||||
|
<?php if ($this->user->hasLogin()) : ?>
|
||||||
|
<div class="respond" id="comments">
|
||||||
|
<div class="comments--title">有什么新鲜事想告诉大家?</div>
|
||||||
|
<form method="post" id="textarea" class="comment-form" action="<?php $this->commentUrl() ?>">
|
||||||
|
<p class="comment-form-comment">
|
||||||
|
<textarea name="text" id="j-dynamic-form-text" class="textarea" autocomplete="off" rows="3" placeholder="发表您的新鲜事儿..."></textarea>
|
||||||
|
<input type="hidden" value="<?php $this->user->screenName(); ?>" name="author" />
|
||||||
|
<input type="hidden" value="<?php $this->user->mail(); ?>" name="mail" />
|
||||||
|
<input type="hidden" value="<?php $this->options->siteUrl(); ?>" name="url" />
|
||||||
|
<input type="hidden" name="_" value="<?php Typecho_Widget::widget('Widget_Security')->to($security);
|
||||||
|
echo $security->getToken($this->request->getRequestUrl()); ?>">
|
||||||
|
</p>
|
||||||
|
<p class="form-submit">
|
||||||
|
<button type="submit" class="submit"><?php _e('发表(Ctrl+Enter)'); ?></button>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php $comments->listComments(['commentUrl'=>$this->commentUrl,'class'=>$this]); ?>
|
||||||
|
<?php
|
||||||
|
$comments->pageNav(
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z" fill="var(--main)"></path></svg>',
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.1714 12.0007L8.22168 7.05093L9.63589 5.63672L15.9999 12.0007L9.63589 18.3646L8.22168 16.9504L13.1714 12.0007Z" fill="var(--main)"></path></svg>',
|
||||||
|
1,
|
||||||
|
'...',
|
||||||
|
array(
|
||||||
|
'wrapTag' => 'div',
|
||||||
|
'wrapClass' => 'pagination_page',
|
||||||
|
'itemTag' => '',
|
||||||
|
'textTag' => 'a',
|
||||||
|
'currentClass' => 'active',
|
||||||
|
'prevClass' => 'prev',
|
||||||
|
'nextClass' => 'next'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
/* 分页 */
|
||||||
|
.pagination_page{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: var(--margin);
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
.pagination_page li.active a {
|
||||||
|
background: var(--theme);
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.pagination_page a{
|
||||||
|
display: flex;
|
||||||
|
padding: 0.5rem;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
width: 1.75rem;
|
||||||
|
height: 1.75rem;
|
||||||
|
background: var(--background);
|
||||||
|
border-radius: 50%;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
transition: 0.2s;
|
||||||
|
-webkit-transition: 0.2s;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
letter-spacing: 0;
|
||||||
|
}
|
||||||
|
.pagination_page span.next{
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.pagination_page li.active a:hover{
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
/* 分页 */
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user