This commit is contained in:
杜恒 2021-01-22 13:03:35 +08:00
parent f370cea4eb
commit 51841acdc4
9 changed files with 1112 additions and 859 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
.joe_index{border-radius:8px;padding:0 15px;background:var(--background);box-shadow:var(--box-shadow);margin-bottom:15px}.joe_index__banner{padding-top:15px;display:flex}.joe_index__banner-recommend{width:270px;margin-left:15px;display:flex;flex-direction:column}.joe_index__banner-recommend.noswiper{width:100%;flex-direction:row;margin-left:0}.joe_index__banner-recommend.noswiper .item:first-child{margin-bottom:0;margin-right:7.5px}.joe_index__banner-recommend.noswiper .item:last-child{margin-left:7.5px}.joe_index__banner-recommend .item{position:relative;width:100%;height:160px;margin-bottom:15px;border-radius:5px;overflow:hidden}.joe_index__banner-recommend .item:last-child{margin-bottom:0}.joe_index__banner-recommend .item .thumbnail{display:block;width:100%;height:100%;transition:opacity 0.35s}.joe_index__banner-recommend .item .thumbnail img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.joe_index__banner-recommend .item .thumbnail:hover{opacity:0.85}.joe_index__banner-recommend .item .information{display:flex;align-items:center;position:absolute;z-index:1;bottom:0;left:0;right:0;padding:8px;background:linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.5));color:#fff;line-height:20px}.joe_index__banner-recommend .item .information_type{background-image:linear-gradient(to right, #fc712a, #f84c39);background-color:#f84c39;padding:0 5px;height:20px;border-radius:2px;margin-right:5px;font-size:12px}.joe_index__banner-recommend .item .information_title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;font-size:14px}.joe_index__hot{padding-top:15px}.joe_index__hot-list{display:flex;margin:0 -5px}.joe_index__hot-list .item{width:25%;padding:0 5px}.joe_index__hot-list .item .link{display:block}.joe_index__hot-list .item .link .inner{position:relative;cursor:pointer}.joe_index__hot-list .item .link .inner:hover .image{opacity:0.85}.joe_index__hot-list .item .link .inner:hover .title{background:var(--classC)}.joe_index__hot-list .item .link .inner .image{width:100%;height:125px;-o-object-fit:cover;object-fit:cover;border-radius:5px 5px 0 0;transition:opacity 0.35s}.joe_index__hot-list .item .link .inner .title{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center;padding:0 8px;line-height:32px;color:var(--minor);background:var(--classD);border-radius:0 0 5px 5px;transition:background 0.35s}.joe_index__hot-list .item .link .inner .views{display:flex;align-items:center;position:absolute;z-index:1;top:5px;right:5px;background-image:linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3);color:#fff;font-size:12px;height:18px;padding:0 8px;border-radius:2px;white-space:nowrap}.joe_index__title{display:flex;align-items:center;border-bottom:1px solid var(--classC)}.joe_index__title-title{position:relative;display:flex;align-items:center;color:var(--routine);font-weight:500;height:40px;line-height:40px}.joe_index__title-title .item{cursor:pointer;margin-right:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color 0.35s}.joe_index__title-title .item.active{color:var(--theme)}.joe_index__title-title .line{position:absolute;bottom:-1px;left:0;height:2px;border-radius:1px;background:var(--theme);transition:left 0.35s, width 0.35s}.swiper-container{min-width:0;flex:1;height:335px;--swiper-theme-color: #fff;border-radius:5px}.swiper-container .item{display:block;height:335px;border-radius:5px}.swiper-container .item .thumbnail{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;transition:opacity 0.35s}.swiper-container .item .thumbnail:hover{opacity:0.85}.swiper-container .item .title{position:absolute;z-index:1;left:0;right:0;bottom:0;text-align:center;background:linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.45));white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#fff;font-size:15px;padding:10px;font-weight:normal}.swiper-container .item .icon{position:absolute;z-index:1;top:10px;left:10px;width:18px;height:18px;fill:#fff;opacity:0.5}.swiper-container.swiper-container-horizontal .swiper-pagination-bullets{bottom:unset;left:unset;width:auto;right:10px;top:10px} .joe_index{border-radius:8px;padding:0 15px;background:var(--background);box-shadow:var(--box-shadow)}.joe_index__banner{padding-top:15px;display:flex}.joe_index__banner-recommend{width:270px;margin-left:15px;display:flex;flex-direction:column}.joe_index__banner-recommend.noswiper{width:100%;flex-direction:row;margin-left:0}.joe_index__banner-recommend.noswiper .item:first-child{margin-bottom:0;margin-right:7.5px}.joe_index__banner-recommend.noswiper .item:last-child{margin-left:7.5px}.joe_index__banner-recommend .item{position:relative;width:100%;height:160px;margin-bottom:15px;border-radius:5px;overflow:hidden}.joe_index__banner-recommend .item:last-child{margin-bottom:0}.joe_index__banner-recommend .item .thumbnail{display:block;width:100%;height:100%;transition:opacity 0.35s}.joe_index__banner-recommend .item .thumbnail img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.joe_index__banner-recommend .item .thumbnail:hover{opacity:0.85}.joe_index__banner-recommend .item .information{display:flex;align-items:center;position:absolute;z-index:1;bottom:0;left:0;right:0;padding:8px;background:linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.5));color:#fff;line-height:20px}.joe_index__banner-recommend .item .information_type{background-image:linear-gradient(to right, #fc712a, #f84c39);background-color:#f84c39;padding:0 5px;height:20px;border-radius:2px;margin-right:5px;font-size:12px}.joe_index__banner-recommend .item .information_title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;font-size:14px}.joe_index__hot{padding-top:15px}.joe_index__hot-list{display:flex;margin:0 -5px}.joe_index__hot-list .item{width:25%;padding:0 5px}.joe_index__hot-list .item .link{display:block}.joe_index__hot-list .item .link .inner{position:relative;cursor:pointer}.joe_index__hot-list .item .link .inner:hover .image{opacity:0.85}.joe_index__hot-list .item .link .inner:hover .title{background:var(--classC)}.joe_index__hot-list .item .link .inner .image{width:100%;height:125px;-o-object-fit:cover;object-fit:cover;border-radius:5px 5px 0 0;transition:opacity 0.35s}.joe_index__hot-list .item .link .inner .title{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center;padding:0 8px;line-height:32px;color:var(--minor);background:var(--classD);border-radius:0 0 5px 5px;transition:background 0.35s}.joe_index__hot-list .item .link .inner .views{display:flex;align-items:center;position:absolute;z-index:1;top:5px;right:5px;background-image:linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3);color:#fff;font-size:12px;height:18px;padding:0 8px;border-radius:2px;white-space:nowrap}.joe_index__title{display:flex;align-items:center;border-bottom:1px solid var(--classC)}.joe_index__title-title{position:relative;display:flex;align-items:center;color:var(--routine);font-weight:500;height:40px;line-height:40px}.joe_index__title-title .item{cursor:pointer;margin-right:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color 0.35s}.joe_index__title-title .item.active{color:var(--theme)}.joe_index__title-title .line{position:absolute;bottom:-1px;left:0;height:2px;border-radius:1px;background:var(--theme);transition:left 0.35s, width 0.35s}.swiper-container{min-width:0;flex:1;height:335px;--swiper-theme-color: #fff;border-radius:5px}.swiper-container .item{display:block;height:335px;border-radius:5px}.swiper-container .item .thumbnail{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;transition:opacity 0.35s}.swiper-container .item .thumbnail:hover{opacity:0.85}.swiper-container .item .title{position:absolute;z-index:1;left:0;right:0;bottom:0;text-align:center;background:linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.45));white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#fff;font-size:15px;padding:10px;font-weight:normal}.swiper-container .item .icon{position:absolute;z-index:1;top:10px;left:10px;width:18px;height:18px;fill:#fff;opacity:0.5}.swiper-container.swiper-container-horizontal .swiper-pagination-bullets{bottom:unset;left:unset;width:auto;right:10px;top:10px}

View File

@ -3,7 +3,6 @@
padding: 0 15px; padding: 0 15px;
background: var(--background); background: var(--background);
box-shadow: var(--box-shadow); box-shadow: var(--box-shadow);
margin-bottom: 15px;
&__banner { &__banner {
padding-top: 15px; padding-top: 15px;
display: flex; display: flex;
@ -175,6 +174,8 @@
} }
} }
.swiper-container { .swiper-container {
min-width: 0; min-width: 0;
flex: 1; flex: 1;

View File

@ -1,40 +1,45 @@
window.Joe = function () { window.Joe = function () {
/* 请求基准URL */
const BASE_API = '/index.php/joe/api'; const BASE_API = '/index.php/joe/api';
let IsMobile = false; /* 头部高度 */
if (/windows phone|iphone|android/gi.test(window.navigator.userAgent)) { const Header_Height = $('.joe_header').height();
IsMobile = true;
} else { /* 解决移动端Hover问题 */
IsMobile = false; document.addEventListener('touchstart', () => {});
}
/* 判断是否是手机 */
const IsMobile = /windows phone|iphone|android/gi.test(window.navigator.userAgent);
/* 设置侧边栏最后一个元素的高度 */
$('.joe_aside .joe_aside__item:last-child').css('top', Header_Height + 15);
/* Dropdown */ /* Dropdown */
{ $('.joe_dropdown').each(function (index, item) {
$('.joe_dropdown').each(function (index, item) { const menu = $(this).find('.joe_dropdown__menu');
const menu = $(this).find('.joe_dropdown__menu'); /* 弹出方式 */
/* 弹出方式 */ const trigger = $(item).attr('trigger') || 'click';
const trigger = $(item).attr('trigger') || 'click'; /* 弹出高度 */
/* 弹出高度 */ const placement = $(item).attr('placement') || $(this).height() || 0;
const placement = $(item).attr('placement') || $(this).height() || 0; /* 设置弹出高度 */
/* 设置弹出高度 */ menu.css('top', placement);
menu.css('top', placement); /* 如果是hover则绑定hover事件 */
/* 如果是hover则绑定hover事件 */ if (trigger === 'hover') {
if (trigger === 'hover') { $(this).hover(
$(this).hover( () => $(this).addClass('active'),
() => $(this).addClass('active'), () => $(this).removeClass('active')
() => $(this).removeClass('active') );
); } else {
} else { /* 否则绑定点击事件 */
/* 否则绑定点击事件 */ $(this).on('click', function (e) {
$(this).on('click', function (e) { $(this).toggleClass('active');
$(this).toggleClass('active'); $(document).one('click', () => $(this).removeClass('active'));
$(document).one('click', () => $(this).removeClass('active')); e.stopPropagation();
e.stopPropagation(); });
}); menu.on('click', e => e.stopPropagation());
menu.on('click', e => e.stopPropagation()); }
} });
});
}
/* Timelife */ /* Timelife */
if ($('.joe_aside__item.timelife').length !== 0) { if ($('.joe_aside__item.timelife').length !== 0) {
let timelife = [ let timelife = [
@ -107,9 +112,7 @@ window.Joe = function () {
$.ajax({ $.ajax({
url: BASE_API, url: BASE_API,
type: 'POST', type: 'POST',
data: { data: { routeType: 'ranking' },
routeType: 'ranking'
},
success(res) { success(res) {
$('.joe_aside__item.ranking .joe_aside__item-title .text').html(res.title); $('.joe_aside__item.ranking .joe_aside__item-title .text').html(res.title);
let htmlStr = ''; let htmlStr = '';
@ -137,59 +140,92 @@ window.Joe = function () {
new Swiper('.swiper-container', { direction, loop: true, autoplay: true, mousewheel: true, pagination: { el: '.swiper-pagination' } }); new Swiper('.swiper-container', { direction, loop: true, autoplay: true, mousewheel: true, pagination: { el: '.swiper-pagination' } });
} }
/* Index Title */ /* Index List */
if ($('.joe_index__list').length > 0) { if ($('.joe_index__list').length > 0) {
let queryData = { page: 1, pageSize: 10, type: 'created' }; let queryData = { page: 1, pageSize: 10, type: 'created' };
const initDom = () => { const initDom = () => {
$('.joe_index__list').html(''); $('.joe_index__list .joe_list').html('');
const activeItem = $(`.joe_index__title-title .item[data-type="${queryData.type}"]`); const activeItem = $(`.joe_index__title-title .item[data-type="${queryData.type}"]`);
const activeLine = $('.joe_index__title-title .line'); const activeLine = $('.joe_index__title-title .line');
activeItem.addClass('active').siblings().removeClass('active'); activeItem.addClass('active').siblings().removeClass('active');
activeLine.css({ left: activeItem.position().left, width: activeItem.width() }); activeLine.css({ left: activeItem.position().left, width: activeItem.width() });
}; };
const pushDom = () => { const pushDom = () => {
$.ajax({ return new Promise((reslove, reject) => {
url: BASE_API, $('.joe_load').attr('loading', true);
type: 'POST', $('.joe_load').html('加载中');
data: { $('.joe_index__list .joe_list__loading').show();
routeType: 'list', $.ajax({
page: queryData.page, url: BASE_API,
pageSize: queryData.pageSize, type: 'POST',
type: queryData.type data: { routeType: 'list', page: queryData.page, pageSize: queryData.pageSize, type: queryData.type },
}, success(res) {
success(res) { if (res.data.length === 0) {
res.data.forEach(_ => { $('.joe_load').remove();
$('.joe_index__list').append(` $('.joe_index__list .joe_list__loading').hide();
<li class="joe_list__list"> return;
<div class="line"></div> }
<a href="${_.permalink}" class="thumbnail" title="${_.title}"> res.data.forEach(_ => {
<img class="list_lazyload" src="${_.lazyload}" data-original="${_.image}" alt="${_.title}" /> $('.joe_index__list .joe_list').append(`
<time datetime="${_.time}">${_.time}</time> <li class="joe_list__item">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20"> <div class="line"></div>
<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> <a href="${_.permalink}" class="thumbnail" title="${_.title}">
<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> <img onerror="javascript: this.src='${_.lazyload}';" class="list_lazyload" src="${_.lazyload}" data-original="${_.image}" alt="${_.title}" />
</svg> <time datetime="${_.time}">${_.time}</time>
</a> <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20">
<div class="information"> <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>
<a href="${_.permalink}" class="title" title="${_.title}"> <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>
<h6>${_.title}</h6> </svg>
</a> </a>
<a class="abstract"></a> <div class="information">
</div> <a href="${_.permalink}" class="title" title="${_.title}">
</li> <h6>${_.title}</h6>
`); </a>
}); <a class="abstract" href="${_.permalink}" title="文章摘要">${_.abstract}</a>
new LazyLoad('.list_lazyload'); <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>
`);
});
$('.joe_load').removeAttr('loading');
$('.joe_load').html('查看更多');
$('.joe_index__list .joe_list__loading').hide();
new LazyLoad('.list_lazyload');
reslove(res.data.length > 0 ? res.data.length - 1 : 0);
}
});
}); });
}; };
initDom(); initDom();
pushDom(); pushDom();
$('.joe_index__title-title .item').on('click', function () { $('.joe_index__title-title .item').on('click', async function () {
if ($(this).attr('data-type') === queryData.type) return;
queryData = { page: 1, pageSize: 10, type: $(this).attr('data-type') }; queryData = { page: 1, pageSize: 10, type: $(this).attr('data-type') };
initDom(); initDom();
pushDom(); 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 - Header_Height;
window.scroll({ top: offset - 15, behavior: 'smooth' });
});
} }
new LazyLoad('.lazyload'); new LazyLoad('.lazyload');

15
assets/js/joe.smooth.js Normal file
View File

@ -0,0 +1,15 @@
(function(){function C(){if(!D&&document.body){D=!0;var a=document.body,b=document.documentElement,d=window.innerHeight,c=a.scrollHeight;l=0<=document.compatMode.indexOf("CSS")?b:a;m=a;f.keyboardSupport&&window.addEventListener("keydown",M,!1);if(top!=self)v=!0;else if(ca&&c>d&&(a.offsetHeight<=d||b.offsetHeight<=d)){var e=document.createElement("div");e.style.cssText="position:absolute; z-index:-10000; top:0; left:0; right:0; height:"+l.scrollHeight+"px";document.body.appendChild(e);var g;w=function(){g||
(g=setTimeout(function(){e.style.height="0";e.style.height=l.scrollHeight+"px";g=null},500))};setTimeout(w,10);window.addEventListener("resize",w,!1);z=new da(w);z.observe(a,{attributes:!0,childList:!0,characterData:!1});l.offsetHeight<=d&&(d=document.createElement("div"),d.style.clear="both",a.appendChild(d))}f.fixedBackground||(a.style.backgroundAttachment="scroll",b.style.backgroundAttachment="scroll")}}function N(a,b,d){ea(b,d);if(1!=f.accelerationMax){var c=Date.now()-E;c<f.accelerationDelta&&
(c=(1+50/c)/2,1<c&&(c=Math.min(c,f.accelerationMax),b*=c,d*=c));E=Date.now()}t.push({x:b,y:d,lastX:0>b?.99:-.99,lastY:0>d?.99:-.99,start:Date.now()});if(!F){c=O();var e=a===c||a===document.body;null==a.$scrollBehavior&&fa(a)&&(a.$scrollBehavior=a.style.scrollBehavior,a.style.scrollBehavior="auto");var g=function(c){c=Date.now();for(var k=0,l=0,h=0;h<t.length;h++){var n=t[h],p=c-n.start,m=p>=f.animationTime,q=m?1:p/f.animationTime;f.pulseAlgorithm&&(p=q,1<=p?q=1:0>=p?q=0:(1==f.pulseNormalize&&(f.pulseNormalize/=
P(1)),q=P(p)));p=n.x*q-n.lastX>>0;q=n.y*q-n.lastY>>0;k+=p;l+=q;n.lastX+=p;n.lastY+=q;m&&(t.splice(h,1),h--)}e?window.scrollBy(k,l):(k&&(a.scrollLeft+=k),l&&(a.scrollTop+=l));b||d||(t=[]);t.length?Q(g,a,1E3/f.frameRate+1):(F=!1,null!=a.$scrollBehavior&&(a.style.scrollBehavior=a.$scrollBehavior,a.$scrollBehavior=null))};Q(g,a,0);F=!0}}function R(a){D||C();var b=a.target;if(a.defaultPrevented||a.ctrlKey||r(m,"embed")||r(b,"embed")&&/\.pdf/i.test(b.src)||r(m,"object")||b.shadowRoot)return!0;var d=-a.wheelDeltaX||
a.deltaX||0,c=-a.wheelDeltaY||a.deltaY||0;ha&&(a.wheelDeltaX&&x(a.wheelDeltaX,120)&&(d=a.wheelDeltaX/Math.abs(a.wheelDeltaX)*-120),a.wheelDeltaY&&x(a.wheelDeltaY,120)&&(c=a.wheelDeltaY/Math.abs(a.wheelDeltaY)*-120));d||c||(c=-a.wheelDelta||0);1===a.deltaMode&&(d*=40,c*=40);b=S(b);if(!b)return v&&G?(Object.defineProperty(a,"target",{value:window.frameElement}),parent.wheel(a)):!0;if(ia(c))return!0;1.2<Math.abs(d)&&(d*=f.stepSize/120);1.2<Math.abs(c)&&(c*=f.stepSize/120);N(b,d,c);a.preventDefault();
T()}function M(a){var b=a.target,d=a.ctrlKey||a.altKey||a.metaKey||a.shiftKey&&a.keyCode!==g.spacebar;document.body.contains(m)||(m=document.activeElement);var c=/^(textarea|select|embed|object)$/i,e=/^(button|submit|radio|checkbox|file|color|image)$/i;if(!(c=a.defaultPrevented||c.test(b.nodeName)||r(b,"input")&&!e.test(b.type)||r(m,"video"))){c=a.target;var h=!1;if(-1!=document.URL.indexOf("www.youtube.com/watch")){do if(h=c.classList&&c.classList.contains("html5-video-controls"))break;while(c=c.parentNode)
}c=h}if(c||b.isContentEditable||d||(r(b,"button")||r(b,"input")&&e.test(b.type))&&a.keyCode===g.spacebar||r(b,"input")&&"radio"==b.type&&ja[a.keyCode])return!0;c=b=0;d=S(m);if(!d)return v&&G?parent.keydown(a):!0;e=d.clientHeight;d==document.body&&(e=window.innerHeight);switch(a.keyCode){case g.up:c=-f.arrowScroll;break;case g.down:c=f.arrowScroll;break;case g.spacebar:c=a.shiftKey?1:-1;c=-c*e*.9;break;case g.pageup:c=.9*-e;break;case g.pagedown:c=.9*e;break;case g.home:d==document.body&&document.scrollingElement&&
(d=document.scrollingElement);c=-d.scrollTop;break;case g.end:e=d.scrollHeight-d.scrollTop-e;c=0<e?e+10:0;break;case g.left:b=-f.arrowScroll;break;case g.right:b=f.arrowScroll;break;default:return!0}N(d,b,c);a.preventDefault();T()}function U(a){m=a.target}function T(){clearTimeout(V);V=setInterval(function(){W=H=A={}},1E3)}function I(a,b,d){d=d?W:H;for(var c=a.length;c--;)d[J(a[c])]=b;return b}function S(a){var b=[],d=document.body,c=l.scrollHeight;do{var e=H[J(a)];if(e)return I(b,e);b.push(a);if(c===
a.scrollHeight){if(e=X(l)&&X(d)||Y(l),v&&l.clientHeight+10<l.scrollHeight||!v&&e)return I(b,O())}else if(a.clientHeight+10<a.scrollHeight&&Y(a))return I(b,a)}while(a=a.parentElement)}function X(a){return"hidden"!==getComputedStyle(a,"").getPropertyValue("overflow-y")}function Y(a){a=getComputedStyle(a,"").getPropertyValue("overflow-y");return"scroll"===a||"auto"===a}function fa(a){var b=J(a);null==A[b]&&(a=getComputedStyle(a,"")["scroll-behavior"],A[b]="smooth"==a);return A[b]}function r(a,b){return a&&
(a.nodeName||"").toLowerCase()===b.toLowerCase()}function ea(a,b){a=0<a?1:-1;b=0<b?1:-1;if(B.x!==a||B.y!==b)B.x=a,B.y=b,t=[],E=0}function ia(a){if(a)return h.length||(h=[a,a,a]),a=Math.abs(a),h.push(a),h.shift(),clearTimeout(Z),Z=setTimeout(function(){try{localStorage.SS_deltaBuffer=h.join(",")}catch(b){}},1E3),a=120<a&&K(a),!K(120)&&!K(100)&&!a}function x(a,b){return Math.floor(a/b)==a/b}function K(a){return x(h[0],a)&&x(h[1],a)&&x(h[2],a)}function P(a){a*=f.pulseScale;if(1>a)var b=a-(1-Math.exp(-a));
else b=Math.exp(-1),a=1-Math.exp(-(a-1)),b+=a*(1-b);return b*f.pulseNormalize}function y(a){for(var b in a)aa.hasOwnProperty(b)&&(f[b]=a[b])}var aa={frameRate:150,animationTime:400,stepSize:100,pulseAlgorithm:!0,pulseScale:4,pulseNormalize:1,accelerationDelta:50,accelerationMax:3,keyboardSupport:!0,arrowScroll:50,fixedBackground:!0,excluded:""},f=aa,v=!1,B={x:0,y:0},D=!1,l=document.documentElement,m,z,w,h=[],Z,ha=/^Mac/.test(navigator.platform),g={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,
pagedown:34,end:35,home:36},ja={37:1,38:1,39:1,40:1},t=[],F=!1,E=Date.now(),J=function(){var a=0;return function(b){return b.uniqueID||(b.uniqueID=a++)}}(),W={},H={},V,A={};if(window.localStorage&&localStorage.SS_deltaBuffer)try{h=localStorage.SS_deltaBuffer.split(",")}catch(a){}var Q=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a,b,d){window.setTimeout(a,d||1E3/60)}}(),da=window.MutationObserver||window.WebKitMutationObserver||
window.MozMutationObserver,O=function(){var a=document.scrollingElement;return function(){if(!a){var b=document.createElement("div");b.style.cssText="height:10000px;width:1px;";document.body.appendChild(b);var d=document.body.scrollTop;window.scrollBy(0,3);a=document.body.scrollTop!=d?document.body:document.documentElement;window.scrollBy(0,-3);document.body.removeChild(b)}return a}}(),k=window.navigator.userAgent,u=/Edge/.test(k),G=/chrome/i.test(k)&&!u;u=/safari/i.test(k)&&!u;var ka=/mobile/i.test(k),
la=/Windows NT 6.1/i.test(k)&&/rv:11/i.test(k),ca=u&&(/Version\/8/i.test(k)||/Version\/9/i.test(k));k=(G||u||la)&&!ka;var ba=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){ba=!0}}))}catch(a){}u=ba?{passive:!1}:!1;var L="onwheel"in document.createElement("div")?"wheel":"mousewheel";L&&k&&(window.addEventListener(L,R,u||!1),window.addEventListener("mousedown",U,!1),window.addEventListener("load",C,!1));y.destroy=function(){z&&z.disconnect();window.removeEventListener(L,
R,!1);window.removeEventListener("mousedown",U,!1);window.removeEventListener("keydown",M,!1);window.removeEventListener("resize",w,!1);window.removeEventListener("load",C,!1)};window.SmoothScrollOptions&&y(window.SmoothScrollOptions);"function"===typeof define&&define.amd?define(function(){return y}):"object"==typeof exports?module.exports=y:window.SmoothScroll=y})();

View File

@ -63,10 +63,14 @@ function _getAsideAuthorMotto()
function _getAbstract($item, $type = true) function _getAbstract($item, $type = true)
{ {
$abstract = ""; $abstract = "";
if ($item->fields->abstract) { if ($item->password) {
$abstract = $item->fields->abstract; $abstract = "本篇文章为加密文章,请前往内页查看详情";
} else { } else {
$abstract = $item->excerpt; if ($item->fields->abstract) {
$abstract = $item->fields->abstract;
} else {
$abstract = strip_tags($item->excerpt);
}
} }
if ($type) { if ($type) {
echo $abstract; echo $abstract;

View File

@ -112,8 +112,33 @@
<li class="line"></li> <li class="line"></li>
</ul> </ul>
</div> </div>
<ul class="joe_list joe_index__list"></ul> <div class="joe_index__list">
<ul class="joe_list"></ul>
<ul class="joe_list__loading">
<li class="item">
<div class="thumbnail"></div>
<div class="information">
<div class="title"></div>
<div class="abstract">
<p></p>
<p></p>
</div>
</div>
</li>
<li class="item">
<div class="thumbnail"></div>
<div class="information">
<div class="title"></div>
<div class="abstract">
<p></p>
<p></p>
</div>
</div>
</li>
</ul>
</div>
</div> </div>
<div class="joe_load">查看更多</div>
</div> </div>
<?php $this->need('public/aside.php'); ?> <?php $this->need('public/aside.php'); ?>
</div> </div>

View File

@ -11,6 +11,7 @@
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.css'); ?>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@5.4.5/css/swiper.min.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@5.4.5/css/swiper.min.css" />
<link rel="stylesheet" href="https://apip.weatherdt.com/standard/static/css/weather-standard.css"> <link rel="stylesheet" href="https://apip.weatherdt.com/standard/static/css/weather-standard.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.7.2/animate.min.css" />
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.lazyload.js'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.lazyload.js'); ?>"></script>