mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-01-31 00:53:20 +08:00
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
"use strict";(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[596],{732:function(e,t,n){e.exports=n.p+"img/background.ea1b7ee7.jpg"},3153:function(e,t,n){e.exports=n.p+"img/logo.e8dbfa27.png"},4453:function(e,t,n){n.d(t,{A:function(){return m}});var a=n(6768),o=n(5130),i=n(4232);const r={id:"themeMask"},s=["cx","cy","r"],l=["r"],c=["opacity"];function u(e,t,n,u,g,d){const h=(0,a.g2)("font-awesome-icon");return(0,a.uX)(),(0,a.CE)("div",{id:"themeToggle",onClick:t[0]||(t[0]=(...e)=>d.handleToggleClick&&d.handleToggleClick(...e))},[(0,a.bF)(o.eB,{name:"icon-fade",mode:"out-in"},{default:(0,a.k6)(()=>[g.isAuto?((0,a.uX)(),(0,a.Wv)(h,{key:"auto-mode",icon:"circle-half-stroke",class:"auto-icon",style:{"font-size":"1.5em",color:"var(--theme-toggle-color)"}})):((0,a.uX)(),(0,a.CE)("svg",{key:"sun-moon",class:(0,i.C4)(["theme_toggle_svg",{dark:g.isDark}]),width:"1.5em",height:"1.5em",viewBox:"0 0 24 24",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",stroke:"currentColor"},[(0,a.Lk)("mask",r,[t[1]||(t[1]=(0,a.Lk)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"},null,-1)),(0,a.Lk)("circle",{class:"theme_toggle_circle1",fill:"black",cx:g.isDark?"50%":"100%",cy:g.isDark?"23%":"0%",r:g.isDark?"9":"5"},null,8,s)]),(0,a.Lk)("circle",{class:"theme_toggle_circle2",cx:"12",cy:"12",r:g.isDark?"9":"5",mask:"url(#themeMask)"},null,8,l),(0,a.Lk)("g",{class:"theme_toggle_g",stroke:"currentColor",opacity:g.isDark?0:1},[...t[2]||(t[2]=[(0,a.Lk)("line",{x1:"12",y1:"1",x2:"12",y2:"3"},null,-1),(0,a.Lk)("line",{x1:"12",y1:"21",x2:"12",y2:"23"},null,-1),(0,a.Lk)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"},null,-1),(0,a.Lk)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"},null,-1),(0,a.Lk)("line",{x1:"1",y1:"12",x2:"3",y2:"12"},null,-1),(0,a.Lk)("line",{x1:"21",y1:"12",x2:"23",y2:"12"},null,-1),(0,a.Lk)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"},null,-1),(0,a.Lk)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"},null,-1)])],8,c)],2))]),_:1})])}var g={name:"ToggleDark",data(){return{isDark:this.$store.getters.useDarkMode,isAuto:!this.$store.getters.cusDarkMode}},methods:{handleToggleClick(){this.isAuto?(this.isDark=!1,this.isAuto=!1,this.$store.commit("setCusDarkMode",!0),this.$store.commit("setUseDarkMode",!1)):this.isDark?(this.isAuto=!0,this.$store.commit("setCusDarkMode",!1)):(this.isDark=!0,this.$store.commit("setCusDarkMode",!0),this.$store.commit("setUseDarkMode",!0))}}},d=n(1241);const h=(0,d.A)(g,[["render",u],["__scopeId","data-v-466b2b5c"]]);var m=h},4632:function(e,t,n){n.d(t,{A:function(){return d}});var a=n(6768),o=n(4232);const i=["href","target"],r=["alt","src"];function s(e,t,n,s,l,c){return(0,a.uX)(),(0,a.CE)("a",{href:n.href,target:n.target,class:(0,o.C4)(e.logo-e.link)},[(0,a.Lk)("img",{class:(0,o.C4)(c.logoClasses),alt:n.alt,src:c.logoUrl},null,10,r)],10,i)}var l=n(8401),c={name:"Logo",props:{href:{type:String,default:"https://github.com/MarSeventh/CloudFlare-ImgBed"},target:{type:String,default:"_blank",validator:e=>["_blank","_self","_parent","_top"].includes(e)},alt:{type:String,default:"Sanyue logo"},customSrc:{type:String,default:""},position:{type:String,default:"fixed",validator:e=>["fixed","relative","absolute","static"].includes(e)},size:{type:String,default:"normal",validator:e=>["small","normal","large"].includes(e)},enableHover:{type:Boolean,default:!0}},computed:{...(0,l.L8)(["userConfig"]),logoUrl(){return this.customSrc||this.userConfig?.logoUrl||n(3153)},logoClasses(){return{logo:!0,[`logo--${this.position}`]:!0,[`logo--${this.size}`]:!0,"logo--hover-enabled":this.enableHover}}}},u=n(1241);const g=(0,u.A)(c,[["render",s],["__scopeId","data-v-a6188df6"]]);var d=g},4896:function(e,t,n){n(5331)},6975:function(e,t,n){n.d(t,{A:function(){return d}});var a=n(6768),o=n(4232);const i={key:0,class:"page-footer"},r=["href"];function s(e,t,n,s,l,c){const u=(0,a.g2)("font-awesome-icon");return c.disableFooter?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("div",i,[(0,a.Lk)("p",null,[(0,a.eW)("© 2024-"+(0,o.v_)(c.thisYear)+" Designed by ",1),t[0]||(t[0]=(0,a.Lk)("a",{class:"footer-name",href:"https://github.com/MarSeventh",target:"_blank"},"SanyueQi",-1)),t[1]||(t[1]=(0,a.eW)(" for You! ",-1)),(0,a.Lk)("a",{href:c.footerLink,target:"_blank"},[(0,a.bF)(u,{icon:"paper-plane",class:"footer-link-icon"})],8,r)])]))}var l=n(8401),c={name:"Footer",computed:{...(0,l.L8)(["userConfig"]),footerLink(){return this.userConfig?.footerLink||"https://github.com/MarSeventh"},thisYear(){return(new Date).getFullYear()},disableFooter(){return this.userConfig?.disableFooter||!1}}},u=n(1241);const g=(0,u.A)(c,[["render",s],["__scopeId","data-v-08acbaa9"]]);var d=g},7835:function(e,t,n){e.exports=n.p+"img/background-light.f17603bc.jpg"},8903:function(e,t,n){var a=n(8401);t.A={data(){return{bingWallPaperIndex:0,customWallPaperIndex:0,backgroundInterval:null,backgroundInitParams:null}},computed:{...(0,a.L8)(["userConfig","bingWallPapers","useDarkMode"]),bkInterval(){return this.userConfig?.bkInterval||3e3},bkOpacity(){return this.userConfig?.bkOpacity||1},backgroundImagesTemplate(){return'\n <img id="bg1" class="background-image1" alt="Background Image"/>\n <img id="bg2" class="background-image2" alt="Background Image"/>\n '},backgroundImagesStyles(){return"\n .background-image1 {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: -1;\n opacity: 0;\n transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);\n }\n .background-image2 {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: -1;\n opacity: 0;\n transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);\n }\n "}},watch:{useDarkMode(e,t){e!==t&&this.backgroundInitParams&&this.$nextTick(()=>{this.smoothThemeTransition(this.backgroundInitParams.configKey,this.backgroundInitParams.containerSelector,this.backgroundInitParams.useDefaultBackground,this.backgroundInitParams.autoCreateElements)})}},mounted(){this.injectBackgroundStyles()},beforeUnmount(){this.backgroundInterval&&clearInterval(this.backgroundInterval),this.clearBackgroundImages(!0),this.removeBackgroundStyles()},methods:{injectBackgroundStyles(){const e="background-manager-styles";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=this.backgroundImagesStyles,document.head.appendChild(t)}},removeBackgroundStyles(){const e="background-manager-styles",t=document.getElementById(e);t&&t.remove()},createBackgroundElements(e){if(!e)return void console.warn("未提供有效的容器元素");if(document.getElementById("bg1")||document.getElementById("bg2"))return;const t=document.createElement("img");t.id="bg1",t.className="background-image1",t.alt="Background Image";const n=document.createElement("img");n.id="bg2",n.className="background-image2",n.alt="Background Image",e.insertBefore(t,e.firstChild),e.insertBefore(n,e.firstChild)},initializeBackground(e,t=".login",n=!1,a=!1){if(this.backgroundInitParams={configKey:e,containerSelector:t,useDefaultBackground:n,autoCreateElements:a},a){const e=document.querySelector(t);!e||document.getElementById("bg1")&&document.getElementById("bg2")||this.createBackgroundElements(e)}const o=document.getElementById("bg1"),i=document.getElementById("bg2");if(!o||!i)return void console.warn("背景图元素 #bg1 或 #bg2 未找到,请确保页面中包含这些元素或启用 autoCreateElements");const r=this.userConfig?.[e];"bing"===r?this.setupBingWallpaper(o,i,t):Array.isArray(r)&&r.length>1?this.setupCustomWallpaperCarousel(o,i,r,t):Array.isArray(r)&&1===r.length?this.setupSingleCustomWallpaper(o,r[0],t):n&&this.setupDefaultWallpaper(o,t)},setupBingWallpaper(e,t,n){this.$store.dispatch("fetchBingWallPapers").then(()=>{0!==this.bingWallPapers.length&&(this.loadBackgroundImage(e,this.bingWallPapers[this.bingWallPaperIndex]?.url,n),this.backgroundInterval=setInterval(()=>{this.switchBingWallpaper(e,t)},this.bkInterval))})},setupCustomWallpaperCarousel(e,t,n,a){this.loadBackgroundImage(e,n[this.customWallPaperIndex],a),this.backgroundInterval=setInterval(()=>{this.switchCustomWallpaper(e,t,n)},this.bkInterval)},setupSingleCustomWallpaper(e,t,n){this.loadBackgroundImage(e,t,n)},setupDefaultWallpaper(e,t){const a=this.useDarkMode,o=n(a?732:7835);this.loadBackgroundImage(e,o,t)},loadBackgroundImage(e,t,n){e.src=t,e.onload=()=>{e.style.opacity=this.bkOpacity;const t=document.querySelector(n);t&&(t.style.background="transparent")}},switchBingWallpaper(e,t){if(0===this.bingWallPapers.length)return;const n=0!=e.style.opacity?e:t,a=0!=e.style.opacity?t:e;n.style.opacity=0,this.bingWallPaperIndex=(this.bingWallPaperIndex+1)%this.bingWallPapers.length,a.src=this.bingWallPapers[this.bingWallPaperIndex]?.url,a.onload=()=>{a.style.opacity=this.bkOpacity}},switchCustomWallpaper(e,t,n){const a=0!=e.style.opacity?e:t,o=0!=e.style.opacity?t:e;a.style.opacity=0,this.customWallPaperIndex=(this.customWallPaperIndex+1)%n.length,o.src=n[this.customWallPaperIndex],o.onload=()=>{o.style.opacity=this.bkOpacity}},clearBackgroundInterval(){this.backgroundInterval&&(clearInterval(this.backgroundInterval),this.backgroundInterval=null)},clearBackgroundImages(e=!1){const t=document.getElementById("bg1"),n=document.getElementById("bg2");e?(t&&(t.style.transition="none",t.style.opacity=0,t.src="",setTimeout(()=>{t&&(t.style.transition="opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1)")},50)),n&&(n.style.transition="none",n.style.opacity=0,n.src="",setTimeout(()=>{n&&(n.style.transition="opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1)")},50))):(t&&(t.style.opacity=0,setTimeout(()=>{t&&(t.src="")},800)),n&&(n.style.opacity=0,setTimeout(()=>{n&&(n.src="")},800)))},smoothThemeTransition(e,t=".login",a=!1,o=!1){const i=this.userConfig?.[e];if(!a||void 0!==i)return void this.reinitializeBackground(e,t,a,o);const r=document.getElementById("bg1"),s=document.getElementById("bg2");if(!r||!s)return void this.reinitializeBackground(e,t,a,o);const l=0!=r.style.opacity?r:s,c=0!=r.style.opacity?s:r,u=this.useDarkMode,g=n(u?732:7835),d=new Image;d.onload=()=>{c.src=g,c.onload=()=>{l.style.opacity=0,setTimeout(()=>{c.style.opacity=this.bkOpacity;const e=document.querySelector(t);e&&(e.style.background="transparent")},50)}},d.onerror=()=>{console.warn("主题背景图预加载失败,回退到直接切换"),this.reinitializeBackground(e,t,a,o)},d.src=g},reinitializeBackground(e,t=".login",n=!1,a=!1){this.clearBackgroundInterval(),this.clearBackgroundImages(!0),this.bingWallPaperIndex=0,this.customWallPaperIndex=0,setTimeout(()=>{this.initializeBackground(e,t,n,a)},100)}}}}}]);
|
|
//# sourceMappingURL=596.f153b5f9.js.map
|