UNPKG

hexo-theme-redefine

Version:

Redefine your writing with Hexo Theme Redefine.

2 lines 4.41 kB
import o from"./layouts/bookmarkNav.js";import t from"./layouts/categoryList.js";import _ from"./layouts/essays.js";import e from"./layouts/homeBanner.js";import a from"./layouts/lazyload.js";import{initTOC as s}from"./layouts/toc.js";import{navbarShrink as r}from"./layouts/navbarShrink.js";import i from"./plugins/masonry.js";import n from"./plugins/mermaid.js";import l from"./plugins/pangu.js";import m from"./plugins/tabs.js";import p from"./plugins/typed.js";import g from"./tools/codeBlock.js";import c from"./tools/expirationDate.js";import f from"./tools/lightDarkSwitch.js";import{initLocalSearchGlobals as h,initLocalSearchPage as u}from"./tools/localSearch.js";import y from"./tools/runtime.js";import b from"./tools/scrollTopBottom.js";import d from"./tools/imageViewer.js";import{initTocToggle as j}from"./tools/tocToggle.js";import{initUtilsGlobals as k,initUtilsPage as S}from"./utils.js";import{onBeforeContentReplace as v,onPageView as x,onReady as N,onVisitStart as T}from"./app/lifecycle.js";import{abortPageScope as w,createPageScope as B,getAppSignal as E}from"./app/pageScope.js";import{getStyleStatus as L,setStyleStatus as z,styleStatus as D}from"./state/styleStatus.js";const safeRun=(o,t)=>{try{t()}catch(t){console.error(`[redefine] ${o} failed:`,t)}};let F=!1,I=!1;const initPage=()=>{const h=B(),b=E();safeRun("utils:page",(()=>{S({signal:h})})),safeRun("homeBanner",(()=>{e({signal:h})})),safeRun("expirationDate",(()=>{c()})),safeRun("modeToggle",(()=>{f({signal:h,appSignal:b})})),safeRun("imageViewer",(()=>{d({signal:h,appSignal:b})})),r.setNavigating(!1),r.refresh(),safeRun("footerRuntime",(()=>{theme.footer?.runtime&&y()})),safeRun("toc",(()=>{theme.articles?.toc?.enable&&s({signal:b})})),safeRun("tabs",(()=>{theme.articles?.toc?.enable&&m({signal:b})})),safeRun("essays",(()=>{"undefined"!=typeof moment&&_()})),safeRun("pangu",(()=>{theme.articles?.pangu_js&&l()})),safeRun("mermaid",(()=>{theme.plugins?.mermaid?.enable&&n()})),safeRun("masonry",(()=>{i({signal:h})})),safeRun("typed",(()=>{const o=theme.home_banner?.subtitle||{},t=o.text;(0!==(Array.isArray(t)?t:t?[t]:[]).length||o.hitokoto&&o.hitokoto.enable)&&location.pathname===config.root&&p("subtitle")})),safeRun("localSearch",(()=>{!0===theme.navbar?.search?.enable&&u()})),safeRun("copyCode",(()=>{!0===theme.articles?.code_block?.copy&&g()})),safeRun("lazyload",(()=>{!0===theme.articles?.lazyload&&a()})),safeRun("bookmarkNav",(()=>{theme.bookmarks&&0!==theme.bookmarks.length&&o({signal:b})})),safeRun("categoryList",(()=>{t()}))};export const main={themeInfo:{theme:`Redefine v${theme.version}`,author:"EvanNotFound",repository:"https://github.com/EvanNotFound/hexo-theme-redefine"},styleStatus:D,getStyleStatus:L,setStyleStatus:z,printThemeInfo:()=>{console.log("\n +======================================================================================+\n | |\n | _____ _ _ _____ __ __ _____ ____ _____ ____ _____ _____ ___ _ _ _____ |\n | |_ _| | | | ____| \\/ | ____| | _ \\| ____| _ \\| ____| ___|_ _| \\ | | ____| |\n | | | | |_| | _| | |\\/| | _| | |_) | _| | | | | _| | |_ | || \\| | _| |\n | | | | _ | |___| | | | |___ | _ <| |___| |_| | |___| _| | || |\\ | |___ |\n | |_| |_| |_|_____|_| |_|_____| |_| \\_\\_____|____/|_____|_| |___|_| \\_|_____| |\n | |\n | https://github.com/EvanNotFound/hexo-theme-redefine |\n +======================================================================================+\n ")},refresh:()=>{initPage()}};export function initMain(){main.printThemeInfo()}N((()=>{initMain(),(()=>{if(F)return;F=!0;const o=E();safeRun("utils:globals",(()=>{k({signal:o})})),safeRun("navbar:globals",(()=>{r.initGlobals({signal:o})})),safeRun("tocToggle:globals",(()=>{j({signal:o})})),safeRun("scrollTopBottom:globals",(()=>{b({signal:o})})),safeRun("tabs:globals",(()=>{m({signal:o})})),safeRun("categoryList:globals",(()=>{t({signal:o})})),safeRun("localSearch:globals",(()=>{h({signal:o})})),I||(I=!0,window.addEventListener("redefine:page:refresh",(()=>{initPage()})))})()})),x((()=>{initPage()})),v((()=>{w()})),T((()=>{r.setNavigating(!0)})); //# sourceMappingURL=main.js.map