This commit is contained in:
haoouba 2021-02-11 12:46:01 +08:00
parent 2bdb1f2571
commit 1373783f54
9 changed files with 567 additions and 270 deletions

View File

@ -33,21 +33,75 @@
<?php if ($this->have()) : ?> <?php if ($this->have()) : ?>
<ul class="joe_archive__list joe_list" data-wow="<?php $this->options->JList_Animate() ?>"> <ul class="joe_archive__list joe_list" data-wow="<?php $this->options->JList_Animate() ?>">
<?php while ($this->next()) : ?> <?php while ($this->next()) : ?>
<li class="joe_list__item wow"> <?php if ($this->fields->mode === "default" || !$this->fields->mode) : ?>
<div class="line"></div> <li class="joe_list__item wow default">
<a href="<?php $this->permalink() ?>" class="thumbnail" title="<?php $this->title() ?>"> <div class="line"></div>
<img class="lazyload" src="<?php _getLazyload() ?>" data-src="<?php _getThumbnail($this) ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $this->title() ?>" /> <a href="<?php $this->permalink() ?>" class="thumbnail" title="<?php $this->title() ?>">
<time datetime="<?php $this->date('Y-m-d'); ?>"><?php $this->date('Y-m-d'); ?></time> <img class="lazyload" src="<?php _getLazyload() ?>" data-src="<?php echo _getThumbnails($this)[0] ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $this->title() ?>" />
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20"> <time datetime="<?php $this->date('Y-m-d'); ?>"><?php $this->date('Y-m-d'); ?></time>
<path d="M903.93077753 107.30625876H115.78633587C64.57261118 107.30625876 22.58166006 149.81138495 22.58166006 201.02510964v624.26547214c0 51.7240923 41.99095114 93.71694641 93.71694641 93.7169464h788.14444164c51.7202834 0 93.71694641-41.99285557 93.71694642-93.7169464v-624.26547214c-0.51227057-51.21372469-43.01739676-93.71885088-94.229217-93.71885088zM115.78633587 171.8333054h788.65671224c16.385041 0 29.70407483 13.31522639 29.70407484 29.70407482v390.22828696l-173.60830179-189.48107072c-12.80486025-13.82749697-30.21634542-21.50774542-48.14010264-19.97093513-17.92375723 1.02073227-34.82106734 10.75387344-46.60138495 26.11437327l-172.58185762 239.1598896-87.06123767-85.52061846c-12.28878076-11.78222353-27.65308802-17.92375723-44.03812902-17.92375577-16.3907529 0.50846167-31.75506163 7.67644101-43.52966736 20.48129978L86.59453164 821.70468765V202.04965083c-1.02454117-17.41529409 12.80486025-30.73052046 29.19180423-30.21634543zM903.93077753 855.50692718H141.90642105l222.25496164-245.81940722 87.0593347 86.03669649c12.80105134 12.80676323 30.21253651 18.95020139 47.11555999 17.4172 17.40958218-1.53871621 33.79652618-11.26614404 45.06267018-26.11818071l172.58376063-238.64762047 216.11152349 236.08817198 2.05098681-1.54062067v142.87778132c0.50846167 16.3907529-13.31522639 29.70597929-30.21444096 29.70597928z m0 0" p-id="1916"></path> <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20">
<path d="M318.07226687 509.82713538c79.88945091 0 144.41649754-65.03741277 144.41649754-144.41649753 0-79.37718032-64.52704663-144.92495923-144.41649754-144.92495922-79.89135536 0-144.41649754 64.52704663-144.41649756 144.41268862 0 79.89135536 64.52514218 144.92876814 144.41649756 144.92876813z m0-225.3266807c44.55230407 0 80.91208763 36.36168802 80.91208762 80.91018317 0 44.55611297-35.84751297 81.43007159-80.91208762 81.43007012-45.06838356 0-80.91589654-36.35978356-80.91589508-80.91589507 0-44.55611297 36.87205415-81.42435823 80.91589508-81.42435822z m0 0" p-id="1917"></path> <path d="M903.93077753 107.30625876H115.78633587C64.57261118 107.30625876 22.58166006 149.81138495 22.58166006 201.02510964v624.26547214c0 51.7240923 41.99095114 93.71694641 93.71694641 93.7169464h788.14444164c51.7202834 0 93.71694641-41.99285557 93.71694642-93.7169464v-624.26547214c-0.51227057-51.21372469-43.01739676-93.71885088-94.229217-93.71885088zM115.78633587 171.8333054h788.65671224c16.385041 0 29.70407483 13.31522639 29.70407484 29.70407482v390.22828696l-173.60830179-189.48107072c-12.80486025-13.82749697-30.21634542-21.50774542-48.14010264-19.97093513-17.92375723 1.02073227-34.82106734 10.75387344-46.60138495 26.11437327l-172.58185762 239.1598896-87.06123767-85.52061846c-12.28878076-11.78222353-27.65308802-17.92375723-44.03812902-17.92375577-16.3907529 0.50846167-31.75506163 7.67644101-43.52966736 20.48129978L86.59453164 821.70468765V202.04965083c-1.02454117-17.41529409 12.80486025-30.73052046 29.19180423-30.21634543zM903.93077753 855.50692718H141.90642105l222.25496164-245.81940722 87.0593347 86.03669649c12.80105134 12.80676323 30.21253651 18.95020139 47.11555999 17.4172 17.40958218-1.53871621 33.79652618-11.26614404 45.06267018-26.11818071l172.58376063-238.64762047 216.11152349 236.08817198 2.05098681-1.54062067v142.87778132c0.50846167 16.3907529-13.31522639 29.70597929-30.21444096 29.70597928z m0 0" p-id="1916"></path>
</svg> <path d="M318.07226687 509.82713538c79.88945091 0 144.41649754-65.03741277 144.41649754-144.41649753 0-79.37718032-64.52704663-144.92495923-144.41649754-144.92495922-79.89135536 0-144.41649754 64.52704663-144.41649756 144.41268862 0 79.89135536 64.52514218 144.92876814 144.41649756 144.92876813z m0-225.3266807c44.55230407 0 80.91208763 36.36168802 80.91208762 80.91018317 0 44.55611297-35.84751297 81.43007159-80.91208762 81.43007012-45.06838356 0-80.91589654-36.35978356-80.91589508-80.91589507 0-44.55611297 36.87205415-81.42435823 80.91589508-81.42435822z m0 0" p-id="1917"></path>
</a> </svg>
<div class="information"> </a>
<a href="<?php $this->permalink() ?>" class="title" title="<?php $this->title() ?>"> <div class="information">
<h6><?php $this->title() ?></h6> <a href="<?php $this->permalink() ?>" class="title" title="<?php $this->title() ?>">
<h6><?php $this->title() ?></h6>
</a>
<a class="abstract" href="<?php $this->permalink() ?>" title="文章摘要"><?php _getAbstract($this) ?></a>
<div class="meta">
<ul class="items">
<li><?php $this->date('Y年m月d日'); ?></li>
<li><?php _getViews($this) ?> 阅读</li>
<li><?php $this->commentsNum('%d'); ?> 评论</li>
<li><?php _getAgree($this) ?> 点赞</li>
</ul>
</div>
</div>
</li>
<?php elseif ($this->fields->mode === "single") : ?>
<li class="joe_list__item wow single">
<div class="line"></div>
<div class="information">
<a href="<?php $this->permalink() ?>" class="title" title="<?php $this->title() ?>">
<h6><?php $this->title() ?></h6>
</a>
<div class="meta">
<ul class="items">
<li><?php $this->date('Y年m月d日'); ?></li>
<li><?php _getViews($this) ?> 阅读</li>
<li><?php $this->commentsNum('%d'); ?> 评论</li>
<li><?php _getAgree($this) ?> 点赞</li>
</ul>
</div>
</div>
<a href="<?php $this->permalink() ?>" class="thumbnail" title="<?php $this->title() ?>">
<img class="lazyload" src="<?php _getLazyload() ?>" data-src="<?php echo _getThumbnails($this)[0] ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $this->title() ?>" />
<time datetime="<?php $this->date('Y-m-d'); ?>"><?php $this->date('Y-m-d'); ?></time>
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20">
<path d="M903.93077753 107.30625876H115.78633587C64.57261118 107.30625876 22.58166006 149.81138495 22.58166006 201.02510964v624.26547214c0 51.7240923 41.99095114 93.71694641 93.71694641 93.7169464h788.14444164c51.7202834 0 93.71694641-41.99285557 93.71694642-93.7169464v-624.26547214c-0.51227057-51.21372469-43.01739676-93.71885088-94.229217-93.71885088zM115.78633587 171.8333054h788.65671224c16.385041 0 29.70407483 13.31522639 29.70407484 29.70407482v390.22828696l-173.60830179-189.48107072c-12.80486025-13.82749697-30.21634542-21.50774542-48.14010264-19.97093513-17.92375723 1.02073227-34.82106734 10.75387344-46.60138495 26.11437327l-172.58185762 239.1598896-87.06123767-85.52061846c-12.28878076-11.78222353-27.65308802-17.92375723-44.03812902-17.92375577-16.3907529 0.50846167-31.75506163 7.67644101-43.52966736 20.48129978L86.59453164 821.70468765V202.04965083c-1.02454117-17.41529409 12.80486025-30.73052046 29.19180423-30.21634543zM903.93077753 855.50692718H141.90642105l222.25496164-245.81940722 87.0593347 86.03669649c12.80105134 12.80676323 30.21253651 18.95020139 47.11555999 17.4172 17.40958218-1.53871621 33.79652618-11.26614404 45.06267018-26.11818071l172.58376063-238.64762047 216.11152349 236.08817198 2.05098681-1.54062067v142.87778132c0.50846167 16.3907529-13.31522639 29.70597929-30.21444096 29.70597928z m0 0" p-id="1916"></path>
<path d="M318.07226687 509.82713538c79.88945091 0 144.41649754-65.03741277 144.41649754-144.41649753 0-79.37718032-64.52704663-144.92495923-144.41649754-144.92495922-79.89135536 0-144.41649754 64.52704663-144.41649756 144.41268862 0 79.89135536 64.52514218 144.92876814 144.41649756 144.92876813z m0-225.3266807c44.55230407 0 80.91208763 36.36168802 80.91208762 80.91018317 0 44.55611297-35.84751297 81.43007159-80.91208762 81.43007012-45.06838356 0-80.91589654-36.35978356-80.91589508-80.91589507 0-44.55611297 36.87205415-81.42435823 80.91589508-81.42435822z m0 0" p-id="1917"></path>
</svg>
</a>
<div class="information" style="margin-bottom: 0;">
<a class="abstract" href="<?php $this->permalink() ?>" title="文章摘要"><?php _getAbstract($this) ?></a>
</div>
</li>
<?php elseif ($this->fields->mode === "multiple") : ?>
<li class="joe_list__item wow multiple">
<div class="line"></div>
<div class="information">
<a href="<?php $this->permalink() ?>" class="title" title="<?php $this->title() ?>">
<h6><?php $this->title() ?></h6>
</a>
<a class="abstract" href="<?php $this->permalink() ?>" title="文章摘要"><?php _getAbstract($this) ?></a>
</div>
<a href="<?php $this->permalink() ?>" class="thumbnail" title="<?php $this->title() ?>">
<?php $image = _getThumbnails($this) ?>
<?php for ($x = 0; $x < 3; $x++) : ?>
<img class="lazyload" src="<?php _getLazyload() ?>" data-src="<?php echo $image[$x]; ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $this->title() ?>" />
<?php endfor; ?>
</a> </a>
<a class="abstract" href="<?php $this->permalink() ?>" title="文章摘要"><?php _getAbstract($this) ?></a>
<div class="meta"> <div class="meta">
<ul class="items"> <ul class="items">
<li><?php $this->date('Y年m月d日'); ?></li> <li><?php $this->date('Y年m月d日'); ?></li>
@ -56,8 +110,26 @@
<li><?php _getAgree($this) ?> 点赞</li> <li><?php _getAgree($this) ?> 点赞</li>
</ul> </ul>
</div> </div>
</div> </li>
</li> <?php else : ?>
<li class="joe_list__item wow none">
<div class="line"></div>
<div class="information">
<a href="<?php $this->permalink() ?>" class="title" title="<?php $this->title() ?>">
<h6><?php $this->title() ?></h6>
</a>
<a class="abstract" href="<?php $this->permalink() ?>" title="文章摘要"><?php _getAbstract($this) ?></a>
<div class="meta">
<ul class="items">
<li><?php $this->date('Y年m月d日'); ?></li>
<li><?php _getViews($this) ?> 阅读</li>
<li><?php $this->commentsNum('%d'); ?> 评论</li>
<li><?php _getAgree($this) ?> 点赞</li>
</ul>
</div>
</div>
</li>
<?php endif; ?>
<?php endwhile; ?> <?php endwhile; ?>
</ul> </ul>
<?php else : ?> <?php else : ?>

File diff suppressed because one or more lines are too long

View File

@ -836,24 +836,54 @@
.joe_list { .joe_list {
&__item { &__item {
display: flex;
position: relative; position: relative;
width: 100%; width: 100%;
padding: 15px 0;
border-bottom: 1px solid var(--classC); border-bottom: 1px solid var(--classC);
padding: 15px 0;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
&:hover { .information .title {
.line { display: flex;
transform: scaleY(1); align-items: center;
margin-bottom: 10px;
.badge {
height: 20px;
line-height: 20px;
background-image: -webkit-linear-gradient(0deg, #3ca5f6 0%, #a86af9 100%);
color: #fff;
font-size: 12px;
margin-right: 5px;
border-radius: 2px;
padding: 0 8px;
white-space: nowrap;
} }
.thumbnail { h6 {
time { color: var(--main);
transform: translate3d(0, 0, 0); white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 18px;
line-height: 24px;
transition: color 0.35s;
&:hover {
color: var(--theme);
} }
} }
} }
.information .abstract {
display: -webkit-box;
-webkit-line-clamp: 2;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
/* autoprefixer: on */
overflow: hidden;
text-overflow: ellipsis;
color: var(--minor);
word-break: break-all;
line-height: 26px;
opacity: 0.85;
}
.line { .line {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
@ -866,134 +896,188 @@
transform: scaleY(0); transform: scaleY(0);
transition: transform 0.35s; transition: transform 0.35s;
} }
.thumbnail { .meta {
position: relative;
width: 210px;
height: 140px;
min-width: 210px;
min-height: 140px;
margin-right: 15px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: var(--radius-inner);
transition: opacity 0.35s;
&:hover {
opacity: 0.85;
}
}
time {
position: absolute;
z-index: 1;
top: 5px;
right: 5px;
background: var(--theme);
height: 20px;
line-height: 20px;
padding: 0 8px;
color: #fff;
font-size: 12px;
border-radius: 10px;
transition: transform 0.35s;
transform: translate3d(120%, 0, 0);
}
svg {
position: absolute;
z-index: 1;
top: 5px;
left: 5px;
width: 20px;
height: 20px;
fill: #fff;
}
}
.information {
display: flex; display: flex;
flex-direction: column; align-items: center;
flex: 1; margin-top: auto;
min-width: 0; color: var(--minor);
.title { font-size: 13px;
.items {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 10px; li {
.badge { &::after {
height: 20px; content: '/';
line-height: 20px; color: #e1e1e1;
background-image: -webkit-linear-gradient(0deg, #3ca5f6 0%, #a86af9 100%); padding: 0 5px;
color: #fff; }
font-size: 12px; &:last-child::after {
margin-right: 5px; display: none;
border-radius: 2px; }
padding: 0 8px;
white-space: nowrap;
} }
h6 { }
color: var(--main); .last {
white-space: nowrap; margin-left: auto;
overflow: hidden; display: flex;
text-overflow: ellipsis; align-items: center;
font-size: 18px; .icon {
line-height: 24px; margin-right: 3px;
transition: color 0.35s; }
.link {
color: var(--minor);
&:hover { &:hover {
color: var(--theme); color: var(--theme);
} }
} }
} }
.abstract { }
display: -webkit-box; &:hover .line {
-webkit-line-clamp: 2; transform: scaleY(1);
/*! autoprefixer: off */ }
-webkit-box-orient: vertical; &.default {
/* autoprefixer: on */ display: flex;
overflow: hidden; position: relative;
text-overflow: ellipsis; &:hover {
color: var(--minor); .thumbnail {
transition: opacity 0.35s; img {
word-break: break-all; opacity: 0.8;
line-height: 24px; }
&:hover { time {
opacity: 0.8; transform: translate3d(0, 0, 0);
}
} }
} }
.meta { .thumbnail {
position: relative;
width: 210px;
height: 140px;
min-width: 210px;
min-height: 140px;
margin-right: 15px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: var(--radius-inner);
transition: opacity 0.35s;
}
time {
position: absolute;
z-index: 1;
top: 5px;
right: 5px;
background: var(--theme);
height: 20px;
line-height: 20px;
padding: 0 8px;
color: #fff;
font-size: 12px;
border-radius: 10px;
transition: transform 0.35s;
transform: translate3d(120%, 0, 0);
}
svg {
position: absolute;
z-index: 1;
top: 5px;
left: 5px;
width: 20px;
height: 20px;
fill: #fff;
}
}
.information {
display: flex; display: flex;
align-items: center; flex-direction: column;
margin-top: auto; flex: 1;
color: var(--minor); min-width: 0;
font-size: 13px; }
.items { }
display: flex; &.single {
align-items: center; &:hover {
li { .thumbnail {
&::after { img {
content: '/'; opacity: 0.8;
color: #e1e1e1; }
padding: 0 5px; time {
} transform: translate3d(0, 0, 0);
&:last-child::after {
display: none;
}
} }
} }
.last { }
margin-left: auto; .information {
display: flex; margin-bottom: 10px;
align-items: center; }
.icon { .thumbnail {
margin-right: 3px; display: block;
} position: relative;
.link { width: 100%;
color: var(--minor); height: 280px;
&:hover { overflow: hidden;
color: var(--theme); margin-bottom: 10px;
} img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: var(--radius-inner);
transition: opacity 0.35s;
}
time {
position: absolute;
z-index: 1;
top: 10px;
right: 10px;
background: var(--theme);
height: 20px;
line-height: 20px;
padding: 0 8px;
color: #fff;
font-size: 12px;
border-radius: 10px;
transition: transform 0.35s;
transform: translate3d(120%, 0, 0);
}
svg {
position: absolute;
z-index: 1;
top: 10px;
left: 10px;
width: 20px;
height: 20px;
fill: #fff;
}
}
}
&.multiple {
.information {
margin-bottom: 10px;
}
.thumbnail {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 180px;
gap: 10px;
margin-bottom: 10px;
img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.35s, opacity 0.35s;
border-radius: var(--radius-inner);
&:hover {
transform: scale(1.025);
opacity: 0.85;
} }
} }
} }
} }
&.none {
.information {
display: flex;
flex-direction: column;
height: 140px;
}
}
} }
&__loading { &__loading {
.item { .item {

View File

@ -1,115 +1,220 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
/* 激活轮播图功能 */ /* 激活轮播图功能 */
{ {
if ($('.joe_index__banner .swiper-container').length !== 0) { if ($('.joe_index__banner .swiper-container').length !== 0) {
let direction = 'horizontal'; let direction = 'horizontal'
if (!Joe.IS_MOBILE && $('.joe_index__banner-recommend .item').length === 2) direction = 'vertical'; if (!Joe.IS_MOBILE && $('.joe_index__banner-recommend .item').length === 2) direction = 'vertical'
new Swiper('.swiper-container', { new Swiper('.swiper-container', {
keyboard: true, keyboard: true,
direction, direction,
loop: true, loop: true,
autoplay: true, autoplay: true,
mousewheel: true, mousewheel: true,
pagination: { el: '.swiper-pagination' }, pagination: { el: '.swiper-pagination' },
navigation: { navigation: {
nextEl: '.swiper-button-next', nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev' prevEl: '.swiper-button-prev'
} }
}); })
} }
} }
/* 初始化首页列表功能 */ /* 初始化首页列表功能 */
{ {
let queryData = { page: 1, pageSize: 12, type: 'created' }; const getListMode = _ => {
const initDom = () => { if (_.mode === 'default') {
$('.joe_index__list .joe_list').html(''); return `
let activeItem = $('.joe_index__title-title .item[data-type="' + queryData.type + '"]'); <li class="joe_list__item wow default">
let activeLine = $('.joe_index__title-title .line'); <div class="line"></div>
activeItem.addClass('active').siblings().removeClass('active'); <a href="${_.permalink}" class="thumbnail" title="${_.title}">
activeLine.css({ left: activeItem.position().left, width: activeItem.width() }); <img class="lazyload" src="${_.lazyload}" data-src="${_.image[0]}" onerror="javascript: this.src='${_.lazyload}';" alt="${_.title}" />
}; <time datetime="${_.time}">${_.time}</time>
const pushDom = () => { <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20">
return new Promise((reslove, reject) => { <path d="M903.93077753 107.30625876H115.78633587C64.57261118 107.30625876 22.58166006 149.81138495 22.58166006 201.02510964v624.26547214c0 51.7240923 41.99095114 93.71694641 93.71694641 93.7169464h788.14444164c51.7202834 0 93.71694641-41.99285557 93.71694642-93.7169464v-624.26547214c-0.51227057-51.21372469-43.01739676-93.71885088-94.229217-93.71885088zM115.78633587 171.8333054h788.65671224c16.385041 0 29.70407483 13.31522639 29.70407484 29.70407482v390.22828696l-173.60830179-189.48107072c-12.80486025-13.82749697-30.21634542-21.50774542-48.14010264-19.97093513-17.92375723 1.02073227-34.82106734 10.75387344-46.60138495 26.11437327l-172.58185762 239.1598896-87.06123767-85.52061846c-12.28878076-11.78222353-27.65308802-17.92375723-44.03812902-17.92375577-16.3907529 0.50846167-31.75506163 7.67644101-43.52966736 20.48129978L86.59453164 821.70468765V202.04965083c-1.02454117-17.41529409 12.80486025-30.73052046 29.19180423-30.21634543zM903.93077753 855.50692718H141.90642105l222.25496164-245.81940722 87.0593347 86.03669649c12.80105134 12.80676323 30.21253651 18.95020139 47.11555999 17.4172 17.40958218-1.53871621 33.79652618-11.26614404 45.06267018-26.11818071l172.58376063-238.64762047 216.11152349 236.08817198 2.05098681-1.54062067v142.87778132c0.50846167 16.3907529-13.31522639 29.70597929-30.21444096 29.70597928z m0 0" p-id="1916"></path>
$('.joe_load').attr('loading', true); <path d="M318.07226687 509.82713538c79.88945091 0 144.41649754-65.03741277 144.41649754-144.41649753 0-79.37718032-64.52704663-144.92495923-144.41649754-144.92495922-79.89135536 0-144.41649754 64.52704663-144.41649756 144.41268862 0 79.89135536 64.52514218 144.92876814 144.41649756 144.92876813z m0-225.3266807c44.55230407 0 80.91208763 36.36168802 80.91208762 80.91018317 0 44.55611297-35.84751297 81.43007159-80.91208762 81.43007012-45.06838356 0-80.91589654-36.35978356-80.91589508-80.91589507 0-44.55611297 36.87205415-81.42435823 80.91589508-81.42435822z m0 0" p-id="1917"></path>
$('.joe_load').html('加载中'); </svg>
$('.joe_index__list .joe_list__loading').show(); </a>
$.ajax({ <div class="information">
url: Joe.BASE_API, <a href="${_.permalink}" class="title" title="${_.title}">
type: 'POST', <span class="badge" style="display: ${_.type === 'sticky' ? 'block' : 'none'}">置顶</span>
data: { routeType: 'publish_list', page: queryData.page, pageSize: queryData.pageSize, type: queryData.type }, <h6>${_.title}</h6>
success(res) { </a>
if (res.data.length === 0) { <a class="abstract" href="${_.permalink}" title="文章摘要">${_.abstract}</a>
$('.joe_load').remove(); <div class="meta">
$('.joe_index__list .joe_list__loading').hide(); <ul class="items">
return; <li>${_.created}</li>
} <li>${_.views} 阅读</li>
res.data.forEach(_ => { <li>${_.commentsNum} 评论</li>
$('.joe_index__list .joe_list').append(` <li>${_.agree} 点赞</li>
<li class="joe_list__item wow"> </ul>
<div class="line"></div> <div class="last" style="display: ${_.category.length ? 'flex' : 'none'}">
<a href="${_.permalink}" class="thumbnail" title="${_.title}"> <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
<img class="lazyload" src="${_.lazyload}" data-src="${_.image}" onerror="javascript: this.src='${_.lazyload}';" alt="${_.title}" /> <path d="M512.200568 564.743248a76.81755 76.81755 0 0 1-30.973432-6.508227L108.22384 393.876696c-26.104541-11.508102-42.559305-35.754319-42.926671-63.272046-0.38374-27.439956 15.355733-52.052516 41.041741-64.231907L479.343229 89.632413c20.590967-9.736758 45.159526-9.754155 65.750493 0.017396l372.585787 176.739307c25.668613 12.1886 41.390689 36.792974 41.024346 64.231907-0.38374 27.500331-16.821107 51.729152-42.908252 63.237253L543.226189 558.235021a77.180823 77.180823 0 0 1-31.025621 6.508227zM139.841955 329.591577l370.21274 163.241898c1.291412 0.558725 3.018753 0.566912 4.344958-0.00921l369.758392-163.128311-369.706203-175.464267v-0.00921c-1.326205-0.62831-3.157923-0.636496-4.501524 0L139.841955 329.591577z m748.015342 1.858324h0.174985-0.174985zM512.375553 941.673993c-10.347672 0-20.799722-2.320858-30.53648-6.997368L121.048937 778.624477c-18.11252-7.834432-26.453489-28.870538-18.619056-46.983058 7.834432-18.11252 28.861328-26.488281 46.992267-18.609846L511.502673 869.659843l345.259418-156.366304c17.938558-8.165983 39.139415-0.252757 47.323819 17.746176 8.165983 17.96414 0.227174 39.156812-17.72878 47.323819L541.847795 934.973384c-9.196453 4.449335-19.282159 6.700609-29.472242 6.700609z" fill="#444444" p-id="37980"></path><path d="M871.563192 515.448542l-359.753527 156.326395-359.451652-155.987681v73.577763c0 13.701047 8.165983 26.084075 20.759813 31.479968L474.636021 750.035348c11.805884 5.702885 24.498974 8.54563 37.174667 8.54563s25.367761-2.842745 37.174668-8.54563l301.834396-129.501446a34.248012 34.248012 0 0 0 20.744463-31.473829v-73.611531z" fill="#ff6a18" p-id="37981"></path>
<time datetime="${_.time}">${_.time}</time> </svg>
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20"> <a class="link" rel="nofollow" href="${_.category.length && _.category[0].permalink}">${_.category.length && _.category[0].name}</a>
<path d="M903.93077753 107.30625876H115.78633587C64.57261118 107.30625876 22.58166006 149.81138495 22.58166006 201.02510964v624.26547214c0 51.7240923 41.99095114 93.71694641 93.71694641 93.7169464h788.14444164c51.7202834 0 93.71694641-41.99285557 93.71694642-93.7169464v-624.26547214c-0.51227057-51.21372469-43.01739676-93.71885088-94.229217-93.71885088zM115.78633587 171.8333054h788.65671224c16.385041 0 29.70407483 13.31522639 29.70407484 29.70407482v390.22828696l-173.60830179-189.48107072c-12.80486025-13.82749697-30.21634542-21.50774542-48.14010264-19.97093513-17.92375723 1.02073227-34.82106734 10.75387344-46.60138495 26.11437327l-172.58185762 239.1598896-87.06123767-85.52061846c-12.28878076-11.78222353-27.65308802-17.92375723-44.03812902-17.92375577-16.3907529 0.50846167-31.75506163 7.67644101-43.52966736 20.48129978L86.59453164 821.70468765V202.04965083c-1.02454117-17.41529409 12.80486025-30.73052046 29.19180423-30.21634543zM903.93077753 855.50692718H141.90642105l222.25496164-245.81940722 87.0593347 86.03669649c12.80105134 12.80676323 30.21253651 18.95020139 47.11555999 17.4172 17.40958218-1.53871621 33.79652618-11.26614404 45.06267018-26.11818071l172.58376063-238.64762047 216.11152349 236.08817198 2.05098681-1.54062067v142.87778132c0.50846167 16.3907529-13.31522639 29.70597929-30.21444096 29.70597928z m0 0" p-id="1916"></path> </div>
<path d="M318.07226687 509.82713538c79.88945091 0 144.41649754-65.03741277 144.41649754-144.41649753 0-79.37718032-64.52704663-144.92495923-144.41649754-144.92495922-79.89135536 0-144.41649754 64.52704663-144.41649756 144.41268862 0 79.89135536 64.52514218 144.92876814 144.41649756 144.92876813z m0-225.3266807c44.55230407 0 80.91208763 36.36168802 80.91208762 80.91018317 0 44.55611297-35.84751297 81.43007159-80.91208762 81.43007012-45.06838356 0-80.91589654-36.35978356-80.91589508-80.91589507 0-44.55611297 36.87205415-81.42435823 80.91589508-81.42435822z m0 0" p-id="1917"></path> </div>
</svg> </div>
</a> </li>
<div class="information"> `
<a href="${_.permalink}" class="title" title="${_.title}"> } else if (_.mode === 'single') {
<span class="badge" style="display: ${_.type === 'sticky' ? 'block' : 'none'}">置顶</span> return `
<h6>${_.title}</h6> <li class="joe_list__item wow single">
</a> <div class="line"></div>
<a class="abstract" href="${_.permalink}" title="文章摘要">${_.abstract}</a> <div class="information">
<div class="meta"> <a href="${_.permalink}" class="title" title="${_.title}">
<ul class="items"> <span class="badge" style="display: ${_.type === 'sticky' ? 'block' : 'none'}">置顶</span>
<li>${_.created}</li> <h6>${_.title}</h6>
<li>${_.views} 阅读</li> </a>
<li>${_.commentsNum} 评论</li> <div class="meta">
<li>${_.agree} 点赞</li> <ul class="items">
</ul> <li>${_.created}</li>
<div class="last" style="display: ${_.category.length ? 'flex' : 'none'}"> <li>${_.views} 阅读</li>
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15"> <li>${_.commentsNum} 评论</li>
<path d="M512.200568 564.743248a76.81755 76.81755 0 0 1-30.973432-6.508227L108.22384 393.876696c-26.104541-11.508102-42.559305-35.754319-42.926671-63.272046-0.38374-27.439956 15.355733-52.052516 41.041741-64.231907L479.343229 89.632413c20.590967-9.736758 45.159526-9.754155 65.750493 0.017396l372.585787 176.739307c25.668613 12.1886 41.390689 36.792974 41.024346 64.231907-0.38374 27.500331-16.821107 51.729152-42.908252 63.237253L543.226189 558.235021a77.180823 77.180823 0 0 1-31.025621 6.508227zM139.841955 329.591577l370.21274 163.241898c1.291412 0.558725 3.018753 0.566912 4.344958-0.00921l369.758392-163.128311-369.706203-175.464267v-0.00921c-1.326205-0.62831-3.157923-0.636496-4.501524 0L139.841955 329.591577z m748.015342 1.858324h0.174985-0.174985zM512.375553 941.673993c-10.347672 0-20.799722-2.320858-30.53648-6.997368L121.048937 778.624477c-18.11252-7.834432-26.453489-28.870538-18.619056-46.983058 7.834432-18.11252 28.861328-26.488281 46.992267-18.609846L511.502673 869.659843l345.259418-156.366304c17.938558-8.165983 39.139415-0.252757 47.323819 17.746176 8.165983 17.96414 0.227174 39.156812-17.72878 47.323819L541.847795 934.973384c-9.196453 4.449335-19.282159 6.700609-29.472242 6.700609z" fill="#444444" p-id="37980"></path><path d="M871.563192 515.448542l-359.753527 156.326395-359.451652-155.987681v73.577763c0 13.701047 8.165983 26.084075 20.759813 31.479968L474.636021 750.035348c11.805884 5.702885 24.498974 8.54563 37.174667 8.54563s25.367761-2.842745 37.174668-8.54563l301.834396-129.501446a34.248012 34.248012 0 0 0 20.744463-31.473829v-73.611531z" fill="#ff6a18" p-id="37981"></path> <li>${_.agree} 点赞</li>
</svg> </ul>
<a class="link" rel="nofollow" href="${_.category.length && _.category[0].permalink}">${_.category.length && _.category[0].name}</a> <div class="last" style="display: ${_.category.length ? 'flex' : 'none'}">
</div> <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
</div> <path d="M512.200568 564.743248a76.81755 76.81755 0 0 1-30.973432-6.508227L108.22384 393.876696c-26.104541-11.508102-42.559305-35.754319-42.926671-63.272046-0.38374-27.439956 15.355733-52.052516 41.041741-64.231907L479.343229 89.632413c20.590967-9.736758 45.159526-9.754155 65.750493 0.017396l372.585787 176.739307c25.668613 12.1886 41.390689 36.792974 41.024346 64.231907-0.38374 27.500331-16.821107 51.729152-42.908252 63.237253L543.226189 558.235021a77.180823 77.180823 0 0 1-31.025621 6.508227zM139.841955 329.591577l370.21274 163.241898c1.291412 0.558725 3.018753 0.566912 4.344958-0.00921l369.758392-163.128311-369.706203-175.464267v-0.00921c-1.326205-0.62831-3.157923-0.636496-4.501524 0L139.841955 329.591577z m748.015342 1.858324h0.174985-0.174985zM512.375553 941.673993c-10.347672 0-20.799722-2.320858-30.53648-6.997368L121.048937 778.624477c-18.11252-7.834432-26.453489-28.870538-18.619056-46.983058 7.834432-18.11252 28.861328-26.488281 46.992267-18.609846L511.502673 869.659843l345.259418-156.366304c17.938558-8.165983 39.139415-0.252757 47.323819 17.746176 8.165983 17.96414 0.227174 39.156812-17.72878 47.323819L541.847795 934.973384c-9.196453 4.449335-19.282159 6.700609-29.472242 6.700609z" fill="#444444" p-id="37980"></path><path d="M871.563192 515.448542l-359.753527 156.326395-359.451652-155.987681v73.577763c0 13.701047 8.165983 26.084075 20.759813 31.479968L474.636021 750.035348c11.805884 5.702885 24.498974 8.54563 37.174667 8.54563s25.367761-2.842745 37.174668-8.54563l301.834396-129.501446a34.248012 34.248012 0 0 0 20.744463-31.473829v-73.611531z" fill="#ff6a18" p-id="37981"></path>
</div> </svg>
</li> <a class="link" rel="nofollow" href="${_.category.length && _.category[0].permalink}">${_.category.length && _.category[0].name}</a>
`); </div>
}); </div>
$('.joe_load').removeAttr('loading'); </div>
$('.joe_load').html('查看更多'); <a href="${_.permalink}" class="thumbnail" title="${_.title}">
$('.joe_index__list .joe_list__loading').hide(); <img class="lazyload" src="${_.lazyload}" data-src="${_.image[0]}" onerror="javascript: this.src='${_.lazyload}';" alt="${_.title}" />
reslove(res.data.length > 0 ? res.data.length - 1 : 0); <time datetime="${_.time}">${_.time}</time>
} <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20">
}); <path d="M903.93077753 107.30625876H115.78633587C64.57261118 107.30625876 22.58166006 149.81138495 22.58166006 201.02510964v624.26547214c0 51.7240923 41.99095114 93.71694641 93.71694641 93.7169464h788.14444164c51.7202834 0 93.71694641-41.99285557 93.71694642-93.7169464v-624.26547214c-0.51227057-51.21372469-43.01739676-93.71885088-94.229217-93.71885088zM115.78633587 171.8333054h788.65671224c16.385041 0 29.70407483 13.31522639 29.70407484 29.70407482v390.22828696l-173.60830179-189.48107072c-12.80486025-13.82749697-30.21634542-21.50774542-48.14010264-19.97093513-17.92375723 1.02073227-34.82106734 10.75387344-46.60138495 26.11437327l-172.58185762 239.1598896-87.06123767-85.52061846c-12.28878076-11.78222353-27.65308802-17.92375723-44.03812902-17.92375577-16.3907529 0.50846167-31.75506163 7.67644101-43.52966736 20.48129978L86.59453164 821.70468765V202.04965083c-1.02454117-17.41529409 12.80486025-30.73052046 29.19180423-30.21634543zM903.93077753 855.50692718H141.90642105l222.25496164-245.81940722 87.0593347 86.03669649c12.80105134 12.80676323 30.21253651 18.95020139 47.11555999 17.4172 17.40958218-1.53871621 33.79652618-11.26614404 45.06267018-26.11818071l172.58376063-238.64762047 216.11152349 236.08817198 2.05098681-1.54062067v142.87778132c0.50846167 16.3907529-13.31522639 29.70597929-30.21444096 29.70597928z m0 0" p-id="1916"></path>
}); <path d="M318.07226687 509.82713538c79.88945091 0 144.41649754-65.03741277 144.41649754-144.41649753 0-79.37718032-64.52704663-144.92495923-144.41649754-144.92495922-79.89135536 0-144.41649754 64.52704663-144.41649756 144.41268862 0 79.89135536 64.52514218 144.92876814 144.41649756 144.92876813z m0-225.3266807c44.55230407 0 80.91208763 36.36168802 80.91208762 80.91018317 0 44.55611297-35.84751297 81.43007159-80.91208762 81.43007012-45.06838356 0-80.91589654-36.35978356-80.91589508-80.91589507 0-44.55611297 36.87205415-81.42435823 80.91589508-81.42435822z m0 0" p-id="1917"></path>
}; </svg>
initDom(); </a>
pushDom(); <div class="information" style="margin-bottom: 0;">
$('.joe_index__title-title .item').on('click', async function () { <a class="abstract" href="${_.permalink}" title="文章摘要">${_.abstract}</a>
if ($(this).attr('data-type') === queryData.type) return; </div>
queryData = { page: 1, pageSize: 12, type: $(this).attr('data-type') }; </li>
initDom(); `
pushDom(); } else if (_.mode === 'multiple') {
}); return `
$('.joe_load').on('click', async function () { <li class="joe_list__item wow multiple">
if ($(this).attr('loading')) return; <div class="line"></div>
queryData.page++; <div class="information">
let length = await pushDom(); <a href="${_.permalink}" class="title" title="${_.title}">
length = $('.joe_index__list .joe_list .joe_list__item').length - length; <span class="badge" style="display: ${_.type === 'sticky' ? 'block' : 'none'}">置顶</span>
const queryElement = `.joe_index__list .joe_list .joe_list__item:nth-child(${length})`; <h6>${_.title}</h6>
const offset = $(queryElement).offset().top - $('.joe_header').height(); </a>
window.scrollTo({ top: offset - 15, behavior: 'smooth' }); <a class="abstract" href="${_.permalink}" title="文章摘要">${_.abstract}</a>
}); </div>
} <a href="${_.permalink}" class="thumbnail" title="${_.title}">
${_.image
.map((item, index) => {
if (index < 3) {
return `<img class="lazyload" src="${_.lazyload}" data-src="${item}" onerror="javascript: this.src='${_.lazyload}';" alt="${_.title}" />`
}
})
.join('')}
</a>
<div class="meta">
<ul class="items">
<li>${_.created}</li>
<li>${_.views} 阅读</li>
<li>${_.commentsNum} 评论</li>
<li>${_.agree} 点赞</li>
</ul>
<div class="last" style="display: ${_.category.length ? 'flex' : 'none'}">
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
<path d="M512.200568 564.743248a76.81755 76.81755 0 0 1-30.973432-6.508227L108.22384 393.876696c-26.104541-11.508102-42.559305-35.754319-42.926671-63.272046-0.38374-27.439956 15.355733-52.052516 41.041741-64.231907L479.343229 89.632413c20.590967-9.736758 45.159526-9.754155 65.750493 0.017396l372.585787 176.739307c25.668613 12.1886 41.390689 36.792974 41.024346 64.231907-0.38374 27.500331-16.821107 51.729152-42.908252 63.237253L543.226189 558.235021a77.180823 77.180823 0 0 1-31.025621 6.508227zM139.841955 329.591577l370.21274 163.241898c1.291412 0.558725 3.018753 0.566912 4.344958-0.00921l369.758392-163.128311-369.706203-175.464267v-0.00921c-1.326205-0.62831-3.157923-0.636496-4.501524 0L139.841955 329.591577z m748.015342 1.858324h0.174985-0.174985zM512.375553 941.673993c-10.347672 0-20.799722-2.320858-30.53648-6.997368L121.048937 778.624477c-18.11252-7.834432-26.453489-28.870538-18.619056-46.983058 7.834432-18.11252 28.861328-26.488281 46.992267-18.609846L511.502673 869.659843l345.259418-156.366304c17.938558-8.165983 39.139415-0.252757 47.323819 17.746176 8.165983 17.96414 0.227174 39.156812-17.72878 47.323819L541.847795 934.973384c-9.196453 4.449335-19.282159 6.700609-29.472242 6.700609z" fill="#444444" p-id="37980"></path><path d="M871.563192 515.448542l-359.753527 156.326395-359.451652-155.987681v73.577763c0 13.701047 8.165983 26.084075 20.759813 31.479968L474.636021 750.035348c11.805884 5.702885 24.498974 8.54563 37.174667 8.54563s25.367761-2.842745 37.174668-8.54563l301.834396-129.501446a34.248012 34.248012 0 0 0 20.744463-31.473829v-73.611531z" fill="#ff6a18" p-id="37981"></path>
</svg>
<a class="link" rel="nofollow" href="${_.category.length && _.category[0].permalink}">${_.category.length && _.category[0].name}</a>
</div>
</div>
</li>
`
} else {
return `
<li class="joe_list__item wow none">
<div class="line"></div>
<div class="information">
<a href="${_.permalink}" class="title" title="${_.title}">
<span class="badge" style="display: ${_.type === 'sticky' ? 'block' : 'none'}">置顶</span>
<h6>${_.title}</h6>
</a>
<a class="abstract" href="${_.permalink}" title="文章摘要">${_.abstract}</a>
<div class="meta">
<ul class="items">
<li>${_.created}</li>
<li>${_.views} 阅读</li>
<li>${_.commentsNum} 评论</li>
<li>${_.agree} 点赞</li>
</ul>
<div class="last" style="display: ${_.category.length ? 'flex' : 'none'}">
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
<path d="M512.200568 564.743248a76.81755 76.81755 0 0 1-30.973432-6.508227L108.22384 393.876696c-26.104541-11.508102-42.559305-35.754319-42.926671-63.272046-0.38374-27.439956 15.355733-52.052516 41.041741-64.231907L479.343229 89.632413c20.590967-9.736758 45.159526-9.754155 65.750493 0.017396l372.585787 176.739307c25.668613 12.1886 41.390689 36.792974 41.024346 64.231907-0.38374 27.500331-16.821107 51.729152-42.908252 63.237253L543.226189 558.235021a77.180823 77.180823 0 0 1-31.025621 6.508227zM139.841955 329.591577l370.21274 163.241898c1.291412 0.558725 3.018753 0.566912 4.344958-0.00921l369.758392-163.128311-369.706203-175.464267v-0.00921c-1.326205-0.62831-3.157923-0.636496-4.501524 0L139.841955 329.591577z m748.015342 1.858324h0.174985-0.174985zM512.375553 941.673993c-10.347672 0-20.799722-2.320858-30.53648-6.997368L121.048937 778.624477c-18.11252-7.834432-26.453489-28.870538-18.619056-46.983058 7.834432-18.11252 28.861328-26.488281 46.992267-18.609846L511.502673 869.659843l345.259418-156.366304c17.938558-8.165983 39.139415-0.252757 47.323819 17.746176 8.165983 17.96414 0.227174 39.156812-17.72878 47.323819L541.847795 934.973384c-9.196453 4.449335-19.282159 6.700609-29.472242 6.700609z" fill="#444444" p-id="37980"></path><path d="M871.563192 515.448542l-359.753527 156.326395-359.451652-155.987681v73.577763c0 13.701047 8.165983 26.084075 20.759813 31.479968L474.636021 750.035348c11.805884 5.702885 24.498974 8.54563 37.174667 8.54563s25.367761-2.842745 37.174668-8.54563l301.834396-129.501446a34.248012 34.248012 0 0 0 20.744463-31.473829v-73.611531z" fill="#ff6a18" p-id="37981"></path>
</svg>
<a class="link" rel="nofollow" href="${_.category.length && _.category[0].permalink}">${_.category.length && _.category[0].name}</a>
</div>
</div>
</div>
</li>
`
}
}
let queryData = { page: 1, pageSize: 12, type: 'created' }
const initDom = () => {
$('.joe_index__list .joe_list').html('')
let activeItem = $('.joe_index__title-title .item[data-type="' + queryData.type + '"]')
let activeLine = $('.joe_index__title-title .line')
activeItem.addClass('active').siblings().removeClass('active')
activeLine.css({ left: activeItem.position().left, width: activeItem.width() })
}
const pushDom = () => {
return new Promise((reslove, reject) => {
$('.joe_load').attr('loading', true)
$('.joe_load').html('加载中')
$('.joe_index__list .joe_list__loading').show()
$.ajax({
url: Joe.BASE_API,
type: 'POST',
data: { routeType: 'publish_list', page: queryData.page, pageSize: queryData.pageSize, type: queryData.type },
success(res) {
if (res.data.length === 0) {
$('.joe_load').remove()
$('.joe_index__list .joe_list__loading').hide()
return
}
res.data.forEach(_ => $('.joe_index__list .joe_list').append(getListMode(_)))
$('.joe_load').removeAttr('loading')
$('.joe_load').html('查看更多')
$('.joe_index__list .joe_list__loading').hide()
reslove(res.data.length > 0 ? res.data.length - 1 : 0)
}
})
})
}
initDom()
pushDom()
/* 激活列表特效 */ $('.joe_index__title-title .item').on('click', async function () {
{ if ($(this).attr('data-type') === queryData.type) return
const wow = $('.joe_index__list').attr('data-wow'); queryData = { page: 1, pageSize: 12, type: $(this).attr('data-type') }
if (wow !== 'off' && wow) new WOW({ boxClass: 'wow', animateClass: `animated ${wow}`, offset: 0, mobile: true, live: true, scrollContainer: null }).init(); initDom()
} pushDom()
}); })
$('.joe_load').on('click', async function () {
if ($(this).attr('loading')) return
queryData.page++
let length = await pushDom()
length = $('.joe_index__list .joe_list .joe_list__item').length - length
const queryElement = `.joe_index__list .joe_list .joe_list__item:nth-child(${length})`
const offset = $(queryElement).offset().top - $('.joe_header').height()
window.scrollTo({ top: offset - 15, behavior: 'smooth' })
})
}
/* 激活列表特效 */
{
const wow = $('.joe_index__list').attr('data-wow')
if (wow !== 'off' && wow) new WOW({ boxClass: 'wow', animateClass: `animated ${wow}`, offset: 0, mobile: true, live: true, scrollContainer: null }).init()
}
})

View File

@ -76,6 +76,21 @@ function themeInit($self)
/* 增加自定义字段 */ /* 增加自定义字段 */
function themeFields($layout) function themeFields($layout)
{ {
$mode = new Typecho_Widget_Helper_Form_Element_Radio(
'mode',
array(
'default' => '默认模式',
'single' => '大图模式',
'multiple' => '三图模式',
'none' => '无图模式'
),
'default',
'文章显示方式',
'介绍:用于设置当前文章在首页和搜索页的显示方式 <br />
注意:独立页面该功能不会生效'
);
$layout->addItem($mode);
$aside = new Typecho_Widget_Helper_Form_Element_Radio( $aside = new Typecho_Widget_Helper_Form_Element_Radio(
'aside', 'aside',
array( array(
@ -129,7 +144,8 @@ function themeFields($layout)
不填写时:<br> 不填写时:<br>
1、若文章有图片则取文章内图片 <br> 1、若文章有图片则取文章内图片 <br>
2、若文章无图片,并且外观设置里未填写·自定义缩略图·选项,则取模板自带图片 <br> 2、若文章无图片,并且外观设置里未填写·自定义缩略图·选项,则取模板自带图片 <br>
3、若文章无图片,并且外观设置里填写了·自定义缩略图·选项,则取自定义缩略图图片' 3、若文章无图片,并且外观设置里填写了·自定义缩略图·选项,则取自定义缩略图图片 <br>
注意:多个缩略图时换行填写,一行一个(仅在三图模式下生效)'
); );
$layout->addItem($thumb); $layout->addItem($thumb);
} }

View File

@ -188,35 +188,53 @@ function _getAbstract($item, $type = true)
$abstract = strip_tags($item->excerpt); $abstract = strip_tags($item->excerpt);
} }
} }
if ($abstract === '') $abstract = "暂无简介";
if ($type) echo $abstract; if ($type) echo $abstract;
else return $abstract; else return $abstract;
} }
/* 获取文章缩略图 */ /* 获取列表缩略图 */
function _getThumbnail($item, $type = true) function _getThumbnails($item)
{ {
$randomThumb = 'https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/thumb/' . rand(1, 42) . '.jpg'; $result = [];
$custom_thumbnail = Helper::options()->JThumbnail;
if ($custom_thumbnail) {
$custom_thumbnail_arr = explode("\r\n", $custom_thumbnail);
$randomThumb = $custom_thumbnail_arr[array_rand($custom_thumbnail_arr, 1)] . "?key=" . mt_rand(0, 1000000);
}
$pattern = '/\<img.*?src\=\"(.*?)\"[^>]*>/i'; $pattern = '/\<img.*?src\=\"(.*?)\"[^>]*>/i';
$patternMD = '/\!\[.*?\]\((http(s)?:\/\/.*?(jpg|jpeg|gif|png|webp))/i'; $patternMD = '/\!\[.*?\]\((http(s)?:\/\/.*?(jpg|jpeg|gif|png|webp))/i';
$patternMDfoot = '/\[.*?\]:\s*(http(s)?:\/\/.*?(jpg|jpeg|gif|png|webp))/i'; $patternMDfoot = '/\[.*?\]:\s*(http(s)?:\/\/.*?(jpg|jpeg|gif|png|webp))/i';
/* 如果填写了自定义缩略图,则优先显示填写的缩略图 */
if ($item->fields->thumb) { if ($item->fields->thumb) {
$randomThumb = $item->fields->thumb; $fields_thumb_arr = explode("\r\n", $item->fields->thumb);
} elseif (preg_match_all($pattern, $item->content, $thumbUrl)) { foreach ($fields_thumb_arr as $list) $result[] = $list;
$randomThumb = $thumbUrl[1][0];
} elseif (preg_match_all($patternMD, $item->content, $thumbUrl)) {
$randomThumb = $thumbUrl[1][0];
} elseif (preg_match_all($patternMDfoot, $item->content, $thumbUrl)) {
$randomThumb = $thumbUrl[1][0];
} }
if ($type) echo $randomThumb; /* 如果匹配到正则,则继续补充匹配到的图片 */
else return $randomThumb; if (preg_match_all($pattern, $item->content, $thumbUrl)) {
foreach ($thumbUrl[1] as $list) $result[] = $list;
}
if (preg_match_all($patternMD, $item->content, $thumbUrl)) {
foreach ($thumbUrl[1] as $list) $result[] = $list;
}
if (preg_match_all($patternMDfoot, $item->content, $thumbUrl)) {
foreach ($thumbUrl[1] as $list) $result[] = $list;
}
/* 如果上面的数量不足3个则直接补充3个随即图进去 */
if (sizeof($result) < 3) {
$custom_thumbnail = Helper::options()->JThumbnail;
/* 将for循环放里面减少一次if判断 */
if ($custom_thumbnail) {
$custom_thumbnail_arr = explode("\r\n", $custom_thumbnail);
for ($i = 0; $i < 3; $i++) {
$result[] = $custom_thumbnail_arr[array_rand($custom_thumbnail_arr, 1)] . "?key=" . mt_rand(0, 1000000);
}
} else {
for ($i = 0; $i < 3; $i++) {
$result[] = 'https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/thumb/' . rand(1, 42) . '.jpg';
}
}
}
return $result;
} }
/* 获取父级评论 */ /* 获取父级评论 */
function _getParentReply($parent) function _getParentReply($parent)
{ {

View File

@ -38,7 +38,8 @@ function _getPost($self)
foreach ($sticky_arr as $cid) { foreach ($sticky_arr as $cid) {
$self->widget('Widget_Archive@' . $cid, 'pageSize=1&type=post', 'cid=' . $cid)->to($item); $self->widget('Widget_Archive@' . $cid, 'pageSize=1&type=post', 'cid=' . $cid)->to($item);
$result[] = array( $result[] = array(
"image" => _getThumbnail($item, false), "mode" => $item->fields->mode ? $item->fields->mode : 'default',
"image" => _getThumbnails($item),
"time" => date('Y-m-d', $item->created), "time" => date('Y-m-d', $item->created),
"created" => date('Y年m月d日', $item->created), "created" => date('Y年m月d日', $item->created),
"title" => $item->title, "title" => $item->title,
@ -56,7 +57,8 @@ function _getPost($self)
$self->widget('Widget_Contents_Sort', 'page=' . $page . '&pageSize=' . $pageSize . '&type=' . $type)->to($item); $self->widget('Widget_Contents_Sort', 'page=' . $page . '&pageSize=' . $pageSize . '&type=' . $type)->to($item);
while ($item->next()) { while ($item->next()) {
$result[] = array( $result[] = array(
"image" => _getThumbnail($item, false), "mode" => $item->fields->mode ? $item->fields->mode : 'default',
"image" => _getThumbnails($item),
"time" => date('Y-m-d', $item->created), "time" => date('Y-m-d', $item->created),
"created" => date('Y年m月d日', $item->created), "created" => date('Y年m月d日', $item->created),
"title" => $item->title, "title" => $item->title,

View File

@ -77,7 +77,7 @@
<?php $this->widget('Widget_Archive@' . $cid, 'pageSize=1&type=post', 'cid=' . $cid)->to($item); ?> <?php $this->widget('Widget_Archive@' . $cid, 'pageSize=1&type=post', 'cid=' . $cid)->to($item); ?>
<figure class="item"> <figure class="item">
<a class="thumbnail" href="<?php $item->permalink() ?>" title="<?php $item->title() ?>"> <a class="thumbnail" href="<?php $item->permalink() ?>" title="<?php $item->title() ?>">
<img class="lazyload" src="<?php _getLazyload(); ?>" data-src="<?php _getThumbnail($item); ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $item->title() ?>" width="100%" /> <img class="lazyload" src="<?php _getLazyload(); ?>" data-src="<?php echo _getThumbnails($item)[0]; ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $item->title() ?>" width="100%" />
</a> </a>
<figcaption class="information"> <figcaption class="information">
<span class="information_type">推荐</span> <span class="information_type">推荐</span>
@ -98,7 +98,7 @@
<a class="link" href="<?php $item->permalink(); ?>" title="<?php $item->title(); ?>"> <a class="link" href="<?php $item->permalink(); ?>" title="<?php $item->title(); ?>">
<figure class="inner"> <figure class="inner">
<span class="views"><?php _getViews($item); ?></span> <span class="views"><?php _getViews($item); ?></span>
<img class="image lazyload" src="<?php _getLazyload(); ?>" data-src="<?php _getThumbnail($item); ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $item->title(); ?>" /> <img class="image lazyload" src="<?php _getLazyload(); ?>" data-src="<?php echo _getThumbnails($item)[0]; ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $item->title(); ?>" />
<figcaption class="title"><?php $item->title(); ?></figcaption> <figcaption class="title"><?php $item->title(); ?></figcaption>
</figure> </figure>
</a> </a>

View File

@ -57,7 +57,7 @@
<li class="item"> <li class="item">
<a class="link" href="<?php $item->permalink(); ?>" title="<?php $item->title(); ?>"> <a class="link" href="<?php $item->permalink(); ?>" title="<?php $item->title(); ?>">
<i class="sort"><?php echo $index; ?></i> <i class="sort"><?php echo $index; ?></i>
<img class="image lazyload" src="<?php _getLazyload(); ?>" data-src="<?php _getThumbnail($item); ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $item->title() ?>" /> <img class="image lazyload" src="<?php _getLazyload(); ?>" data-src="<?php echo _getThumbnails($item)[0]; ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?php $item->title() ?>" />
<div class="describe"> <div class="describe">
<h6><?php $item->title(); ?></h6> <h6><?php $item->title(); ?></h6>
<span><?php _getViews($item); ?> 阅读 - <?php $item->date('m/d'); ?></span> <span><?php _getViews($item); ?> 阅读 - <?php $item->date('m/d'); ?></span>