diff --git a/README.md b/README.md index dae7ec5..f97e03d 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ 本仓库为 `Halo 2.x` 主题仓库,如果你使用的是 `Halo 1.x` ,请前往:https://github.com/nineya/halo-theme-dream +## Plus版,包含一些原仓库未合并的功能 +- https://www.sw0.top/docs/halo-theme-dream2.0 +- 最低要求:**Halo 2.6.0** + ## 一、预览 ![玖涯博客](https://cdn.jsdelivr.net/gh/nineya/halo-theme-dream2.0@master/preview.png) @@ -21,9 +25,6 @@ 预览:[主题预览](https://github.com/nineya/halo-theme-dream/discussions/72) > 如果你有计划长期使用 `Dream` 主题,也来[这里](https://github.com/nineya/halo-theme-dream/discussions/72)留下你的博客链接吧。 -## 预览版,独立作者未同意合并的部分功能 -- https://www.sw0.top/docs/halo-theme-dream2.0 - ## 二、说明 @@ -44,7 +45,7 @@ | 主题版本 | 适配Halo版本 | 测试用Halo版本 | | ----------- | --------------------------- | -------------- | -| 1.x | 2.0.0+ | 2.3.0 | +| x.x | 2.6.0+ | 2.13.1 | diff --git a/gulpfile.js b/gulpfile.js index 5f24bdb..06d60cc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -125,7 +125,7 @@ task('js', () => { task('zip', () => { const target = ['./templates/**', './*.yaml', 'README.md', 'LICENSE'] return src(target, {base: '.'}) - .pipe(zip('halo-theme-dream2.0.zip')) + .pipe(zip('halo-theme-dream2.0-plus.zip')) .pipe(dest(distPath)) }) diff --git a/package.json b/package.json index 1297ba2..ee60843 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "halo-theme-dream2.0", - "version": "1.3.1.4", + "name": "halo-theme-dream2.0-plus", + "version": "1.0.0", "description": "梦之城,童话梦境,动漫类型博客主题。", "main": "index.js", "author": "nineya", diff --git a/src/js/common.js b/src/js/common.js index 2ff7fd2..02dfa6a 100644 --- a/src/js/common.js +++ b/src/js/common.js @@ -77,11 +77,6 @@ const commonContext = { // 配色方案 $('html').addClass('color-scheme-light').removeClass('color-scheme-dark').removeClass('night') } - // $('.comment-section>div').each(function () { - // const shadowDom = this.shadowRoot.querySelectorAll('.halo-comment-widget')[0] - // $(shadowDom)[`${isNightValue ? 'add' : 'remove'}Class`]('dark') - // $(shadowDom)[`${isNightValue ? 'remove' : 'add'}Class`]('light') - // }) localStorage.setItem('night', isNightValue) isNight = isNightValue } @@ -391,16 +386,15 @@ const commonContext = { return } const websiteDate = document.getElementById('websiteDate') - // if (!/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/.test(DreamConfig.website_time)) { - // websiteDate.innerText = DreamConfig.website_time - // return - // } if (DreamConfig.website_time === '') { return } const now = new Date() const grt = new Date(DreamConfig.website_time) - setInterval(function () { + if(!websiteTimeTime) { + clearInterval(websiteTimeTime) + } + websiteTimeTime = setInterval(function () { now.setTime(now.getTime() + 1000) let difference = parseInt((now - grt) / 1000) let seconds = difference % 60 @@ -445,6 +439,9 @@ const commonContext = { if (!$('.timelife').length) { return } + if(timeLifeHour === new Date().getHours()) { + return + } let timelife = [ { title: '今日已经过去', @@ -475,6 +472,7 @@ const commonContext = { let nowDate = +new Date() let todayStartDate = new Date(new Date().toLocaleDateString()).getTime() let todayPassHours = (nowDate - todayStartDate) / 1000 / 60 / 60 + timeLifeHour = todayPassHours let todayPassHoursPercent = (todayPassHours / 24) * 100 timelife[0].num = parseInt(todayPassHours) timelife[0].percent = parseInt(todayPassHoursPercent) + '%' @@ -541,26 +539,6 @@ const commonContext = { } } }, - // /* 初始化评论区 */ - // initComment() { - // if (!window.CommentWidget) { - // return - // } - // $('.comment-section').each(function (index, item) { - // let target = $(this).attr('data-target') - // let id = $(this).attr('data-id') - // CommentWidget.init( - // `.comment-section[data-id='${id}'][data-target='${target}']`, - // '/plugins/PluginCommentWidget/assets/static/style.css', - // { - // group: target === 'Moment' ? 'moment.halo.run' : 'content.halo.run', - // kind: target, - // name: id, - // colorScheme: (localStorage.getItem('night') !== 'true' ? 'light' : 'dark') - // } - // ) - // }) - // }, /* 初始化特效,只需要初始化一次,移动端设备不初始化 */ initEffects() { if (Utils.isMobile()) return @@ -589,19 +567,15 @@ const commonContext = { keep: false //鼠标移出组件后是否继续随鼠标滚动, 取值: false, true(默认) 对应 减速至初速度滚动, 随鼠标滚动 }) }, - // /* 加载主动推送、统计脚本等参数 */ - // loadMaintain() { - // DreamConfig.enable_baidu_push && Utils.baiduPush() - // DreamConfig.enable_toutiao_push && Utils.toutiaoPush() - // }, /* 显示主题版本信息 */ showThemeVersion() { - window.logger(`%c页面加载耗时:${Math.round(performance.now())}ms | Theme By Dream ${DreamConfig.theme_version}`, + window.logger(`%c页面加载耗时:${Math.round(performance.now())}ms | Theme By Dream2 Plus ${DreamConfig.theme_version}`, 'color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px') } } window.commonContext = commonContext +let websiteTimeTime, timeLifeHour = -1 !(function () { const loads = ['initCarousel', 'sparkInput', 'websiteTime'] diff --git a/src/js/dprogress.js b/src/js/dprogress.js index 28cd4c8..8b7a068 100644 --- a/src/js/dprogress.js +++ b/src/js/dprogress.js @@ -138,13 +138,17 @@ * @returns {DProgress|*} */ DProgress.done = function() { - DProgress.inc(0.3 + 0.5 * Math.random()).set(1) + try { + DProgress.inc(0.3 + 0.5 * Math.random()).set(1) - setTimeout(function() { - $('#dprogress').hide() - DProgress.status = undefined - }, Settings.speed) - return this + setTimeout(function() { + $('#dprogress').hide() + DProgress.status = undefined + }, Settings.speed) + return this + } catch (e) { + return this + } } /** diff --git a/src/js/pjax.js b/src/js/pjax.js index b8c14cb..2a25d34 100644 --- a/src/js/pjax.js +++ b/src/js/pjax.js @@ -171,12 +171,12 @@ $(document).on('pjax:success', async function (event, data, status, xhr, options window.journalPjax && window.journalPjax(serialNumber) /* 初始化文章界面 */ window.postPjax && window.postPjax(serialNumber) - // /* 初始化评论 */ - // commonContext.initComment() + /* 刷新人生倒计时 */ + commonContext.initTimeCount() + /* 刷新建站时间及计时器 */ + commonContext.websiteTime() /* 初始化轮播 */ commonContext.initCarousel() - // /* 加载主动推送或统计脚本 */ - // commonContext.loadMaintain() window.DProgress && DProgress.done() }) @@ -207,6 +207,10 @@ $(document).on('pjax:end', function (event, xhr, options) { initPjax() /* 初始化轮播 */ commonContext.initCarousel() + /* 刷新人生倒计时 */ + commonContext.initTimeCount() + /* 刷新建站时间及计时器 */ + commonContext.websiteTime() window.DProgress && DProgress.done() // 应该是由于浏览器缓存失效,有时候浏览器前后退还是会执行pjax:beforeSend $('html').removeClass('pjax-loading') diff --git a/src/js/tagcloud.js b/src/js/tagcloud.js index 49c4861..fcd247f 100644 --- a/src/js/tagcloud.js +++ b/src/js/tagcloud.js @@ -76,6 +76,7 @@ window.tagcloud = (function (win, doc) { // ns self.box.style.overflow = 'hidden' self.box.style.margin = '0' self.box.style.padding = '0' + self.box.style.whiteSpace = 'nowrap' self.box.style.minHeight = (1.2 * self.size < 220 ? 220 : 1.2 * self.size) + 'px' self.box.style.minWidth = 'auto' for (var j2 = 0, len2 = self.items.length; j2 < len2; j2++) { diff --git a/templates/assets/js/common.min.js b/templates/assets/js/common.min.js index 147fde1..c33a2cc 100644 --- a/templates/assets/js/common.min.js +++ b/templates/assets/js/common.min.js @@ -1,4 +1,4 @@ -(()=>{window.encrypt=e=>window.btoa(unescape(encodeURIComponent(e))),window.decrypt=e=>decodeURIComponent(escape(window.atob(e)));const t={initWidget(){var e=$(".columns .column-right"),t=$(".columns .column-right-shadow");if(e.length&&t.length&&!t[0].children.length)for(const n of e[0].children)t[0].append(n.cloneNode(!0))},initTocAndNotice(){var e=location["pathname"],t=(window.tocPjax&&window.tocPjax(),0===$(".widget.toc .card-content ul").length),e="toc"===DreamConfig.notice_show_mode&&!t||"index"===DreamConfig.notice_show_mode&&"/"!==e;t?$(".widget.toc,.action-toc").addClass("is-hidden-all"):$(".widget.toc,.action-toc").removeClass("is-hidden-all"),e?$(".widget.notice").addClass("is-hidden-all"):$(".widget.notice").removeClass("is-hidden-all")},initBanner(){const a=$(".banner-info-desc");if(0!==a.length){const o=a.text();a.text("");let t,n="",i=!0;const s=function(){var e=n.length;i&&e
${this.alt&&DreamConfig.show_img_name?`

${this.alt}

`:""}`)})},initMode(){let t=localStorage.getItem("night")||!1;const n=e=>{e?$("html").addClass("color-scheme-dark").removeClass("color-scheme-light").addClass("night"):$("html").addClass("color-scheme-light").removeClass("color-scheme-dark").removeClass("night"),localStorage.setItem("night",e),t=e};$("#toggle-mode").on("click",()=>n("true"!==t.toString())),"system"===DreamConfig.default_theme?window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>n(e.matches)):n("true"===t.toString())},initNavbar(){var t=$(".navbar-nav a"),e=$(".panel-side-menu .link");let n=0;var{href:i,pathname:a}=location;if(a&&"/"!==a)for(let e=0;e$(this).addClass("active"),()=>$(this).removeClass("active")):($(this).on("click",function(e){e.stopPropagation(),$(this).toggleClass("active"),$(document).one("click",()=>$(this).removeClass("active")),e.stopPropagation()}),n.on("click",e=>e.stopPropagation()))})},initScroll(){window.initTop=0,document.addEventListener("scroll",()=>{const e=$(document).scrollTop(),t=(a=e>window.initTop,window.initTop=e,a),n=$("body"),i=$(".actions");var a;50e.preventDefault),$(".navbar .toc-content").on("click",function(e){e.stopPropagation(),$("html").removeClass("disable-scroll"),$(".navbar-mask").removeClass("active slideout"),$(".navbar-slideout").removeClass("active slideout-toc")})},sideMenuMobile(){$(".navbar-slideout-menu .current").parents(".panel-body").show().siblings(".panel").addClass("in"),$(".navbar-slideout-menu .panel").on("click",function(e){e.stopPropagation();var e=$(this),t=e.parent().parent();t.find(".panel").not(e).removeClass("in"),t.find(".panel-body").not(e.siblings(".panel-body")).stop().hide("fast"),e.toggleClass("in").siblings(".panel-body").stop().toggle("fast")})},initEvent(){var e=$("body");function n(e){var e=$(e),t=e.attr("data-close");return t&&""!==t.trim()?e.closest(t.trim()):e}e.on("click",".click-close",function(e){e.stopPropagation(),n(this).remove()}),e.on("click",".click-animation-close",function(e){e.stopPropagation();let t=n(this);t.addClass("close-animation"),setTimeout(()=>t.remove(),300)})},offscreenTip(){if(!Utils.isMobile()&&(DreamConfig.document_hidden_title||DreamConfig.document_visible_title)){let e=document.title,t=null;document.addEventListener("visibilitychange",function(){document.hidden?(DreamConfig.document_visible_title&&document.title===DreamConfig.document_visible_title||(e=document.title),DreamConfig.document_hidden_title&&(document.title=DreamConfig.document_hidden_title),clearTimeout(t)):(document.title=DreamConfig.document_visible_title||e,DreamConfig.document_visible_title&&(t=setTimeout(function(){document.title===DreamConfig.document_visible_title&&(document.title=e)},2e3)))})}},initCarousel(){window.Swiper&&new Swiper(".swiper",{loop:!0,parallax:!0,effect:"slide",spaceBetween:10,speed:600,autoplay:{delay:3e3,disableOnInteraction:!1,pauseOnMouseEnter:!0},pagination:{el:".swiper-pagination",clickable:!0},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})},sparkInput(){const n=DreamConfig.spark_input_content&&DreamConfig.spark_input_content.filter(e=>0sparkInput(t,[t.innerText,...n]))})},loveTime(){let l=$(".love .love-time");if(0!==l.length){var e=l.attr("data-time");if(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/.test(e)){const c=new Date,d=new Date(e);setInterval(function(){c.setTime(c.getTime()+1e3);var e=parseInt((c-d)/1e3),t=e%60,n=(e=parseInt(e/60))%60;let i=(e=parseInt(e/60))%24,a=parseInt(e/24),o=0,s=d.getFullYear(),r=c.getFullYear();for(;s${a}天${i}${n}${t}秒`},1e3)}}},webCopyright(){var e,t,n;DreamConfig.website_time&&(e=document.getElementById("webCopyright"),t=(new Date).getFullYear(),n=new Date(DreamConfig.website_time).getFullYear(),e.innerText=t!==n?"© "+n+"-"+t+" "+DreamConfig.site_title:"© "+t+" "+DreamConfig.site_title)},initTimeCount(){if($(".timelife").length){var e=[{title:"今日已经过去",endTitle:"小时",num:0,percent:"0%"},{title:"这周已经过去",endTitle:"天",num:0,percent:"0%"},{title:"本月已经过去",endTitle:"天",num:0,percent:"0%"},{title:"今年已经过去",endTitle:"个月",num:0,percent:"0%"}],t=(+new Date-new Date((new Date).toLocaleDateString()).getTime())/1e3/60/60,i=t/24*100,t=(e[0].num=parseInt(t),e[0].percent=parseInt(i)+"%",{0:7,1:1,2:2,3:3,4:4,5:5,6:6}[(new Date).getDay()]),i=t/7*100,t=(e[1].num=parseInt(t),e[1].percent=parseInt(i)+"%",(new Date).getFullYear()),i=(new Date).getDate(),a=(new Date).getMonth()+1,t=i/new Date(t,a,0).getDate()*100,a=(e[2].num=i,e[2].percent=parseInt(t)+"%",(new Date).getMonth()+1),i=a/12*100;e[3].num=a,e[3].percent=parseInt(i)+"%";let n="";e.forEach((e,t)=>{n+=` +(()=>{window.encrypt=e=>window.btoa(unescape(encodeURIComponent(e))),window.decrypt=e=>decodeURIComponent(escape(window.atob(e)));const t={initWidget(){var e=$(".columns .column-right"),t=$(".columns .column-right-shadow");if(e.length&&t.length&&!t[0].children.length)for(const n of e[0].children)t[0].append(n.cloneNode(!0))},initTocAndNotice(){var e=location["pathname"],t=(window.tocPjax&&window.tocPjax(),0===$(".widget.toc .card-content ul").length),e="toc"===DreamConfig.notice_show_mode&&!t||"index"===DreamConfig.notice_show_mode&&"/"!==e;t?$(".widget.toc,.action-toc").addClass("is-hidden-all"):$(".widget.toc,.action-toc").removeClass("is-hidden-all"),e?$(".widget.notice").addClass("is-hidden-all"):$(".widget.notice").removeClass("is-hidden-all")},initBanner(){const i=$(".banner-info-desc");if(0!==i.length){const o=i.text();i.text("");let t,n="",a=!0;const s=function(){var e=n.length;a&&e
${this.alt&&DreamConfig.show_img_name?`

${this.alt}

`:""}`)})},initMode(){let t=localStorage.getItem("night")||!1;const n=e=>{e?$("html").addClass("color-scheme-dark").removeClass("color-scheme-light").addClass("night"):$("html").addClass("color-scheme-light").removeClass("color-scheme-dark").removeClass("night"),localStorage.setItem("night",e),t=e};$("#toggle-mode").on("click",()=>n("true"!==t.toString())),"system"===DreamConfig.default_theme?window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>n(e.matches)):n("true"===t.toString())},initNavbar(){var t=$(".navbar-nav a"),e=$(".panel-side-menu .link");let n=0;var{href:a,pathname:i}=location;if(i&&"/"!==i)for(let e=0;e$(this).addClass("active"),()=>$(this).removeClass("active")):($(this).on("click",function(e){e.stopPropagation(),$(this).toggleClass("active"),$(document).one("click",()=>$(this).removeClass("active")),e.stopPropagation()}),n.on("click",e=>e.stopPropagation()))})},initScroll(){window.initTop=0,document.addEventListener("scroll",()=>{const e=$(document).scrollTop(),t=(i=e>window.initTop,window.initTop=e,i),n=$("body"),a=$(".actions");var i;50e.preventDefault),$(".navbar .toc-content").on("click",function(e){e.stopPropagation(),$("html").removeClass("disable-scroll"),$(".navbar-mask").removeClass("active slideout"),$(".navbar-slideout").removeClass("active slideout-toc")})},sideMenuMobile(){$(".navbar-slideout-menu .current").parents(".panel-body").show().siblings(".panel").addClass("in"),$(".navbar-slideout-menu .panel").on("click",function(e){e.stopPropagation();var e=$(this),t=e.parent().parent();t.find(".panel").not(e).removeClass("in"),t.find(".panel-body").not(e.siblings(".panel-body")).stop().hide("fast"),e.toggleClass("in").siblings(".panel-body").stop().toggle("fast")})},initEvent(){var e=$("body");function n(e){var e=$(e),t=e.attr("data-close");return t&&""!==t.trim()?e.closest(t.trim()):e}e.on("click",".click-close",function(e){e.stopPropagation(),n(this).remove()}),e.on("click",".click-animation-close",function(e){e.stopPropagation();let t=n(this);t.addClass("close-animation"),setTimeout(()=>t.remove(),300)})},offscreenTip(){if(!Utils.isMobile()&&(DreamConfig.document_hidden_title||DreamConfig.document_visible_title)){let e=document.title,t=null;document.addEventListener("visibilitychange",function(){document.hidden?(DreamConfig.document_visible_title&&document.title===DreamConfig.document_visible_title||(e=document.title),DreamConfig.document_hidden_title&&(document.title=DreamConfig.document_hidden_title),clearTimeout(t)):(document.title=DreamConfig.document_visible_title||e,DreamConfig.document_visible_title&&(t=setTimeout(function(){document.title===DreamConfig.document_visible_title&&(document.title=e)},2e3)))})}},initCarousel(){window.Swiper&&new Swiper(".swiper",{loop:!0,parallax:!0,effect:"slide",spaceBetween:10,speed:600,autoplay:{delay:3e3,disableOnInteraction:!1,pauseOnMouseEnter:!0},pagination:{el:".swiper-pagination",clickable:!0},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})},sparkInput(){const n=DreamConfig.spark_input_content&&DreamConfig.spark_input_content.filter(e=>0sparkInput(t,[t.innerText,...n]))})},loveTime(){let l=$(".love .love-time");if(0!==l.length){var e=l.attr("data-time");if(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/.test(e)){const c=new Date,d=new Date(e);setInterval(function(){c.setTime(c.getTime()+1e3);var e=parseInt((c-d)/1e3),t=e%60,n=(e=parseInt(e/60))%60;let a=(e=parseInt(e/60))%24,i=parseInt(e/24),o=0,s=d.getFullYear(),r=c.getFullYear();for(;s${i}天${a}${n}${t}秒`},1e3)}}},webCopyright(){var e,t,n;DreamConfig.website_time&&(e=document.getElementById("webCopyright"),t=(new Date).getFullYear(),n=new Date(DreamConfig.website_time).getFullYear(),e.innerText=t!==n?"© "+n+"-"+t+" "+DreamConfig.site_title:"© "+t+" "+DreamConfig.site_title)},initTimeCount(){if($(".timelife").length&&o!==(new Date).getHours()){var e=[{title:"今日已经过去",endTitle:"小时",num:0,percent:"0%"},{title:"这周已经过去",endTitle:"天",num:0,percent:"0%"},{title:"本月已经过去",endTitle:"天",num:0,percent:"0%"},{title:"今年已经过去",endTitle:"个月",num:0,percent:"0%"}],t=(+new Date-new Date((new Date).toLocaleDateString()).getTime())/1e3/60/60,a=(o=t)/24*100,t=(e[0].num=parseInt(t),e[0].percent=parseInt(a)+"%",{0:7,1:1,2:2,3:3,4:4,5:5,6:6}[(new Date).getDay()]),a=t/7*100,t=(e[1].num=parseInt(t),e[1].percent=parseInt(a)+"%",(new Date).getFullYear()),a=(new Date).getDate(),i=(new Date).getMonth()+1,t=a/new Date(t,i,0).getDate()*100,i=(e[2].num=a,e[2].percent=parseInt(t)+"%",(new Date).getMonth()+1),a=i/12*100;e[3].num=i,e[3].percent=parseInt(a)+"%";let n="";e.forEach((e,t)=>{n+=`
${e.title} @@ -11,4 +11,4 @@
${e.percent}
- `}),$(".aside-timelife").html(n)}},initGrayMode(){var e,t,n;(!0===DreamConfig.gray_mode||"custom"===DreamConfig.gray_mode&&(e=(new Date).getTime(),t=new Date(DreamConfig.gray_mode_start_time).getTime(),n=new Date(DreamConfig.gray_mode_end_time).getTime(),t<=e)&&e<=n)&&$("html").addClass("gray-mode")},initEffects(){Utils.isMobile()||(DreamConfig.cursor_move&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/move/${DreamConfig.cursor_move}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.cursor_click&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/click/${DreamConfig.cursor_click}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.enable_live2d&&Utils.cachedScript(DreamConfig.theme_base+"/js/autoload.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_lantern_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/lantern.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_sakura_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/sakura.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_snowflake_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/snowflake.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_universe_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/universe.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_circle_magic_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/circleMagic.min.js?mew="+DreamConfig.theme_version))},initTagCloud(){$(".tagcloud").length&&DreamConfig.show_tagcloud_style&&tagcloud({selector:".tagcloud .card-content",fontsize:18,radius:75,mspeed:"slow",ispeed:"slow",direction:45,keep:!1})},showThemeVersion(){window.logger(`%c页面加载耗时:${Math.round(performance.now())}ms | Theme By Dream `+DreamConfig.theme_version,"color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px")}};window.commonContext=t;{const n=["initCarousel","sparkInput","websiteTime"],i=["initEffects","showThemeVersion"];Object.keys(t).forEach(e=>!n.includes(e)&&!i.includes(e)&&t[e]()),document.addEventListener("DOMContentLoaded",function(){$("html").addClass("loaded"),n.forEach(e=>t[e]&&t[e]())}),window.addEventListener("load",function(){i.forEach(e=>t[e]&&t[e]()),$("html").addClass("ready")})}})(); \ No newline at end of file + `}),$(".aside-timelife").html(n)}},initGrayMode(){var e,t,n;(!0===DreamConfig.gray_mode||"custom"===DreamConfig.gray_mode&&(e=(new Date).getTime(),t=new Date(DreamConfig.gray_mode_start_time).getTime(),n=new Date(DreamConfig.gray_mode_end_time).getTime(),t<=e)&&e<=n)&&$("html").addClass("gray-mode")},initEffects(){Utils.isMobile()||(DreamConfig.cursor_move&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/move/${DreamConfig.cursor_move}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.cursor_click&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/click/${DreamConfig.cursor_click}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.enable_live2d&&Utils.cachedScript(DreamConfig.theme_base+"/js/autoload.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_lantern_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/lantern.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_sakura_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/sakura.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_snowflake_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/snowflake.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_universe_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/universe.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_circle_magic_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/circleMagic.min.js?mew="+DreamConfig.theme_version))},initTagCloud(){$(".tagcloud").length&&DreamConfig.show_tagcloud_style&&tagcloud({selector:".tagcloud .card-content",fontsize:18,radius:75,mspeed:"slow",ispeed:"slow",direction:45,keep:!1})},showThemeVersion(){window.logger(`%c页面加载耗时:${Math.round(performance.now())}ms | Theme By Dream2 Plus `+DreamConfig.theme_version,"color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px")}};window.commonContext=t;let e,o=-1;{const n=["initCarousel","sparkInput","websiteTime"],a=["initEffects","showThemeVersion"];Object.keys(t).forEach(e=>!n.includes(e)&&!a.includes(e)&&t[e]()),document.addEventListener("DOMContentLoaded",function(){$("html").addClass("loaded"),n.forEach(e=>t[e]&&t[e]())}),window.addEventListener("load",function(){a.forEach(e=>t[e]&&t[e]()),$("html").addClass("ready")})}})(); \ No newline at end of file diff --git a/templates/assets/js/dprogress.min.js b/templates/assets/js/dprogress.min.js index e692265..73e1978 100644 --- a/templates/assets/js/dprogress.min.js +++ b/templates/assets/js/dprogress.min.js @@ -1 +1 @@ -!function(){var n={},s=n.settings={minimum:.08,easing:"linear",speed:400,trickle:!0,trickleSpeed:200,parent:"body",template:'
'};function i(t,e,r){return t'};function i(t,e,r){return t{const l=new Set($('link[href*=".css"]').map((o,e)=>$(e).attr("href")).get()),c=new Set($('script[src*=".js"]').map((o,e)=>$(e).attr("src")).get()),e=()=>{var o=(new Date).getTime();return window.pjaxSerialNumber=o,console.log("sn = "+o),o},i=(e,n,t)=>{if(n>=e.length)t&&t();else{let o=$(e[n]).attr("src");c.has(o)?i(e,n+1,t):(console.log((t?"同步":"异步")+"顺序加载js "+o),Utils.cachedScript(o).done(function(){console.log((t?"同步":"异步")+"顺序加载js完成 "+o),c.add(o),window.DProgress&&DProgress.inc(),i(e,n+1,t)}).fail(function(){console.log((t?"同步":"异步")+"顺序加载js失败 "+o),i(e,n+1,t)}))}};$(document).on("click","a[target!=_blank][href]:not(data-not-pjax)",o=>{$.pjax.click(o,".column-main",{scrollTo:"/"!==o.currentTarget.pathname&&0!==$(".banner").length?(window.initTop=99999999,window.innerHeight/4):0,fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("submit","form[data-pjax]",function(o){$.pjax.submit(o,".column-main",{scrollTo:0,fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("pjax:click",function(o,e){console.log("------------------------"),console.log("pjax:click sn = "+e.serialNumber)}),$(document).on("pjax:beforeSend",function(o,e,n){console.log("pjax:beforeSend sn = "+n.serialNumber),$("html").addClass("pjax-loading")}),$(document).on("pjax:start",function(o,e,n){console.log("pjax:start sn = "+n.serialNumber),window.DProgress&&DProgress.start(),$(".pjax-close").remove()}),$(document).on("pjax:send",function(o,e,n){console.log("pjax:send sn = "+n.serialNumber)}),$(document).on("pjax:clicked",function(o,e){console.log("pjax:clicked sn = "+e.serialNumber)}),$(document).on("pjax:beforeReplace",function(o,e,n){console.log("pjax:beforeReplace sn = "+n.serialNumber),$(".navbar-nav .current,.panel-side-menu .current").removeClass("current"),commonContext.initNavbar(),0<$("html.disable-scroll").length&&$(".navbar-mask").trigger("click")}),$(document).on("pjax:success",async function(o,e,n,t,s){s=s.serialNumber;if(console.log("pjax:success sn = "+s),window.pjaxSerialNumber===s){commonContext.initGallery(),commonContext.initTocAndNotice(),$("html").removeClass("pjax-loading");const a=$($.parseHTML(e,document,!0)),r=$("head");r.find("meta").remove(),r.append(a.filter("meta")),a.filter("link[data-pjax]").each(function(){let o=$(this).attr("href");l.has(o)||(r.append($(this)),console.log("加载css "+$(this).attr("href")),this.onload=function(){l.add(o),window.DProgress&&DProgress.inc(),console.log("加载css完成 "+$(this).attr("href"))})});let o=a.filter("script[data-pjax]");if(0{i(o.filter("[defer]"),0)});let e=o.filter(":not([async]):not([defer])");0{i(e,0,o)})}console.log("全部处理完成"),window.pjaxSerialNumber===s&&(window.journalPjax&&window.journalPjax(s),window.postPjax&&window.postPjax(s),commonContext.initCarousel(),window.DProgress)&&DProgress.done()}}),$(document).on("pjax:timeout",function(o,e,n){console.log("pjax:timeout sn = "+n.serialNumber)}),$(document).on("pjax:error",function(o,e,n,t,s){console.log(`pjax:error sn = ${s.serialNumber} error `+t)}),$(document).on("pjax:complete",function(o,e,n,t){console.log("pjax:complete sn = "+t.serialNumber)}),$(document).on("pjax:end",function(o,e,n){console.log("pjax:end sn = "+n.serialNumber),null==e&&(commonContext.initTocAndNotice(),commonContext.initCarousel(),window.DProgress&&DProgress.done(),$("html").removeClass("pjax-loading"))}),$(document).on("pjax:popstate",function(){console.log("pjax:popstate")})})(); \ No newline at end of file +(()=>{const i=new Set($('link[href*=".css"]').map((o,e)=>$(e).attr("href")).get()),c=new Set($('script[src*=".js"]').map((o,e)=>$(e).attr("src")).get()),e=()=>{var o=(new Date).getTime();return window.pjaxSerialNumber=o,console.log("sn = "+o),o},l=(e,n,t)=>{if(n>=e.length)t&&t();else{let o=$(e[n]).attr("src");c.has(o)?l(e,n+1,t):(console.log((t?"同步":"异步")+"顺序加载js "+o),Utils.cachedScript(o).done(function(){console.log((t?"同步":"异步")+"顺序加载js完成 "+o),c.add(o),window.DProgress&&DProgress.inc(),l(e,n+1,t)}).fail(function(){console.log((t?"同步":"异步")+"顺序加载js失败 "+o),l(e,n+1,t)}))}};$(document).on("click","a[target!=_blank][href]:not(data-not-pjax)",o=>{$.pjax.click(o,".column-main",{scrollTo:"/"!==o.currentTarget.pathname&&0!==$(".banner").length?(window.initTop=99999999,window.innerHeight/4):0,fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("submit","form[data-pjax]",function(o){$.pjax.submit(o,".column-main",{scrollTo:0,fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("pjax:click",function(o,e){console.log("------------------------"),console.log("pjax:click sn = "+e.serialNumber)}),$(document).on("pjax:beforeSend",function(o,e,n){console.log("pjax:beforeSend sn = "+n.serialNumber),$("html").addClass("pjax-loading")}),$(document).on("pjax:start",function(o,e,n){console.log("pjax:start sn = "+n.serialNumber),window.DProgress&&DProgress.start(),$(".pjax-close").remove()}),$(document).on("pjax:send",function(o,e,n){console.log("pjax:send sn = "+n.serialNumber)}),$(document).on("pjax:clicked",function(o,e){console.log("pjax:clicked sn = "+e.serialNumber)}),$(document).on("pjax:beforeReplace",function(o,e,n){console.log("pjax:beforeReplace sn = "+n.serialNumber),$(".navbar-nav .current,.panel-side-menu .current").removeClass("current"),commonContext.initNavbar(),0<$("html.disable-scroll").length&&$(".navbar-mask").trigger("click")}),$(document).on("pjax:success",async function(o,e,n,t,s){s=s.serialNumber;if(console.log("pjax:success sn = "+s),window.pjaxSerialNumber===s){commonContext.initGallery(),commonContext.initTocAndNotice(),$("html").removeClass("pjax-loading");const a=$($.parseHTML(e,document,!0)),r=$("head");r.find("meta").remove(),r.append(a.filter("meta")),a.filter("link[data-pjax]").each(function(){let o=$(this).attr("href");i.has(o)||(r.append($(this)),console.log("加载css "+$(this).attr("href")),this.onload=function(){i.add(o),window.DProgress&&DProgress.inc(),console.log("加载css完成 "+$(this).attr("href"))})});let o=a.filter("script[data-pjax]");if(0{l(o.filter("[defer]"),0)});let e=o.filter(":not([async]):not([defer])");0{l(e,0,o)})}console.log("全部处理完成"),window.pjaxSerialNumber===s&&(window.journalPjax&&window.journalPjax(s),window.postPjax&&window.postPjax(s),commonContext.initTimeCount(),commonContext.websiteTime(),commonContext.initCarousel(),window.DProgress)&&DProgress.done()}}),$(document).on("pjax:timeout",function(o,e,n){console.log("pjax:timeout sn = "+n.serialNumber)}),$(document).on("pjax:error",function(o,e,n,t,s){console.log(`pjax:error sn = ${s.serialNumber} error `+t)}),$(document).on("pjax:complete",function(o,e,n,t){console.log("pjax:complete sn = "+t.serialNumber)}),$(document).on("pjax:end",function(o,e,n){console.log("pjax:end sn = "+n.serialNumber),null==e&&(commonContext.initTocAndNotice(),commonContext.initCarousel(),commonContext.initTimeCount(),commonContext.websiteTime(),window.DProgress&&DProgress.done(),$("html").removeClass("pjax-loading"))}),$(document).on("pjax:popstate",function(){console.log("pjax:popstate")})})(); \ No newline at end of file diff --git a/templates/assets/js/tagcloud.min.js b/templates/assets/js/tagcloud.min.js index 59e5961..a587dbe 100644 --- a/templates/assets/js/tagcloud.min.js +++ b/templates/assets/js/tagcloud.min.js @@ -1 +1 @@ -window.tagcloud=function(a,l){function u(e){var s=this;s.config=u._getConfig(e),s.box=s.config.element,s.fontsize=s.config.fontsize,s.radius=s.config.radius,s.depth=2*s.radius,s.size=2*s.radius,s.mspeed=u._getMsSpeed(s.config.mspeed),s.ispeed=u._getIsSpeed(s.config.ispeed),s.items=s._getItems(),s.direction=s.config.direction,s.keep=s.config.keep,s.active=!1,s.lasta=1,s.lastb=1,s.mouseX0=s.ispeed*Math.sin(s.direction*Math.PI/180),s.mouseY0=-s.ispeed*Math.cos(s.direction*Math.PI/180),s.mouseX=s.mouseX0,s.mouseY=s.mouseY0,s.index=-1,u._on(s.box,"mouseover",function(){s.active=!0}),u._on(s.box,"mouseout",function(){s.active=!1}),u._on(s.keep?a:s.box,"mousemove",function(e){var e=a.event||e,t=s.box.getBoundingClientRect();s.mouseX=(e.clientX-(t.left+s.box.offsetWidth/2))/5,s.mouseY=(e.clientY-(t.top+s.box.offsetHeight/2))/5});for(var t=0,i=s.items.length;t>>0,s=Number(arguments[1])||0;for((s=s<0?Math.ceil(s):Math.floor(s))<0&&(s+=t);s>>0,s=Number(arguments[1])||0;for((s=s<0?Math.ceil(s):Math.floor(s))<0&&(s+=t);s=2.0.0" \ No newline at end of file + require: ">=2.6.0" \ No newline at end of file