更新
This commit is contained in:
parent
2bdb1f2571
commit
1373783f54
76
archive.php
76
archive.php
@ -33,10 +33,11 @@
|
|||||||
<?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) : ?>
|
||||||
|
<li class="joe_list__item wow default">
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
<a href="<?php $this->permalink() ?>" class="thumbnail" title="<?php $this->title() ?>">
|
<a href="<?php $this->permalink() ?>" class="thumbnail" title="<?php $this->title() ?>">
|
||||||
<img class="lazyload" src="<?php _getLazyload() ?>" data-src="<?php _getThumbnail($this) ?>" onerror="javascript: this.src='<?php _getLazyload() ?>';" alt="<?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>
|
<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">
|
<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="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>
|
||||||
@ -58,6 +59,77 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</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>
|
||||||
|
<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>
|
||||||
|
</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
@ -836,85 +836,14 @@
|
|||||||
|
|
||||||
.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 {
|
|
||||||
transform: scaleY(1);
|
|
||||||
}
|
|
||||||
.thumbnail {
|
|
||||||
time {
|
|
||||||
transform: translate3d(0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.line {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
top: 15px;
|
|
||||||
left: -15px;
|
|
||||||
width: 4px;
|
|
||||||
height: 25px;
|
|
||||||
border-radius: 2px;
|
|
||||||
background: var(--theme);
|
|
||||||
transform: scaleY(0);
|
|
||||||
transition: transform 0.35s;
|
|
||||||
}
|
|
||||||
.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;
|
|
||||||
&: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;
|
|
||||||
flex-direction: column;
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
.title {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@ -942,7 +871,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.abstract {
|
.information .abstract {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 2;
|
||||||
/*! autoprefixer: off */
|
/*! autoprefixer: off */
|
||||||
@ -951,12 +880,21 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
color: var(--minor);
|
color: var(--minor);
|
||||||
transition: opacity 0.35s;
|
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
line-height: 24px;
|
line-height: 26px;
|
||||||
&:hover {
|
opacity: 0.85;
|
||||||
opacity: 0.8;
|
|
||||||
}
|
}
|
||||||
|
.line {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
top: 15px;
|
||||||
|
left: -15px;
|
||||||
|
width: 4px;
|
||||||
|
height: 25px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background: var(--theme);
|
||||||
|
transform: scaleY(0);
|
||||||
|
transition: transform 0.35s;
|
||||||
}
|
}
|
||||||
.meta {
|
.meta {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -993,6 +931,152 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&:hover .line {
|
||||||
|
transform: scaleY(1);
|
||||||
|
}
|
||||||
|
&.default {
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
&:hover {
|
||||||
|
.thumbnail {
|
||||||
|
img {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
time {
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.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;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.single {
|
||||||
|
&:hover {
|
||||||
|
.thumbnail {
|
||||||
|
img {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
time {
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.information {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.thumbnail {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 280px;
|
||||||
|
overflow: hidden;
|
||||||
|
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 {
|
||||||
|
@ -2,8 +2,8 @@ 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,
|
||||||
@ -15,41 +15,19 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
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');
|
|
||||||
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(`
|
|
||||||
<li class="joe_list__item wow">
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
<a href="${_.permalink}" class="thumbnail" title="${_.title}">
|
<a href="${_.permalink}" class="thumbnail" title="${_.title}">
|
||||||
<img class="lazyload" src="${_.lazyload}" data-src="${_.image}" onerror="javascript: this.src='${_.lazyload}';" alt="${_.title}" />
|
<img class="lazyload" src="${_.lazyload}" data-src="${_.image[0]}" onerror="javascript: this.src='${_.lazyload}';" alt="${_.title}" />
|
||||||
<time datetime="${_.time}">${_.time}</time>
|
<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">
|
<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="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>
|
||||||
@ -78,38 +56,165 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
`);
|
`
|
||||||
});
|
} else if (_.mode === 'single') {
|
||||||
$('.joe_load').removeAttr('loading');
|
return `
|
||||||
$('.joe_load').html('查看更多');
|
<li class="joe_list__item wow single">
|
||||||
$('.joe_index__list .joe_list__loading').hide();
|
<div class="line"></div>
|
||||||
reslove(res.data.length > 0 ? res.data.length - 1 : 0);
|
<div class="information">
|
||||||
|
<a href="${_.permalink}" class="title" title="${_.title}">
|
||||||
|
<span class="badge" style="display: ${_.type === 'sticky' ? 'block' : 'none'}">置顶</span>
|
||||||
|
<h6>${_.title}</h6>
|
||||||
|
</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>
|
||||||
|
<a href="${_.permalink}" class="thumbnail" title="${_.title}">
|
||||||
|
<img class="lazyload" src="${_.lazyload}" data-src="${_.image[0]}" onerror="javascript: this.src='${_.lazyload}';" alt="${_.title}" />
|
||||||
|
<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>
|
||||||
|
</a>
|
||||||
|
<div class="information" style="margin-bottom: 0;">
|
||||||
|
<a class="abstract" href="${_.permalink}" title="文章摘要">${_.abstract}</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
`
|
||||||
|
} else if (_.mode === 'multiple') {
|
||||||
|
return `
|
||||||
|
<li class="joe_list__item wow multiple">
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
initDom();
|
<div class="meta">
|
||||||
pushDom();
|
<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 () {
|
$('.joe_index__title-title .item').on('click', async function () {
|
||||||
if ($(this).attr('data-type') === queryData.type) return;
|
if ($(this).attr('data-type') === queryData.type) return
|
||||||
queryData = { page: 1, pageSize: 12, type: $(this).attr('data-type') };
|
queryData = { page: 1, pageSize: 12, type: $(this).attr('data-type') }
|
||||||
initDom();
|
initDom()
|
||||||
pushDom();
|
pushDom()
|
||||||
});
|
})
|
||||||
|
|
||||||
$('.joe_load').on('click', async function () {
|
$('.joe_load').on('click', async function () {
|
||||||
if ($(this).attr('loading')) return;
|
if ($(this).attr('loading')) return
|
||||||
queryData.page++;
|
queryData.page++
|
||||||
let length = await pushDom();
|
let length = await pushDom()
|
||||||
length = $('.joe_index__list .joe_list .joe_list__item').length - length;
|
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 queryElement = `.joe_index__list .joe_list .joe_list__item:nth-child(${length})`
|
||||||
const offset = $(queryElement).offset().top - $('.joe_header').height();
|
const offset = $(queryElement).offset().top - $('.joe_header').height()
|
||||||
window.scrollTo({ top: offset - 15, behavior: 'smooth' });
|
window.scrollTo({ top: offset - 15, behavior: 'smooth' })
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活列表特效 */
|
/* 激活列表特效 */
|
||||||
{
|
{
|
||||||
const wow = $('.joe_index__list').attr('data-wow');
|
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();
|
if (wow !== 'off' && wow) new WOW({ boxClass: 'wow', animateClass: `animated ${wow}`, offset: 0, mobile: true, live: true, scrollContainer: null }).init()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -188,34 +188,52 @@ 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)
|
||||||
|
@ -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,
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user