mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-02-01 14:44:02 +00:00
2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
"use strict";(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[162],{732:function(e,t,a){e.exports=a.p+"img/background.ea1b7ee7.jpg"},3153:function(e,t,a){e.exports=a.p+"img/logo.e8dbfa27.png"},3525:function(e,t,a){a.d(t,{A:function(){return h}});var n=a(6768),r=a(4232);const i={id:"themeMask"},o=["cx","cy","r"],s=["r"],l=["opacity"];function c(e,t,a,c,g,u){return(0,n.uX)(),(0,n.CE)("div",{id:"themeToggle",onClick:t[0]||(t[0]=(...e)=>u.handleToggleClick&&u.handleToggleClick(...e))},[((0,n.uX)(),(0,n.CE)("svg",{class:(0,r.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,n.Lk)("mask",i,[t[1]||(t[1]=(0,n.Lk)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"},null,-1)),(0,n.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,o)]),(0,n.Lk)("circle",{class:"theme_toggle_circle2",cx:"12",cy:"12",r:g.isDark?"9":"5",mask:"url(#themeMask)"},null,8,s),(0,n.Lk)("g",{class:"theme_toggle_g",stroke:"currentColor",opacity:g.isDark?0:1},t[2]||(t[2]=[(0,n.Fv)('<line x1="12" y1="1" x2="12" y2="3" data-v-019ed83e></line><line x1="12" y1="21" x2="12" y2="23" data-v-019ed83e></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-019ed83e></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-019ed83e></line><line x1="1" y1="12" x2="3" y2="12" data-v-019ed83e></line><line x1="21" y1="12" x2="23" y2="12" data-v-019ed83e></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-019ed83e></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-019ed83e></line>',8)]),8,l)],2))])}var g={name:"ToggleDark",data(){return{isDark:this.$store.getters.useDarkMode}},methods:{handleToggleClick(){this.isDark=!this.isDark,this.$store.commit("setUseDarkMode",this.isDark),this.$store.commit("setCusDarkMode",!0)}}},u=a(1241);const d=(0,u.A)(g,[["render",c],["__scopeId","data-v-019ed83e"]]);var h=d},4632:function(e,t,a){a.d(t,{A:function(){return d}});var n=a(6768),r=a(4232);const i=["href","target"],o=["alt","src"];function s(e,t,a,s,l,c){return(0,n.uX)(),(0,n.CE)("a",{href:a.href,target:a.target,class:(0,r.C4)(e.logo-e.link)},[(0,n.Lk)("img",{class:(0,r.C4)(c.logoClasses),alt:a.alt,src:c.logoUrl},null,10,o)],10,i)}var l=a(782),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||a(3153)},logoClasses(){return{logo:!0,[`logo--${this.position}`]:!0,[`logo--${this.size}`]:!0,"logo--hover-enabled":this.enableHover}}}},g=a(1241);const u=(0,g.A)(c,[["render",s],["__scopeId","data-v-a6188df6"]]);var d=u},6975:function(e,t,a){a.d(t,{A:function(){return d}});var n=a(6768),r=a(4232);const i={key:0,class:"page-footer"},o=["href"];function s(e,t,a,s,l,c){const g=(0,n.g2)("font-awesome-icon");return c.disableFooter?(0,n.Q3)("",!0):((0,n.uX)(),(0,n.CE)("div",i,[(0,n.Lk)("p",null,[(0,n.eW)("© 2024-"+(0,r.v_)(c.thisYear)+" Designed by ",1),t[0]||(t[0]=(0,n.Lk)("a",{class:"footer-name",href:"https://github.com/MarSeventh",target:"_blank"},"SanyueQi",-1)),t[1]||(t[1]=(0,n.eW)(" for You! ")),(0,n.Lk)("a",{href:c.footerLink,target:"_blank"},[(0,n.bF)(g,{icon:"paper-plane",class:"footer-link-icon"})],8,o)])]))}var l=a(782),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}}},g=a(1241);const u=(0,g.A)(c,[["render",s],["__scopeId","data-v-08acbaa9"]]);var d=u},7835:function(e,t,a){e.exports=a.p+"img/background-light.f17603bc.jpg"},8903:function(e,t,a){var n=a(782);t.A={data(){return{bingWallPaperIndex:0,customWallPaperIndex:0,backgroundInterval:null,backgroundInitParams:null}},computed:{...(0,n.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 a=document.createElement("img");a.id="bg2",a.className="background-image2",a.alt="Background Image",e.insertBefore(t,e.firstChild),e.insertBefore(a,e.firstChild)},initializeBackground(e,t=".login",a=!1,n=!1){if(this.backgroundInitParams={configKey:e,containerSelector:t,useDefaultBackground:a,autoCreateElements:n},n){const e=document.querySelector(t);!e||document.getElementById("bg1")&&document.getElementById("bg2")||this.createBackgroundElements(e)}const r=document.getElementById("bg1"),i=document.getElementById("bg2");if(!r||!i)return void console.warn("背景图元素 #bg1 或 #bg2 未找到,请确保页面中包含这些元素或启用 autoCreateElements");const o=this.userConfig?.[e];"bing"===o?this.setupBingWallpaper(r,i,t):Array.isArray(o)&&o.length>1?this.setupCustomWallpaperCarousel(r,i,o,t):Array.isArray(o)&&1===o.length?this.setupSingleCustomWallpaper(r,o[0],t):a&&this.setupDefaultWallpaper(r,t)},setupBingWallpaper(e,t,a){this.$store.dispatch("fetchBingWallPapers").then(()=>{0!==this.bingWallPapers.length&&(this.loadBackgroundImage(e,this.bingWallPapers[this.bingWallPaperIndex]?.url,a),this.backgroundInterval=setInterval(()=>{this.switchBingWallpaper(e,t)},this.bkInterval))})},setupCustomWallpaperCarousel(e,t,a,n){this.loadBackgroundImage(e,a[this.customWallPaperIndex],n),this.backgroundInterval=setInterval(()=>{this.switchCustomWallpaper(e,t,a)},this.bkInterval)},setupSingleCustomWallpaper(e,t,a){this.loadBackgroundImage(e,t,a)},setupDefaultWallpaper(e,t){const n=this.useDarkMode,r=a(n?732:7835);this.loadBackgroundImage(e,r,t)},loadBackgroundImage(e,t,a){e.src=t,e.onload=()=>{e.style.opacity=this.bkOpacity;const t=document.querySelector(a);t&&(t.style.background="transparent")}},switchBingWallpaper(e,t){if(0===this.bingWallPapers.length)return;const a=0!=e.style.opacity?e:t,n=0!=e.style.opacity?t:e;a.style.opacity=0,this.bingWallPaperIndex=(this.bingWallPaperIndex+1)%this.bingWallPapers.length,n.src=this.bingWallPapers[this.bingWallPaperIndex]?.url,n.onload=()=>{n.style.opacity=this.bkOpacity}},switchCustomWallpaper(e,t,a){const n=0!=e.style.opacity?e:t,r=0!=e.style.opacity?t:e;n.style.opacity=0,this.customWallPaperIndex=(this.customWallPaperIndex+1)%a.length,r.src=a[this.customWallPaperIndex],r.onload=()=>{r.style.opacity=this.bkOpacity}},clearBackgroundInterval(){this.backgroundInterval&&(clearInterval(this.backgroundInterval),this.backgroundInterval=null)},clearBackgroundImages(e=!1){const t=document.getElementById("bg1"),a=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)),a&&(a.style.transition="none",a.style.opacity=0,a.src="",setTimeout(()=>{a&&(a.style.transition="opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1)")},50))):(t&&(t.style.opacity=0,setTimeout(()=>{t&&(t.src="")},800)),a&&(a.style.opacity=0,setTimeout(()=>{a&&(a.src="")},800)))},smoothThemeTransition(e,t=".login",n=!1,r=!1){const i=this.userConfig?.[e];if(!n||void 0!==i)return void this.reinitializeBackground(e,t,n,r);const o=document.getElementById("bg1"),s=document.getElementById("bg2");if(!o||!s)return void this.reinitializeBackground(e,t,n,r);const l=0!=o.style.opacity?o:s,c=0!=o.style.opacity?s:o,g=this.useDarkMode,u=a(g?732:7835),d=new Image;d.onload=()=>{c.src=u,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,n,r)},d.src=u},reinitializeBackground(e,t=".login",a=!1,n=!1){this.clearBackgroundInterval(),this.clearBackgroundImages(!0),this.bingWallPaperIndex=0,this.customWallPaperIndex=0,setTimeout(()=>{this.initializeBackground(e,t,a,n)},100)}}}}}]);
|
|
//# sourceMappingURL=162.8a5db2a3.js.map
|