diff --git a/settings.yaml b/settings.yaml index becbe7a..d8ad4df 100644 --- a/settings.yaml +++ b/settings.yaml @@ -775,29 +775,31 @@ sidebar_show: default: profile options: - value: profile - label: 信息模块 + label: 信息模块 - value: toc - label: 目录模块 + label: 目录模块 - value: notice - label: 公告模块 + label: 公告模块 - value: love - label: 恋爱墙模块 + label: 恋爱墙模块 - value: music - label: 音乐模块 + label: 音乐模块 - value: ad_piece - label: 广告模块 + label: 广告模块 - value: recent_posts - label: 最近文章模块 + label: 最近文章模块 - value: recent_comments label: 最近评论模块 - value: categories - label: 文章分类模块 + label: 文章分类模块 - value: tags - label: 文章标签模块 + label: 文章标签模块 - value: tagcloud - label: 文章标签云模块 + label: 文章标签云模块 - value: links - label: 友链模块 + label: 友链模块 + - value: custom + label: 自定义模块 - name: location label: 模块位置 type: radio @@ -822,6 +824,21 @@ sidebar_show: label: 桌面设备隐藏 - value: 'is-not-hidden' label: 不隐藏 + - name: title + label: 侧边栏标题 + type: text + placeholder: 请输入标题内容 + description: "可覆盖默认侧边栏标题。" + - name: icon + label: 侧边栏图标 + type: text + placeholder: 请输入图标 class 内容 + description: "可覆盖默认侧边栏图标。" + - name: content + label: 侧边栏内容 + type: textarea + placeholder: 请输入 HTML 内容 + description: "仅在侧边栏类型为自定义时生效。" sidebar_config: label: 侧边栏配置 items: diff --git a/source/js/common.min.js b/source/js/common.min.js index 69a8a62..e36f83e 100644 --- a/source/js/common.min.js +++ b/source/js/common.min.js @@ -1 +1 @@ -(()=>{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($(".widget.recent-comments .reply .link").html((e,t)=>Utils.renderedEmojiHtml(t)),e.length&&t.length&&!t[0].children.length)for(const a of e[0].children)t[0].append(a.cloneNode(!0))},initActions(){const a=$(".actions>.bullet-screen");"true"===localStorage.getItem("stop-bullet-screen")&&a.addClass("stop-bullet-screen"),0!==$("halo-comment[bullet-screen]").length&&a.removeClass("is-hidden-all");a.on("click",()=>{var t,e=localStorage.getItem("stop-bullet-screen")||!1;t="true"!==e.toString(),$("halo-comment[bullet-screen]").each(function(){var e=this.shadowRoot.getElementById("halo-comment");t?$(e).attr("stop-bullet-screen","true"):$(e).removeAttr("stop-bullet-screen")}),t?a.addClass("stop-bullet-screen"):a.removeClass("stop-bullet-screen"),localStorage.setItem("stop-bullet-screen",t)})},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 o=$(".banner-info-desc");if(0!==o.length){const i=o.text();o.text("");let t,a="",n=!0;const s=function(){var e=a.length;n&&e
${this.alt&&DreamConfig.show_img_name?`

${this.alt}

`:""}`)})},initMode(){let e=localStorage.getItem("night")||!1;const t=t=>{t?document.documentElement.classList.add("night"):document.documentElement.classList.remove("night"),$("halo-comment").each(function(){var e=this.shadowRoot.getElementById("halo-comment");$(e)[(t?"add":"remove")+"Class"]("night")}),localStorage.setItem("night",t),e=t};$("#toggle-mode").on("click",()=>t("true"!==e.toString())),"system"===DreamConfig.default_theme&&window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>t(e.matches))},initNavbar(){var t=$(".navbar-nav a"),e=$(".panel-side-menu .link");let a=0;var{href:n,pathname:o}=location;if(o&&"/"!==o)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()}),a.on("click",e=>e.stopPropagation()))})},initScroll(){window.initTop=0,document.addEventListener("scroll",()=>{const e=$(document).scrollTop(),t=(o=e>window.initTop,window.initTop=e,o),a=$("body"),n=$(".actions");var o;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 a(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(),a(this).remove()}),e.on("click",".click-animation-close",function(e){e.stopPropagation();let t=a(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=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 a=DreamConfig.spark_input_content&&DreamConfig.spark_input_content.filter(e=>0sparkInput(t,a))})},loveTime(){let r=$(".love .love-time");if(0!==r.length){var e=r.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,a=(e=parseInt(e/60))%60;let n=(e=parseInt(e/60))%24,o=parseInt(e/24),i=0,s=d.getFullYear(),l=c.getFullYear();for(;s${o}天${n}${a}${t}秒`},1e3)}else i.innerText=DreamConfig.website_time}},initEffects(){Utils.isMobile()||(DreamConfig.cursor_move&&Utils.cachedScript(`${DreamConfig.theme_base}/source/js/cursor/move/${DreamConfig.cursor_move}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.cursor_click&&Utils.cachedScript(`${DreamConfig.theme_base}/source/js/cursor/click/${DreamConfig.cursor_click}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.enable_live2d&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/autoload.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_lantern_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/lantern.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_sakura_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/sakura.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_snowflake_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/snowflake.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_universe_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/universe.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_circle_magic_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/circleMagic.min.js?mew="+DreamConfig.theme_version))},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,"color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px")}};window.commonContext=t;{const a=["initCarousel","sparkInput","websiteTime"],n=["initEffects","loadMaintain","showThemeVersion"];Object.keys(t).forEach(e=>!a.includes(e)&&!n.includes(e)&&t[e]()),document.addEventListener("DOMContentLoaded",function(){$("html").addClass("loaded"),a.forEach(e=>t[e]&&t[e]())}),window.addEventListener("load",function(){n.forEach(e=>t[e]&&t[e]()),$("html").addClass("ready")})}})(); \ No newline at end of file +(()=>{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($(".widget.recent-comments .reply .link").html((e,t)=>Utils.renderedEmojiHtml(t)),e.length&&t.length&&!t[0].children.length)for(const a of e[0].children)t[0].append(a.cloneNode(!0))},initActions(){const a=$(".actions>.bullet-screen");"true"===localStorage.getItem("stop-bullet-screen")&&a.addClass("stop-bullet-screen"),0!==$("halo-comment[bullet-screen]").length&&a.removeClass("is-hidden-all");a.on("click",()=>{var t,e=localStorage.getItem("stop-bullet-screen")||!1;t="true"!==e.toString(),$("halo-comment[bullet-screen]").each(function(){var e=this.shadowRoot.getElementById("halo-comment");t?$(e).attr("stop-bullet-screen","true"):$(e).removeAttr("stop-bullet-screen")}),t?a.addClass("stop-bullet-screen"):a.removeClass("stop-bullet-screen"),localStorage.setItem("stop-bullet-screen",t)})},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 o=$(".banner-info-desc");if(0!==o.length){const i=o.text();o.text("");let t,a="",n=!0;const s=function(){var e=a.length;n&&e
${this.alt&&DreamConfig.show_img_name?`

${this.alt}

`:""}`)})},initMode(){let e=localStorage.getItem("night")||!1;const t=t=>{t?document.documentElement.classList.add("night"):document.documentElement.classList.remove("night"),$("halo-comment").each(function(){var e=this.shadowRoot.getElementById("halo-comment");$(e)[(t?"add":"remove")+"Class"]("night")}),localStorage.setItem("night",t),e=t};$("#toggle-mode").on("click",()=>t("true"!==e.toString())),"system"===DreamConfig.default_theme&&window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>t(e.matches))},initNavbar(){var t=$(".navbar-nav a"),e=$(".panel-side-menu .link");let a=0;var{href:n,pathname:o}=location;if(o&&"/"!==o)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()}),a.on("click",e=>e.stopPropagation()))})},initScroll(){window.initTop=0,document.addEventListener("scroll",()=>{const e=$(document).scrollTop(),t=(o=e>window.initTop,window.initTop=e,o),a=$("body"),n=$(".actions");var o;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 a(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(),a(this).remove()}),e.on("click",".click-animation-close",function(e){e.stopPropagation();let t=a(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),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 a=DreamConfig.spark_input_content&&DreamConfig.spark_input_content.filter(e=>0sparkInput(t,a))})},loveTime(){let r=$(".love .love-time");if(0!==r.length){var e=r.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,a=(e=parseInt(e/60))%60;let n=(e=parseInt(e/60))%24,o=parseInt(e/24),i=0,s=d.getFullYear(),l=c.getFullYear();for(;s${o}天${n}${a}${t}秒`},1e3)}else i.innerText=DreamConfig.website_time}},initEffects(){Utils.isMobile()||(DreamConfig.cursor_move&&Utils.cachedScript(`${DreamConfig.theme_base}/source/js/cursor/move/${DreamConfig.cursor_move}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.cursor_click&&Utils.cachedScript(`${DreamConfig.theme_base}/source/js/cursor/click/${DreamConfig.cursor_click}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.enable_live2d&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/autoload.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_lantern_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/lantern.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_sakura_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/sakura.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_snowflake_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/snowflake.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_universe_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/universe.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_circle_magic_mode&&Utils.cachedScript(DreamConfig.theme_base+"/source/js/effects/circleMagic.min.js?mew="+DreamConfig.theme_version))},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,"color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px")}};window.commonContext=t;{const a=["initCarousel","sparkInput","websiteTime"],n=["initEffects","loadMaintain","showThemeVersion"];Object.keys(t).forEach(e=>!a.includes(e)&&!n.includes(e)&&t[e]()),document.addEventListener("DOMContentLoaded",function(){$("html").addClass("loaded"),a.forEach(e=>t[e]&&t[e]())}),window.addEventListener("load",function(){n.forEach(e=>t[e]&&t[e]()),$("html").addClass("ready")})}})(); \ No newline at end of file diff --git a/source/js/journals.min.js b/source/js/journals.min.js index d3b38da..de51b24 100644 --- a/source/js/journals.min.js +++ b/source/js/journals.min.js @@ -1 +1 @@ -(()=>{let e=!1;const i={initEvent(){var n;e||((n=$("body")).on("click",".journal .comment",function(){$(this).parent().parent().siblings(".journal-comment").stop().slideToggle(200)}),n.on("click",".journal-content>.expand-done",function(){Utils.foldBlock($(this).parent())}),n.on("click",".journal-operation-item>.share",function(){var n=$(this).parents(".journal"),e="动态: "+n.find(".journal-date>em").text(),n=n.children(".journal-content").children(".main-content").text();DShare.sharePoster({image:DreamConfig.journals_share_image,title:e,description:220n.next()),e=!0)},initLike(){Utils.initLikeButton(".journal .like","journals")},foldJournals(){$(".journal .journal-content").each(function(){var n=$(this);this.scrollHeight>=DreamConfig.journals_fold_height?n.append('
'):n.removeClass("fold")})}};window.journalPjax=function(e){0!==$(".card.journal").length&&Object.keys(i).forEach(n=>window.pjaxSerialNumber===e&&i[n]())},window.pjaxSerialNumber||i.initEvent(),window.pjaxSerialNumber||i.initLike(),document.addEventListener("DOMContentLoaded",function(){window.pjaxSerialNumber||i.foldJournals()})})(); \ No newline at end of file +(()=>{let e=!1;const i={initEvent(){var n;e||((n=$("body")).on("click",".journal .comment",function(){$(this).parent().parent().siblings(".journal-comment").stop().slideToggle(200)}),n.on("click",".journal-content>.expand-done",function(){Utils.foldBlock($(this).parent())}),n.on("click",".journal-operation-item>.share",function(){var n=$(this).parents(".journal"),e="动态: "+n.find(".journal-date>em").text(),n=n.children(".journal-content").children(".main-content").text();DShare.sharePoster({image:DreamConfig.journals_share_image,title:e,description:220n.find("em")),e=!0)},initLike(){Utils.initLikeButton(".journal .like","journals")},foldJournals(){$(".journal .journal-content").each(function(){var n=$(this);this.scrollHeight>=DreamConfig.journals_fold_height?n.append('
'):n.removeClass("fold")})}};window.journalPjax=function(e){0!==$(".card.journal").length&&Object.keys(i).forEach(n=>window.pjaxSerialNumber===e&&i[n]())},window.pjaxSerialNumber||i.initEvent(),window.pjaxSerialNumber||i.initLike(),document.addEventListener("DOMContentLoaded",function(){window.pjaxSerialNumber||i.foldJournals()})})(); \ No newline at end of file diff --git a/template/widget/custom.ftl b/template/widget/custom.ftl new file mode 100644 index 0000000..128c625 --- /dev/null +++ b/template/widget/custom.ftl @@ -0,0 +1,8 @@ +
+ <#if sidebar.title?? && sidebar.title != '' && sidebar.icon?? && sidebar.icon != ''> +
+ ${sidebar.title} +
+ + ${sidebar.content} +
\ No newline at end of file