Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b4acf698a1 | |||
| dc59ba972e | |||
| 6473985801 | |||
| 4ba2c9ca76 | |||
| b52c2f0a23 | |||
| e8f4e79009 | |||
| 12ee26cdfe | |||
| ae64c25228 | |||
| beba961edf | |||
| d39023df8c | |||
| 6b8c0d0095 | |||
| 5a880c019d | |||
| ce1b8c4378 | |||
| aa30ed95f8 | |||
| bc3056bc4c |
@@ -4,9 +4,7 @@
|
||||
<section class="template--404">
|
||||
<div class="error--text">404</div>
|
||||
<div class="error--posts">
|
||||
|
||||
<article class="post--error" itemtype="http://schema.org/Article" itemscope="itemscope">
|
||||
|
||||
<div class="content">
|
||||
<h2 class="post--title" itemprop="headline">
|
||||
<a href="<?php $this->options->siteUrl(); ?>">
|
||||
@@ -19,11 +17,9 @@
|
||||
d="M512 97.52381c228.912762 0 414.47619 185.563429 414.47619 414.47619s-185.563429 414.47619-414.47619 414.47619S97.52381 740.912762 97.52381 512 283.087238 97.52381 512 97.52381z m0 73.142857C323.486476 170.666667 170.666667 323.486476 170.666667 512s152.81981 341.333333 341.333333 341.333333 341.333333-152.81981 341.333333-341.333333S700.513524 170.666667 512 170.666667z m36.571429 89.697523v229.86362h160.865523v73.142857H512a36.571429 36.571429 0 0 1-36.571429-36.571429V260.388571h73.142858z">
|
||||
</path>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
|
||||
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
||||
精简部分 JS.
|
||||
感谢
|
||||
|
||||
- 2024.6.3
|
||||
- 2024.6.5
|
||||
新增了好物的页面 还是通过memos来获取
|
||||
|
||||
- 2024.6.4 v0.5.1
|
||||
|
||||
更改了设置memos的方式
|
||||
新增了Mastodon 的 说说 页面
|
||||
|
||||
- 2024.6.3 v0.5.0
|
||||
|
||||
还是抄了原版的豆瓣获取方式
|
||||
|
||||
- 2024.5.26
|
||||
- 2024.5.26 v0.4.1
|
||||
|
||||
抄了个网站统计页面
|
||||
|
||||
@@ -24,7 +31,7 @@ https://github.com/bigfa/hugo-theme-farallon
|
||||
|
||||
## 移植进度
|
||||
|
||||
95%
|
||||
96%
|
||||
|
||||
## 功能
|
||||
|
||||
@@ -36,16 +43,14 @@ https://github.com/bigfa/hugo-theme-farallon
|
||||
|
||||
|
||||
### 豆瓣观影
|
||||
~~* 能力有限原项目功能无法实现~~
|
||||
|
||||
~~目前只能配合`DoubanBoard`插件使用~~
|
||||
|
||||
~~项目地址~~
|
||||
~~https://github.com/AlanDecode/Typecho-Plugin-DoubanBoard~~
|
||||
~~!!记得重命名文件夹为`DoubanBoard`~~
|
||||
|
||||
使用原版的获取方式
|
||||
https://node.wpista.com/
|
||||
|
||||
>豆瓣收藏使用方法
|
||||
微信扫码登录https://node.wpista.com/
|
||||
输入你的豆瓣数字 id,点击保存即可自动同步豆瓣记录。
|
||||
点击 Get integration token 会生成一个 token。
|
||||
|
||||
获取`token`之后填入主题设置项中
|
||||
|
||||
### 友情链接
|
||||
@@ -58,6 +63,19 @@ https://node.wpista.com/
|
||||
|
||||
若使用AI摘要插件则显示AI摘要,不使用则显示默认字数摘要
|
||||
|
||||
### 说说 by Memos
|
||||
|
||||
使用自定义字段设置memos
|
||||
在自定义字段中填入`memos`值为memos地址,不带`/`
|
||||
在自定义字段中填入`memosID`默认值为`1`,不为`1`时才需要设置
|
||||
在自定义字段中填入`memosnum`默认值为`20`,默认获取20条最近的memo
|
||||
|
||||
### 说说 by Mastodon
|
||||
|
||||
根据 https://www.imsun.org/archives/1643.html#toc3
|
||||
获得API地址
|
||||
|
||||
在自定义字段中填入`tooot`值为Mastodon API 地址
|
||||
|
||||
## 预览地址
|
||||
|
||||
|
||||
+41
-4
@@ -12,7 +12,6 @@
|
||||
<h3 class="post--single__subtitle"><?php $this->categorydescription(); ?></h3>
|
||||
<?php while($this->next()): ?>
|
||||
</header>
|
||||
|
||||
<article class="post--item">
|
||||
<div class="content">
|
||||
<h2 class="post--title">
|
||||
@@ -55,7 +54,7 @@
|
||||
'...',
|
||||
array(
|
||||
'wrapTag' => 'div',
|
||||
'wrapClass' => 'cat_pagination_page',
|
||||
'wrapClass' => 'pagination_page',
|
||||
'itemTag' => '',
|
||||
'textTag' => 'a',
|
||||
'currentClass' => 'active',
|
||||
@@ -64,7 +63,6 @@
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<!-- 搜索结果 -->
|
||||
<?php else: ?>
|
||||
<main class="site--main">
|
||||
@@ -76,5 +74,44 @@
|
||||
</header>
|
||||
</main>
|
||||
<?php endif; ?>
|
||||
|
||||
<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>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
+17
-10
@@ -27,10 +27,6 @@ function themeConfig($form) {
|
||||
$form->addInput($cnavatar);
|
||||
$donate = new Typecho_Widget_Helper_Form_Element_Text('donate', NULL, 'https://blogcdn.loliko.cn/donate/wx.png', _t('赞赏二维码'), _t('不填写则不显示'));
|
||||
$form->addInput($donate);
|
||||
$memos = new Typecho_Widget_Helper_Form_Element_Text('memos', NULL, 'https://m.loliko.cn', _t('memos地址'), _t('结尾不带"/"'));
|
||||
$form->addInput($memos);
|
||||
$memosID = new Typecho_Widget_Helper_Form_Element_Text('memosID', NULL, '1', _t('memosID'), _t('数字ID'));
|
||||
$form->addInput($memosID);
|
||||
$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'));
|
||||
$form->addInput($doubanID);
|
||||
$twikoo = new Typecho_Widget_Helper_Form_Element_Textarea('twikoo', NULL, NULL, _t('引用第三方评论'), _t('不填写则不显示'));
|
||||
@@ -175,13 +171,24 @@ function allwords() {
|
||||
elseif ($chars>1000000){
|
||||
echo '全站共 '.$chars.' 字,已写一本列夫·托尔斯泰的《战争与和平》了!';}
|
||||
}
|
||||
function show_first_image($content) {
|
||||
preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
|
||||
// 检查是否找到了图片
|
||||
if(isset($matches[1][0])){
|
||||
return $matches[1][0];
|
||||
function img_postthumb($cid) {
|
||||
$db = Typecho_Db::get();
|
||||
$rs = $db->fetchRow($db->select('table.contents.text')
|
||||
->from('table.contents')
|
||||
->where('table.contents.cid=?', $cid)
|
||||
->order('table.contents.cid', Typecho_Db::SORT_ASC)
|
||||
->limit(1));
|
||||
// 检查是否获取到结果
|
||||
if (!$rs) {
|
||||
return "";
|
||||
}
|
||||
preg_match_all("/https?:\/\/[^\s]*.(png|jpeg|jpg|gif|bmp|webp)/", $rs['text'], $thumbUrl); //通过正则式获取图片地址
|
||||
// 检查是否匹配到图片URL
|
||||
if (count($thumbUrl[0]) > 0) {
|
||||
return $thumbUrl[0][0]; // 返回第一张图片的URL
|
||||
} else {
|
||||
return ""; // 没有匹配到图片URL,返回空字符串
|
||||
}
|
||||
return false; // 没有找到图片,返回 false
|
||||
}
|
||||
//开始增加某些奇怪的东西
|
||||
// 获取月份
|
||||
|
||||
@@ -52,13 +52,10 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="inner">
|
||||
<nav>
|
||||
<ul>
|
||||
<li class="whome"><a <?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a></li>
|
||||
|
||||
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
|
||||
<?php while($pages->next()): ?>
|
||||
<li><a <?php if($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a></li>
|
||||
<?php endwhile; ?>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- 这年头谁会用站内的搜索啊 -->
|
||||
@@ -69,9 +66,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</label>
|
||||
<button type="submit" class="search-submit submit">搜索</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<svg class="svgIcon" width="25" height="25" data-action="show-search">
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* 移植自HUGO主题`farallon`原作者`bigfa`
|
||||
* 移植自HUGO主题 farallon 原作者 bigfa
|
||||
* @package farallon
|
||||
* @author 老孙
|
||||
* @version 0.5.0
|
||||
* @version 0.5.1
|
||||
* @link https://imsun.org
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
$this->need('header.php');
|
||||
?>
|
||||
<main class="site--main">
|
||||
|
||||
<div class="articleList">
|
||||
<?php $this->need('postlist.php'); ?>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div 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>
|
||||
<section class="category--list">
|
||||
<?php $this->widget('Widget_Metas_Category_List')->parse('
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ $this->need('header.php');
|
||||
<section class="site--main">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="archive--title__year"> </h2>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
<article class="post--single">
|
||||
<div class="graph u-marginBottom30">
|
||||
|
||||
@@ -42,14 +42,12 @@ class APIHandler {
|
||||
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}`)
|
||||
@@ -61,7 +59,6 @@ class APIHandler {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handleGenreClick() {
|
||||
this.on("click", ".db--genreItem", event => {
|
||||
const target = event.currentTarget;
|
||||
@@ -85,14 +82,12 @@ class APIHandler {
|
||||
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())
|
||||
@@ -127,7 +122,6 @@ class APIHandler {
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
let html = ``;
|
||||
for (let key in result) {
|
||||
const date = key.split("-");
|
||||
@@ -156,7 +150,6 @@ class APIHandler {
|
||||
}
|
||||
document.querySelector(".db--list").innerHTML = html;
|
||||
}
|
||||
|
||||
_renderListTemplate() {
|
||||
document.querySelector(".db--list").innerHTML = this.subjects.map(subject =>
|
||||
`<div class="db--item">
|
||||
@@ -173,7 +166,6 @@ class APIHandler {
|
||||
</div>`
|
||||
).join("");
|
||||
}
|
||||
|
||||
_handleScroll() {
|
||||
window.addEventListener("scroll", () => {
|
||||
const scrollY = window.scrollY || window.pageYOffset;
|
||||
@@ -185,7 +177,6 @@ class APIHandler {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handleNavClick() {
|
||||
this.on("click", ".db--navItem", event => {
|
||||
if (event.currentTarget.classList.contains("current")) return;
|
||||
@@ -207,7 +198,6 @@ class APIHandler {
|
||||
this._fetchData();
|
||||
});
|
||||
}
|
||||
|
||||
_create() {
|
||||
if (document.querySelector(".db--container")) {
|
||||
const container = document.querySelector(".db--container");
|
||||
@@ -273,7 +263,6 @@ class APIHandler {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_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}`)
|
||||
@@ -339,7 +328,6 @@ class APIHandler {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 在页面加载完成后实例化APIHandler类
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const token = "<?php $this->options->doubanID() ?>"; // 替换为你的API令牌
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* 好物页面
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<div class="site--main site--main__gears">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?></h2>
|
||||
</header>
|
||||
<div id=goods class="good--list"></div>
|
||||
</div>
|
||||
<style>
|
||||
.img40 {
|
||||
height: 137px;
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
||||
$memos = $this->fields->memos ? $this->fields->memos : 'https://memos.imsun.org';
|
||||
$memosID = $this->fields->memosID ? $this->fields->memosID : '1';
|
||||
$memostag = $this->fields->memostag ? $this->fields->memostag : '好物';
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
memoGoods();
|
||||
});
|
||||
function memoGoods(e) {
|
||||
let t = e || 12;
|
||||
var n = "<?php echo $memos; ?>",
|
||||
s = n + "/api/v1/memo?creatorId=<?php echo $memosID; ?>&limit=" + t + "&tag=<?php echo $memostag; ?>";
|
||||
let i = 1;
|
||||
const o = /\n/;
|
||||
fetch(s).then(e => e.json()).then(e => {
|
||||
let c = "";
|
||||
for (var t, s, i, a, d, u, h, m, r = 0; r < e.length; r++) {
|
||||
a = e[r].content.replace(`#好物 \n`, ""),
|
||||
t = a.split(o),
|
||||
i = t[0].replace(/!\[.*?\]\((.*?)\)/g, "$1"), // 图片链接
|
||||
s = t[0].replace(/!\[(.*?)\]\(.*?\)/g, "$1"),
|
||||
d = s.split(",")[0], // 商品名称
|
||||
u = s.split(",")[1], // 价格
|
||||
h = t[1].replace(/\[.*?\]\((.*?)\)/g, "$1"), // 商品链接
|
||||
m = t[1].replace(/\[(.*?)\]\(.*?\)/g, "$1"), // 推荐理由
|
||||
c +=
|
||||
'<div class="good--item"><div class="img-spacer"><a href="'
|
||||
+ h +
|
||||
'" target="_blank"><img src="'
|
||||
+ i +
|
||||
'" class="img40"></a></div><div class="good--name"><div class="brand">'
|
||||
+ d + '·' + m +'</div>'
|
||||
+ u +
|
||||
'</div></div>';
|
||||
}
|
||||
let f = document.querySelector("#goods");
|
||||
f.innerHTML = c;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
+1
-3
@@ -9,9 +9,8 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<section class="site--main">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="archive--title__year"> </h2>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
|
||||
<div class="graph u-marginBottom30">
|
||||
<?php $this->content(); ?>
|
||||
</div>
|
||||
@@ -30,5 +29,4 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* 说说页面 - Mastodon
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<div 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 $tooot = $this->fields->tooot ? $this->fields->tooot : 'https://bbapi.ima.cm'; ?>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" />
|
||||
<div id="tooot"></div>
|
||||
<div class="nav-links" id="loadmore">
|
||||
<span class="loadmore">加载更多</span>
|
||||
</div>
|
||||
</article>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
let offset = 0; // 初始偏移量
|
||||
const limit = 20; // 每次加载的数量
|
||||
function formatHTML(toots) {
|
||||
let htmlString = '';
|
||||
toots.forEach(toot => {
|
||||
const { content, account, url, created_at, media_attachments} = toot;
|
||||
let mediaHTML = ''; // 初始化资源相关HTML为空字符串
|
||||
// 处理媒体附件
|
||||
if (media_attachments.length > 0) {
|
||||
media_attachments.forEach(attachment => {
|
||||
if (attachment.type === 'image') {
|
||||
mediaHTML += `<a href="${attachment.url}" target="_blank"><img src="${attachment.preview_url}" data-fancybox="img" class="thumbnail-image img"></a>`;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 使用 marked 转换 markdown 内容为 HTML
|
||||
const htmlContent = marked.parse(content);
|
||||
// 创建 HTML 字符串
|
||||
htmlString += `
|
||||
<article class='post--item post--item__status'>
|
||||
<div class='content'>
|
||||
<header>
|
||||
<img src="${account.avatar}" class="avatar" width="48" height="48" />
|
||||
<a class="humane--time" href="${url}" target="_blank">${new Date(created_at).toLocaleString()}</a>
|
||||
</header>
|
||||
<div class="description" itemprop="about">
|
||||
${htmlContent}
|
||||
<div class="resimg">${mediaHTML}</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>`;
|
||||
});
|
||||
return htmlString;
|
||||
}
|
||||
function fetchToots() {
|
||||
return fetch('<?php echo $tooot; ?>')
|
||||
.then(response => response.json())
|
||||
.catch(error => {
|
||||
console.error('Error fetching toots:', error);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
function fetchAndDisplayToots() {
|
||||
fetchToots().then(data => {
|
||||
const memosContainer = document.getElementById('tooot');
|
||||
const tootsToShow = data.slice(offset, offset + limit); // 选择要显示的toots
|
||||
memosContainer.innerHTML += formatHTML(tootsToShow);
|
||||
offset += limit; // 更新偏移量
|
||||
// 如果没有更多的toots,隐藏“加载更多”按钮
|
||||
if (offset >= data.length) {
|
||||
document.getElementById('loadmore').style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
// 在页面加载完成后获取并展示 toots
|
||||
fetchAndDisplayToots();
|
||||
// 绑定“加载更多”按钮的点击事件
|
||||
document.getElementById('loadmore').addEventListener('click', fetchAndDisplayToots);
|
||||
};
|
||||
Fancybox.bind("[data-fancybox]", {
|
||||
// Your custom options
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
div pre code {
|
||||
/* 迫使文字断行 */
|
||||
white-space: pre-wrap; /* CSS3 */
|
||||
word-wrap: break-word; /* 老版本的浏览器 */
|
||||
overflow-wrap: break-word;
|
||||
/* 指定如何断行 */
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
div p a {
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
.thumbnail-image {
|
||||
width:100%;
|
||||
height: 200px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
.resimg {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
column-gap: 10px;
|
||||
row-gap: 10px;
|
||||
}
|
||||
.thumbnail-image img {
|
||||
width:100%;
|
||||
height:170px;
|
||||
object-fit:cover;
|
||||
border-radius:4px;
|
||||
transition:transform .3s ease;
|
||||
cursor:zoom-in
|
||||
}
|
||||
/* 当屏幕宽度小于732px时 */
|
||||
@media (max-width: 732px) {
|
||||
.resimg {
|
||||
grid-template-columns: repeat(2, 1fr); /* 修改为两列 */
|
||||
}
|
||||
}
|
||||
/* 当屏幕宽度小于400px时 */
|
||||
@media (max-width: 400px) {
|
||||
.resimg {
|
||||
grid-template-columns: 1fr; /* 修改为一列 */
|
||||
}
|
||||
}
|
||||
.load-more-btn {
|
||||
display: block;
|
||||
margin: 20px auto;
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.load-more-btn:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
.nav-links .loadmore {
|
||||
border: 1px solid var(--farallon-border-color);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
padding: 5px 30px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
color: var(--farallon-text-gray)
|
||||
}
|
||||
|
||||
.nav-links .loadmore:hover {
|
||||
border-color: var(--farallon-hover-color);
|
||||
color: var(--farallon-hover-color)
|
||||
}
|
||||
</style>
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
+12
-7
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* 说说页面
|
||||
* 说说页面 - memos
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
@@ -9,16 +9,24 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="site--main">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="archive--title__year"><?php $this->content(); ?> </h2>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
<?php
|
||||
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
||||
$memos = $this->fields->memos ? $this->fields->memos : 'https://memos.loliko.cn';
|
||||
$memosID = $this->fields->memosID ? $this->fields->memosID : '1';
|
||||
$memosnum = $this->fields->memosnum ? $this->fields->memosnum : '20';
|
||||
?>
|
||||
<article class="post--single">
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" />
|
||||
<div id="talk"></div>
|
||||
</article>
|
||||
<script>
|
||||
if (99) {
|
||||
let url = '<?php $this->options->memos() ?>';
|
||||
fetch(url + '/api/v1/memo?creatorId=<?php $this->options->memosID() ?>&rowStatus=NORMAL&limit=20')
|
||||
let url = '<?php echo $memos; ?>';
|
||||
fetch(url + '/api/v1/memo?creatorId=<?php echo $memosID; ?>&rowStatus=NORMAL&limit=<?php echo $memosnum; ?>')
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
let html = '';
|
||||
@@ -42,14 +50,12 @@ if (99) {
|
||||
</article>
|
||||
`;
|
||||
});
|
||||
|
||||
document.getElementById('talk').innerHTML = html;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
// 这里可以添加一些用户提示错误发生的 HTML 更新
|
||||
});
|
||||
|
||||
// 页面内容格式化
|
||||
function Format(item) {
|
||||
let date = getTime(new Date(item.createdTs * 1000).toString()),
|
||||
@@ -136,7 +142,6 @@ div p a {
|
||||
grid-template-columns: repeat(2, 1fr); /* 修改为两列 */
|
||||
}
|
||||
}
|
||||
|
||||
/* 当屏幕宽度小于400px时 */
|
||||
@media (max-width: 400px) {
|
||||
.resimg {
|
||||
|
||||
+1
-1
@@ -9,6 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<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>
|
||||
<div class="post-content">
|
||||
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?>
|
||||
@@ -24,6 +25,5 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<p class="text-center pb-2"><?php _e('没有任何标签'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -8,7 +8,6 @@
|
||||
<div class="graph u-marginBottom30">
|
||||
<?php $this->content(); ?>
|
||||
</div>
|
||||
|
||||
<!-- 判断如果禁止评论则不显示评论的div -->
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('comments.php'); ?>
|
||||
|
||||
@@ -19,21 +19,20 @@
|
||||
d="M12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9ZM11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12Z" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M21.83 11.2807C19.542 7.15186 15.8122 5 12 5C8.18777 5 4.45796 7.15186 2.17003 11.2807C1.94637 11.6844 1.94361 12.1821 2.16029 12.5876C4.41183 16.8013 8.1628 19 12 19C15.8372 19 19.5882 16.8013 21.8397 12.5876C22.0564 12.1821 22.0536 11.6844 21.83 11.2807ZM12 17C9.06097 17 6.04052 15.3724 4.09173 11.9487C6.06862 8.59614 9.07319 7 12 7C14.9268 7 17.9314 8.59614 19.9083 11.9487C17.9595 15.3724 14.939 17 12 17Z" />
|
||||
</svg><span class="article--views"><a><?php get_post_view($this) ?></a></span> 阅读
|
||||
</svg><span class="article--views"><a><?php get_post_view($this) ?></a></span>
|
||||
<svg viewBox="0 0 24 24" class="icon" aria-hidden="true" width="16" height="16">
|
||||
<g>
|
||||
<path
|
||||
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>
|
||||
</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>
|
||||
<?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">
|
||||
<!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||
<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"/>
|
||||
</svg>
|
||||
<a href="<?php $this->options->adminUrl('write-post.php?cid=' . $this->cid); ?>" target="_blank" title="编辑文章">编辑文章</a>
|
||||
</svg></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h2 class="post--single__title"><?php $this->title() ?></h2>
|
||||
@@ -133,12 +132,12 @@
|
||||
<?php if ($this->options->showrelated): ?>
|
||||
<?php $this->need('related.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 判断如果禁止评论则不显示评论的div -->
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<!-- 如果设置了第三方评论系统则使用第三方评论 -->
|
||||
<?php if($this->options->twikoo): ?>
|
||||
<?php $this->options->twikoo(); ?>
|
||||
<?php else: ?>
|
||||
<?php $this->need('comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 可以使用第三方评论-->
|
||||
<?php $this->options->twikoo(); ?>
|
||||
<!--翻页-->
|
||||
<nav class="navigation post-navigation is-active">
|
||||
<div class="nav-links">
|
||||
@@ -166,7 +165,6 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
||||
}
|
||||
}
|
||||
if (!found) return;
|
||||
|
||||
const heads = postContent.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
||||
const toc = document.createElement('div');
|
||||
toc.id = 'toc';
|
||||
@@ -183,10 +181,8 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
||||
} else {
|
||||
levelCounts[level]++;
|
||||
}
|
||||
|
||||
// 重置下级标题的计数器
|
||||
levelCounts = levelCounts.slice(0, level + 1);
|
||||
|
||||
if (currentLevel === 0) {
|
||||
currentLevel = level;
|
||||
}
|
||||
|
||||
+6
-4
@@ -56,13 +56,15 @@
|
||||
<a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论', '1 评论', '%d 评论'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $firstImage = show_first_image($this->content); ?>
|
||||
<?php if($firstImage): ?>
|
||||
<img src="<?php echo $firstImage; ?>" alt="文章图片" class="cover"/>
|
||||
<?php
|
||||
$firstImage = img_postthumb($this->cid);
|
||||
$cover = $this->fields->cover;
|
||||
$imageToDisplay = !empty($cover) ? $cover : $firstImage;
|
||||
if($imageToDisplay): ?>
|
||||
<img src="<?php echo $imageToDisplay; ?>" alt="文章图片" class="cover"/>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php
|
||||
$this->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>',
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="author--card">
|
||||
<img src="<?php $this->options->logoUrl() ?>" class="avatar" height="64" width="64" decoding="async">
|
||||
<div class="author--name">
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="related--content">
|
||||
<h3 class="related--posts__title">相关文章</h3>
|
||||
<div class="post--single__related">
|
||||
<?php $this->related(6)->to($relatedPosts); ?>
|
||||
|
||||
<?php while ($relatedPosts->next()): ?>
|
||||
<div class="post--single__related__item">
|
||||
<a href="<?php $relatedPosts->permalink(); ?>">
|
||||
|
||||
Reference in New Issue
Block a user