mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Change:Cover background blur #216
This commit is contained in:
		
							parent
							
								
									8225d35022
								
							
						
					
					
						commit
						bbcc8fbb91
					
				| @ -171,3 +171,15 @@ Bookshelf Label | ||||
|   border-style: solid; | ||||
|   color: #fce3a6; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| .cover-bg { | ||||
|   width: calc(100% + 40px); | ||||
|   height: calc(100% + 40px); | ||||
|   top: -20px; | ||||
|   left: -20px; | ||||
|   background-size: 100% 100%; | ||||
|   background-position: center; | ||||
|   opacity: 1; | ||||
|   filter: blur(20px); | ||||
| } | ||||
| @ -1,7 +1,9 @@ | ||||
| <template> | ||||
|   <div ref="card" :id="`book-card-${index}`" :style="{ width: width + 'px', height: height + 'px' }" class="absolute top-0 left-0 rounded-sm z-10 bg-primary cursor-pointer box-shadow-book" @mousedown.prevent @mouseup.prevent @mousemove.prevent @mouseover="mouseover" @mouseleave="mouseleave" @click="clickCard"> | ||||
|     <!-- When cover image does not fill --> | ||||
|     <div v-show="showCoverBg" class="w-full h-full absolute top-0 left-0 z-0" ref="coverBg" /> | ||||
|     <div v-show="showCoverBg" class="absolute top-0 left-0 w-full h-full overflow-hidden rounded-sm bg-primary"> | ||||
|       <div class="absolute cover-bg" ref="coverBg" /> | ||||
|     </div> | ||||
| 
 | ||||
|     <div class="w-full h-full absolute top-0 left-0 rounded overflow-hidden z-10"> | ||||
|       <div v-show="audiobook && !imageReady" class="absolute top-0 left-0 w-full h-full flex items-center justify-center" :style="{ padding: sizeMultiplier * 0.5 + 'rem' }"> | ||||
| @ -444,10 +446,6 @@ export default { | ||||
|     setCoverBg() { | ||||
|       if (this.$refs.coverBg) { | ||||
|         this.$refs.coverBg.style.backgroundImage = `url("${this.bookCoverSrc}")` | ||||
|         this.$refs.coverBg.style.backgroundSize = 'cover' | ||||
|         this.$refs.coverBg.style.backgroundPosition = 'center' | ||||
|         this.$refs.coverBg.style.opacity = 0.25 | ||||
|         this.$refs.coverBg.style.filter = 'blur(1px)' | ||||
|       } | ||||
|     }, | ||||
|     imageLoaded() { | ||||
| @ -467,7 +465,6 @@ export default { | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   mounted() {} | ||||
|   } | ||||
| } | ||||
| </script> | ||||
| @ -1,9 +1,10 @@ | ||||
| <template> | ||||
|   <div class="relative rounded-sm overflow-hidden" :style="{ height: height + 'px', width: width + 'px', maxWidth: width + 'px', minWidth: width + 'px' }"> | ||||
|     <div class="w-full h-full relative bg-bg"> | ||||
|       <div v-if="showCoverBg" class="bg-primary absolute top-0 left-0 w-full h-full"> | ||||
|         <div class="w-full h-full z-0" ref="coverBg" /> | ||||
|       <div v-show="showCoverBg" class="absolute top-0 left-0 w-full h-full overflow-hidden rounded-sm bg-primary"> | ||||
|         <div class="absolute cover-bg" ref="coverBg" /> | ||||
|       </div> | ||||
| 
 | ||||
|       <img v-if="audiobook" ref="cover" :src="fullCoverUrl" loading="lazy" @error="imageError" @load="imageLoaded" class="w-full h-full absolute top-0 left-0 z-10 duration-300 transition-opacity" :style="{ opacity: imageReady ? '1' : '0' }" :class="showCoverBg ? 'object-contain' : 'object-cover'" /> | ||||
|       <div v-show="loading && audiobook" class="absolute top-0 left-0 h-full w-full flex items-center justify-center"> | ||||
|         <p class="font-book text-center" :style="{ fontSize: 0.75 * sizeMultiplier + 'rem' }">{{ title }}</p> | ||||
| @ -135,10 +136,6 @@ export default { | ||||
|     setCoverBg() { | ||||
|       if (this.$refs.coverBg) { | ||||
|         this.$refs.coverBg.style.backgroundImage = `url("${this.fullCoverUrl}")` | ||||
|         this.$refs.coverBg.style.backgroundSize = 'cover' | ||||
|         this.$refs.coverBg.style.backgroundPosition = 'center' | ||||
|         this.$refs.coverBg.style.opacity = 0.25 | ||||
|         this.$refs.coverBg.style.filter = 'blur(1px)' | ||||
|       } | ||||
|     }, | ||||
|     hideCoverBg() {}, | ||||
|  | ||||
| @ -245,15 +245,11 @@ export default { | ||||
| 
 | ||||
|       if (showCoverBg) { | ||||
|         var coverbgwrapper = document.createElement('div') | ||||
|         coverbgwrapper.className = 'absolute top-0 left-0 w-full h-full bg-primary' | ||||
|         coverbgwrapper.className = 'absolute top-0 left-0 w-full h-full overflow-hidden rounded-sm bg-primary' | ||||
| 
 | ||||
|         var coverbg = document.createElement('div') | ||||
|         coverbg.className = 'w-full h-full' | ||||
|         coverbg.className = 'absolute cover-bg' | ||||
|         coverbg.style.backgroundImage = `url("${src}")` | ||||
|         coverbg.style.backgroundSize = 'cover' | ||||
|         coverbg.style.backgroundPosition = 'center' | ||||
|         coverbg.style.opacity = 0.25 | ||||
|         coverbg.style.filter = 'blur(1px)' | ||||
| 
 | ||||
|         coverbgwrapper.appendChild(coverbg) | ||||
|         imgdiv.appendChild(coverbgwrapper) | ||||
|  | ||||
| @ -1,9 +1,12 @@ | ||||
| <template> | ||||
|   <div class="relative rounded-sm overflow-hidden" :style="{ height: width * bookCoverAspectRatio + 'px', width: width + 'px', maxWidth: width + 'px', minWidth: width + 'px' }" @mouseover="isHovering = true" @mouseleave="isHovering = false"> | ||||
|     <div class="w-full h-full relative"> | ||||
|       <div v-if="showCoverBg" class="bg-primary absolute top-0 left-0 w-full h-full"> | ||||
|         <div class="w-full h-full z-0" ref="coverBg" /> | ||||
|       <div v-show="showCoverBg" class="absolute top-0 left-0 w-full h-full overflow-hidden rounded-sm bg-primary"> | ||||
|         <div class="absolute cover-bg" ref="coverBg" /> | ||||
|       </div> | ||||
|       <!-- <div v-if="showCoverBg" class="bg-primary absolute top-0 left-0 w-full h-full"> | ||||
|         <div class="w-full h-full z-0" ref="coverBg" /> | ||||
|       </div> --> | ||||
|       <img ref="cover" :src="cover" @error="imageError" @load="imageLoaded" class="w-full h-full absolute top-0 left-0" :class="showCoverBg ? 'object-contain' : 'object-cover'" /> | ||||
| 
 | ||||
|       <a v-if="!imageFailed && showOpenNewTab && isHovering" :href="cover" @click.stop target="_blank" class="absolute bg-primary flex items-center justify-center shadow-sm rounded-full hover:scale-110 transform duration-100" :style="{ top: sizeMultiplier * 0.5 + 'rem', right: sizeMultiplier * 0.5 + 'rem', width: 2.5 * sizeMultiplier + 'rem', height: 2.5 * sizeMultiplier + 'rem' }"> | ||||
| @ -60,10 +63,6 @@ export default { | ||||
|     setCoverBg() { | ||||
|       if (this.$refs.coverBg) { | ||||
|         this.$refs.coverBg.style.backgroundImage = `url("${this.src}")` | ||||
|         this.$refs.coverBg.style.backgroundSize = 'cover' | ||||
|         this.$refs.coverBg.style.backgroundPosition = 'center' | ||||
|         this.$refs.coverBg.style.opacity = 0.25 | ||||
|         this.$refs.coverBg.style.filter = 'blur(1px)' | ||||
|       } | ||||
|     }, | ||||
|     imageLoaded() { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user