From 5f8a4ee660af78ced15619b5640bcb2241474c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=81=92?= <2323333339@qq.com> Date: Wed, 14 Apr 2021 14:41:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/joe.index.js | 6 ++---- assets/js/joe.index.min.js | 2 +- core/core.php | 3 --- core/function.php | 2 +- package.json | 2 +- public/config.php | 3 ++- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/assets/js/joe.index.js b/assets/js/joe.index.js index 2059406..1fc11b1 100644 --- a/assets/js/joe.index.js +++ b/assets/js/joe.index.js @@ -141,7 +141,7 @@ document.addEventListener('DOMContentLoaded', () => { `; } }; - let queryData = { page: 1, pageSize: 12, type: 'created' }; + let queryData = { page: 1, pageSize: window.Joe.PAGE_SIZE, type: 'created' }; const initDom = () => { $('.joe_index__list .joe_list').html(''); $('.joe_load').show(); @@ -179,14 +179,12 @@ document.addEventListener('DOMContentLoaded', () => { }; initDom(); pushDom(); - $('.joe_index__title-title .item').on('click', async function () { if ($(this).attr('data-type') === queryData.type) return; - queryData = { page: 1, pageSize: 12, type: $(this).attr('data-type') }; + queryData = { page: 1, pageSize: window.Joe.PAGE_SIZE, type: $(this).attr('data-type') }; initDom(); pushDom(); }); - $('.joe_load').on('click', async function () { if ($(this).attr('loading')) return; queryData.page++; diff --git a/assets/js/joe.index.min.js b/assets/js/joe.index.min.js index ed5c1f5..e967dd1 100644 --- a/assets/js/joe.index.min.js +++ b/assets/js/joe.index.min.js @@ -1 +1 @@ -document.addEventListener("DOMContentLoaded",()=>{if(0!==$(".joe_index__banner .swiper-container").length){let l="horizontal";Joe.IS_MOBILE||2!==$(".joe_index__banner-recommend .item").length||(l="vertical"),new Swiper(".swiper-container",{keyboard:!1,direction:l,loop:!0,autoplay:!0,mousewheel:!0,pagination:{el:".swiper-pagination"},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})}{const l=l=>"default"===l.mode?`\n
  • \n
    \n \n ${l.title}\n \n \n \n
    \n \n 置顶${l.title}\n \n ${l.abstract}\n
    \n
      \n
    • ${l.created}
    • \n
    • ${l.views} 阅读
    • \n
    • ${l.commentsNum} 评论
    • \n
    • ${l.agree} 点赞
    • \n
    \n \n
    \n
    \n
  • \n `:"single"===l.mode?`\n
  • \n
    \n
    \n \n 置顶${l.title}\n \n
    \n
      \n
    • ${l.created}
    • \n
    • ${l.views} 阅读
    • \n
    • ${l.commentsNum} 评论
    • \n
    • ${l.agree} 点赞
    • \n
    \n \n
    \n
    \n \n ${l.title}\n \n \n \n
    \n ${l.abstract}\n
    \n
  • \n `:"multiple"===l.mode?`\n
  • \n
    \n
    \n \n 置顶${l.title}\n \n ${l.abstract}\n
    \n \n ${l.image.map((e,t)=>{if(t<3)return`${l.title}`}).join("")}\n \n
    \n \n \n
    \n
  • \n `:`\n
  • \n
    \n
    \n \n 置顶${l.title}\n \n ${l.abstract}\n
    \n
      \n
    • ${l.created}
    • \n
    • ${l.views} 阅读
    • \n
    • ${l.commentsNum} 评论
    • \n
    • ${l.agree} 点赞
    • \n
    \n \n
    \n
    \n
  • \n `;let e={page:1,pageSize:12,type:"created"};const t=()=>{$(".joe_index__list .joe_list").html(""),$(".joe_load").show();let l=$('.joe_index__title-title .item[data-type="'+e.type+'"]'),t=$(".joe_index__title-title .line");l.addClass("active").siblings().removeClass("active"),t.css({left:l.position().left,width:l.width()})},i=()=>new Promise((t,i)=>{$(".joe_load").attr("loading",!0),$(".joe_load").html("loading..."),$(".joe_index__list .joe_list__loading").show(),$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"publish_list",page:e.page,pageSize:e.pageSize,type:e.type},success(e){if(0===e.data.length)return $(".joe_load").removeAttr("loading"),$(".joe_load").html("查看更多"),$(".joe_load").hide(),$(".joe_index__list .joe_list__loading").hide(),Qmsg.warning("没有更多内容了");e.data.forEach(e=>$(".joe_index__list .joe_list").append(l(e))),$(".joe_load").removeAttr("loading"),$(".joe_load").html("查看更多"),$(".joe_index__list .joe_list__loading").hide(),t(e.data.length>0?e.data.length-1:0)}})});t(),i(),$(".joe_index__title-title .item").on("click",async function(){$(this).attr("data-type")!==e.type&&(e={page:1,pageSize:12,type:$(this).attr("data-type")},t(),i())}),$(".joe_load").on("click",async function(){if($(this).attr("loading"))return;e.page++;let l=await i();l=$(".joe_index__list .joe_list .joe_list__item").length-l;const t=`.joe_index__list .joe_list .joe_list__item:nth-child(${l})`,a=$(t).offset().top-$(".joe_header").height();window.scrollTo({top:a-15,behavior:"smooth"})})}{const l=$(".joe_index__list").attr("data-wow");"off"!==l&&l&&new WOW({boxClass:"wow",animateClass:`animated ${l}`,offset:0,mobile:!0,live:!0,scrollContainer:null}).init()}}); \ No newline at end of file +document.addEventListener("DOMContentLoaded",()=>{if(0!==$(".joe_index__banner .swiper-container").length){let l="horizontal";Joe.IS_MOBILE||2!==$(".joe_index__banner-recommend .item").length||(l="vertical"),new Swiper(".swiper-container",{keyboard:!1,direction:l,loop:!0,autoplay:!0,mousewheel:!0,pagination:{el:".swiper-pagination"},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})}{const l=l=>"default"===l.mode?`\n
  • \n
    \n \n ${l.title}\n \n \n \n
    \n \n 置顶${l.title}\n \n ${l.abstract}\n
    \n
      \n
    • ${l.created}
    • \n
    • ${l.views} 阅读
    • \n
    • ${l.commentsNum} 评论
    • \n
    • ${l.agree} 点赞
    • \n
    \n \n
    \n
    \n
  • \n `:"single"===l.mode?`\n
  • \n
    \n
    \n \n 置顶${l.title}\n \n
    \n
      \n
    • ${l.created}
    • \n
    • ${l.views} 阅读
    • \n
    • ${l.commentsNum} 评论
    • \n
    • ${l.agree} 点赞
    • \n
    \n \n
    \n
    \n \n ${l.title}\n \n \n \n
    \n ${l.abstract}\n
    \n
  • \n `:"multiple"===l.mode?`\n
  • \n
    \n
    \n \n 置顶${l.title}\n \n ${l.abstract}\n
    \n \n ${l.image.map((e,t)=>{if(t<3)return`${l.title}`}).join("")}\n \n
    \n \n \n
    \n
  • \n `:`\n
  • \n
    \n
    \n \n 置顶${l.title}\n \n ${l.abstract}\n
    \n
      \n
    • ${l.created}
    • \n
    • ${l.views} 阅读
    • \n
    • ${l.commentsNum} 评论
    • \n
    • ${l.agree} 点赞
    • \n
    \n \n
    \n
    \n
  • \n `;let e={page:1,pageSize:window.Joe.PAGE_SIZE,type:"created"};const t=()=>{$(".joe_index__list .joe_list").html(""),$(".joe_load").show();let l=$('.joe_index__title-title .item[data-type="'+e.type+'"]'),t=$(".joe_index__title-title .line");l.addClass("active").siblings().removeClass("active"),t.css({left:l.position().left,width:l.width()})},i=()=>new Promise((t,i)=>{$(".joe_load").attr("loading",!0),$(".joe_load").html("loading..."),$(".joe_index__list .joe_list__loading").show(),$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"publish_list",page:e.page,pageSize:e.pageSize,type:e.type},success(e){if(0===e.data.length)return $(".joe_load").removeAttr("loading"),$(".joe_load").html("查看更多"),$(".joe_load").hide(),$(".joe_index__list .joe_list__loading").hide(),Qmsg.warning("没有更多内容了");e.data.forEach(e=>$(".joe_index__list .joe_list").append(l(e))),$(".joe_load").removeAttr("loading"),$(".joe_load").html("查看更多"),$(".joe_index__list .joe_list__loading").hide(),t(e.data.length>0?e.data.length-1:0)}})});t(),i(),$(".joe_index__title-title .item").on("click",async function(){$(this).attr("data-type")!==e.type&&(e={page:1,pageSize:window.Joe.PAGE_SIZE,type:$(this).attr("data-type")},t(),i())}),$(".joe_load").on("click",async function(){if($(this).attr("loading"))return;e.page++;let l=await i();l=$(".joe_index__list .joe_list .joe_list__item").length-l;const t=`.joe_index__list .joe_list .joe_list__item:nth-child(${l})`,a=$(t).offset().top-$(".joe_header").height();window.scrollTo({top:a-15,behavior:"smooth"})})}{const l=$(".joe_index__list").attr("data-wow");"off"!==l&&l&&new WOW({boxClass:"wow",animateClass:`animated ${l}`,offset:0,mobile:!0,live:!0,scrollContainer:null}).init()}}); \ No newline at end of file diff --git a/core/core.php b/core/core.php index a6df805..d1fe1f3 100644 --- a/core/core.php +++ b/core/core.php @@ -29,9 +29,6 @@ function themeInit($self) Helper::options()->commentsRequireURL = false; /* 强制用户开启评论回复 */ Helper::options()->commentsThreaded = true; - /* 强制显示一页12篇文章 */ - $self->parameter->pageSize = 12; - /* 主题开放API 路由规则 */ $path_info = $self->request->getPathinfo(); diff --git a/core/function.php b/core/function.php index e7cb535..e5ba16f 100644 --- a/core/function.php +++ b/core/function.php @@ -2,7 +2,7 @@ /* 获取主题当前版本号 */ function _getVersion() { - return "6.3.6"; + return "6.3.7"; }; /* 判断是否是手机 */ diff --git a/package.json b/package.json index 9e0e6bf..d4f6c9c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typecho-joe-next", - "version": "6.3.6", + "version": "6.3.7", "description": "A Theme Of Typecho", "main": "index.php", "keywords": [ diff --git a/public/config.php b/public/config.php index 3ac1dac..e45198f 100644 --- a/public/config.php +++ b/public/config.php @@ -24,7 +24,8 @@ DOCUMENT_TITLE: `options->JDocumentTitle() ?>`, LAZY_LOAD: ``, BIRTHDAY: `options->JBirthDay() ?>`, - MOTTO: `` + MOTTO: ``, + PAGE_SIZE: `parameter->pageSize() ?>` }