2021-08-18 00:01:11 +02:00
|
|
|
<template>
|
2021-11-16 03:09:42 +01:00
|
|
|
<div ref="wrapper" class="relative book-card" :data-bookId="audiobookId" :id="`book-card-${audiobookId}`">
|
|
|
|
<template v-if="!showCard">
|
|
|
|
<div class="rounded-sm h-full overflow-hidden relative" :style="{ padding: `${paddingY}px ${paddingX}px` }">
|
|
|
|
<div class="bg-bg flex items-center justify-center p-2" :style="{ height: height + 'px', width: width + 'px' }">
|
|
|
|
<p class="font-book text-center" :style="{ fontSize: 0.75 * sizeMultiplier + 'rem' }">{{ title }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<!-- New Book Flag -->
|
|
|
|
<div v-show="isNew" class="absolute top-4 left-0 w-4 h-10 pr-2 bg-darkgreen box-shadow-xl z-20">
|
|
|
|
<div class="absolute top-0 left-0 w-full h-full transform -rotate-90 flex items-center justify-center">
|
|
|
|
<p class="text-center text-sm">New</p>
|
|
|
|
</div>
|
|
|
|
<div class="absolute -bottom-4 left-0 triangle-right" />
|
2021-09-01 20:47:18 +02:00
|
|
|
</div>
|
|
|
|
|
2021-11-16 03:09:42 +01:00
|
|
|
<div class="rounded-sm h-full overflow-hidden relative" :style="{ padding: `${paddingY}px ${paddingX}px` }">
|
|
|
|
<nuxt-link :to="isSelectionMode ? '' : `/audiobook/${audiobookId}`" class="cursor-pointer">
|
|
|
|
<div class="w-full relative box-shadow-book" :style="{ height: height + 'px' }" @click="clickCard" @mouseover="isHovering = true" @mouseleave="isHovering = false">
|
|
|
|
<covers-book-cover :audiobook="audiobook" :author-override="authorFormat" :width="width" />
|
2021-08-18 00:01:11 +02:00
|
|
|
|
2021-11-16 03:09:42 +01:00
|
|
|
<!-- Hidden SM and DOWN -->
|
2021-12-01 03:02:40 +01:00
|
|
|
<div v-show="isHovering || isSelectionMode || isMoreMenuOpen" class="absolute top-0 left-0 w-full h-full bg-black rounded hidden md:block z-20" :class="overlayWrapperClasslist">
|
2021-11-16 03:09:42 +01:00
|
|
|
<div v-show="showPlayButton" class="h-full flex items-center justify-center">
|
|
|
|
<div class="hover:text-gray-200 hover:scale-110 transform duration-200" @click.stop.prevent="play">
|
|
|
|
<span class="material-icons" :style="{ fontSize: playIconFontSize + 'rem' }">play_circle_filled</span>
|
|
|
|
</div>
|
2021-09-01 20:47:18 +02:00
|
|
|
</div>
|
2021-11-16 03:09:42 +01:00
|
|
|
<div v-show="showReadButton" class="h-full flex items-center justify-center">
|
|
|
|
<div class="hover:text-gray-200 hover:scale-110 transform duration-200" @click.stop.prevent="clickReadEBook">
|
|
|
|
<span class="material-icons" :style="{ fontSize: playIconFontSize + 'rem' }">auto_stories</span>
|
|
|
|
</div>
|
2021-10-10 23:36:21 +02:00
|
|
|
</div>
|
2021-09-07 00:42:15 +02:00
|
|
|
|
2021-11-16 03:09:42 +01:00
|
|
|
<div v-if="userCanUpdate" v-show="!isSelectionMode" class="absolute cursor-pointer hover:text-yellow-300 hover:scale-125 transform duration-50" :style="{ top: 0.375 * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem' }" @click.stop.prevent="editClick">
|
|
|
|
<span class="material-icons" :style="{ fontSize: sizeMultiplier + 'rem' }">edit</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="absolute cursor-pointer hover:text-yellow-300 hover:scale-125 transform duration-100" :style="{ top: 0.375 * sizeMultiplier + 'rem', left: 0.375 * sizeMultiplier + 'rem' }" @click.stop.prevent="selectBtnClick">
|
|
|
|
<span class="material-icons" :class="selected ? 'text-yellow-400' : ''" :style="{ fontSize: 1.25 * sizeMultiplier + 'rem' }">{{ selected ? 'radio_button_checked' : 'radio_button_unchecked' }}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- More Icon -->
|
|
|
|
<div ref="moreIcon" v-show="!isSelectionMode" class="hidden md:block absolute cursor-pointer hover:text-yellow-300" :style="{ bottom: 0.375 * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem' }" @click.stop.prevent="clickShowMore">
|
|
|
|
<span class="material-icons" :style="{ fontSize: 1.2 * sizeMultiplier + 'rem' }">more_vert</span>
|
|
|
|
</div>
|
2021-09-01 20:47:18 +02:00
|
|
|
</div>
|
2021-09-07 00:42:15 +02:00
|
|
|
|
2021-11-16 03:09:42 +01:00
|
|
|
<div v-if="volumeNumber && showVolumeNumber && !isHovering && !isSelectionMode" class="absolute rounded-lg bg-black bg-opacity-90 box-shadow-md" :style="{ top: 0.375 * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem` }">
|
|
|
|
<p :style="{ fontSize: sizeMultiplier * 0.8 + 'rem' }">#{{ volumeNumber }}</p>
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
2021-11-10 03:30:44 +01:00
|
|
|
|
2021-11-16 03:09:42 +01:00
|
|
|
<!-- EBook Icon -->
|
|
|
|
<div
|
|
|
|
v-if="showSmallEBookIcon"
|
|
|
|
class="absolute rounded-full bg-blue-500 flex items-center justify-center bg-opacity-90 hover:scale-125 transform duration-200"
|
|
|
|
:style="{ bottom: 0.375 * sizeMultiplier + 'rem', left: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem`, width: 1.5 * sizeMultiplier + 'rem', height: 1.5 * sizeMultiplier + 'rem' }"
|
|
|
|
@click.stop.prevent="clickReadEBook"
|
|
|
|
>
|
|
|
|
<!-- <p :style="{ fontSize: sizeMultiplier * 0.8 + 'rem' }">EBook</p> -->
|
|
|
|
<span class="material-icons text-white" :style="{ fontSize: sizeMultiplier * 1 + 'rem' }">auto_stories</span>
|
2021-11-10 03:30:44 +01:00
|
|
|
</div>
|
2021-09-07 00:42:15 +02:00
|
|
|
|
2021-12-01 03:02:40 +01:00
|
|
|
<div v-show="!isSelectionMode" class="absolute bottom-0 left-0 h-1 shadow-sm max-w-full z-10" :class="userIsRead ? 'bg-success' : 'bg-yellow-400'" :style="{ width: width * userProgressPercent + 'px' }"></div>
|
2021-09-26 22:34:08 +02:00
|
|
|
|
2021-11-16 03:09:42 +01:00
|
|
|
<ui-tooltip v-if="showError" :text="errorText" class="absolute bottom-4 left-0">
|
|
|
|
<div :style="{ height: 1.5 * sizeMultiplier + 'rem', width: 2.5 * sizeMultiplier + 'rem' }" class="bg-error rounded-r-full shadow-md flex items-center justify-end border-r border-b border-red-300">
|
|
|
|
<span class="material-icons text-red-100 pr-1" :style="{ fontSize: 0.875 * sizeMultiplier + 'rem' }">priority_high</span>
|
|
|
|
</div>
|
|
|
|
</ui-tooltip>
|
2021-10-02 20:50:39 +02:00
|
|
|
</div>
|
2021-11-16 03:09:42 +01:00
|
|
|
</nuxt-link>
|
|
|
|
</div>
|
|
|
|
</template>
|
2021-08-27 01:32:05 +02:00
|
|
|
</div>
|
2021-08-18 00:01:11 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-11-10 03:30:44 +01:00
|
|
|
import Vue from 'vue'
|
|
|
|
import MoreMenu from '@/components/widgets/MoreMenu'
|
|
|
|
|
2021-08-18 00:01:11 +02:00
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
audiobook: {
|
|
|
|
type: Object,
|
|
|
|
default: () => null
|
|
|
|
},
|
|
|
|
userProgress: {
|
|
|
|
type: Object,
|
|
|
|
default: () => null
|
2021-08-26 16:47:51 +02:00
|
|
|
},
|
|
|
|
width: {
|
|
|
|
type: Number,
|
|
|
|
default: 120
|
2021-09-26 22:34:08 +02:00
|
|
|
},
|
2021-10-30 03:42:28 +02:00
|
|
|
paddingY: {
|
|
|
|
type: Number,
|
|
|
|
default: 16
|
|
|
|
},
|
2021-11-16 03:09:42 +01:00
|
|
|
isBookshelfBook: Boolean,
|
2021-09-26 22:34:08 +02:00
|
|
|
showVolumeNumber: Boolean
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-11-16 03:09:42 +01:00
|
|
|
showCard: false,
|
2021-11-10 03:30:44 +01:00
|
|
|
isHovering: false,
|
|
|
|
isMoreMenuOpen: false,
|
|
|
|
isProcessingReadUpdate: false,
|
2021-11-16 03:09:42 +01:00
|
|
|
rescanning: false,
|
|
|
|
timesVisible: 0
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2021-10-02 20:50:39 +02:00
|
|
|
showExperimentalFeatures() {
|
|
|
|
return this.$store.state.showExperimentalFeatures
|
|
|
|
},
|
2021-09-01 20:47:18 +02:00
|
|
|
isNew() {
|
2021-09-21 23:42:01 +02:00
|
|
|
return this.tags.includes('New')
|
2021-09-01 20:47:18 +02:00
|
|
|
},
|
|
|
|
tags() {
|
|
|
|
return this.audiobook.tags || []
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
audiobookId() {
|
|
|
|
return this.audiobook.id
|
|
|
|
},
|
2021-09-27 13:52:21 +02:00
|
|
|
hasEbook() {
|
|
|
|
return this.audiobook.numEbooks
|
|
|
|
},
|
2021-10-10 23:36:21 +02:00
|
|
|
hasTracks() {
|
|
|
|
return this.audiobook.numTracks
|
|
|
|
},
|
2021-08-27 01:32:05 +02:00
|
|
|
isSelectionMode() {
|
2021-09-28 13:44:40 +02:00
|
|
|
return !!this.selectedAudiobooks.length
|
2021-08-27 01:32:05 +02:00
|
|
|
},
|
|
|
|
selectedAudiobooks() {
|
|
|
|
return this.$store.state.selectedAudiobooks
|
|
|
|
},
|
|
|
|
selected() {
|
|
|
|
return this.$store.getters['getIsAudiobookSelected'](this.audiobookId)
|
|
|
|
},
|
|
|
|
processingBatch() {
|
|
|
|
return this.$store.state.processingBatch
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
book() {
|
|
|
|
return this.audiobook.book || {}
|
|
|
|
},
|
|
|
|
height() {
|
|
|
|
return this.width * 1.6
|
|
|
|
},
|
2021-08-26 16:47:51 +02:00
|
|
|
sizeMultiplier() {
|
|
|
|
return this.width / 120
|
|
|
|
},
|
|
|
|
paddingX() {
|
|
|
|
return 16 * this.sizeMultiplier
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
title() {
|
|
|
|
return this.book.title
|
|
|
|
},
|
2021-08-26 16:47:51 +02:00
|
|
|
playIconFontSize() {
|
|
|
|
return Math.max(2, 3 * this.sizeMultiplier)
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
author() {
|
|
|
|
return this.book.author
|
|
|
|
},
|
2021-08-25 03:24:40 +02:00
|
|
|
authorFL() {
|
|
|
|
return this.book.authorFL || this.author
|
|
|
|
},
|
|
|
|
authorLF() {
|
|
|
|
return this.book.authorLF || this.author
|
|
|
|
},
|
|
|
|
authorFormat() {
|
|
|
|
if (!this.orderBy || !this.orderBy.startsWith('book.author')) return null
|
|
|
|
return this.orderBy === 'book.authorLF' ? this.authorLF : this.authorFL
|
|
|
|
},
|
|
|
|
volumeNumber() {
|
|
|
|
return this.book.volumeNumber || null
|
|
|
|
},
|
|
|
|
orderBy() {
|
|
|
|
return this.$store.getters['user/getUserSetting']('orderBy')
|
|
|
|
},
|
|
|
|
filterBy() {
|
|
|
|
return this.$store.getters['user/getUserSetting']('filterBy')
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
userProgressPercent() {
|
|
|
|
return this.userProgress ? this.userProgress.progress || 0 : 0
|
|
|
|
},
|
2021-09-06 21:13:01 +02:00
|
|
|
userIsRead() {
|
|
|
|
return this.userProgress ? !!this.userProgress.isRead : false
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
showError() {
|
2021-12-02 02:07:03 +01:00
|
|
|
return this.hasMissingParts || this.hasInvalidParts || this.isMissing || this.isInvalid
|
2021-10-10 23:36:21 +02:00
|
|
|
},
|
2021-10-23 03:08:02 +02:00
|
|
|
isStreaming() {
|
|
|
|
return this.$store.getters['getAudiobookIdStreaming'] === this.audiobookId
|
|
|
|
},
|
2021-10-10 23:36:21 +02:00
|
|
|
showReadButton() {
|
|
|
|
return !this.isSelectionMode && this.showExperimentalFeatures && !this.showPlayButton && this.hasEbook
|
|
|
|
},
|
|
|
|
showPlayButton() {
|
2021-12-02 02:07:03 +01:00
|
|
|
return !this.isSelectionMode && !this.isMissing && !this.isInvalid && this.hasTracks && !this.isStreaming
|
2021-10-10 23:36:21 +02:00
|
|
|
},
|
|
|
|
showSmallEBookIcon() {
|
|
|
|
return !this.isSelectionMode && this.showExperimentalFeatures && this.hasEbook
|
2021-09-18 01:40:30 +02:00
|
|
|
},
|
|
|
|
isMissing() {
|
|
|
|
return this.audiobook.isMissing
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
2021-12-02 02:07:03 +01:00
|
|
|
isInvalid() {
|
|
|
|
return this.audiobook.isInvalid
|
2021-10-10 23:36:21 +02:00
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
hasMissingParts() {
|
|
|
|
return this.audiobook.hasMissingParts
|
|
|
|
},
|
|
|
|
hasInvalidParts() {
|
|
|
|
return this.audiobook.hasInvalidParts
|
|
|
|
},
|
|
|
|
errorText() {
|
2021-09-18 01:40:30 +02:00
|
|
|
if (this.isMissing) return 'Audiobook directory is missing!'
|
2021-12-02 02:07:03 +01:00
|
|
|
else if (this.isInvalid) return 'Audiobook has no audio tracks & ebook'
|
2021-08-18 00:01:11 +02:00
|
|
|
var txt = ''
|
|
|
|
if (this.hasMissingParts) {
|
|
|
|
txt = `${this.hasMissingParts} missing parts.`
|
|
|
|
}
|
|
|
|
if (this.hasInvalidParts) {
|
|
|
|
if (this.hasMissingParts) txt += ' '
|
|
|
|
txt += `${this.hasInvalidParts} invalid parts.`
|
|
|
|
}
|
|
|
|
return txt || 'Unknown Error'
|
2021-08-27 01:32:05 +02:00
|
|
|
},
|
|
|
|
overlayWrapperClasslist() {
|
|
|
|
var classes = []
|
|
|
|
if (this.isSelectionMode) classes.push('bg-opacity-60')
|
|
|
|
else classes.push('bg-opacity-40')
|
|
|
|
if (this.selected) {
|
|
|
|
classes.push('border-2 border-yellow-400')
|
|
|
|
}
|
|
|
|
return classes
|
2021-09-07 00:42:15 +02:00
|
|
|
},
|
|
|
|
userCanUpdate() {
|
|
|
|
return this.$store.getters['user/getUserCanUpdate']
|
|
|
|
},
|
|
|
|
userCanDelete() {
|
|
|
|
return this.$store.getters['user/getUserCanDelete']
|
2021-11-10 03:30:44 +01:00
|
|
|
},
|
|
|
|
userCanDownload() {
|
|
|
|
return this.$store.getters['user/getUserCanDownload']
|
|
|
|
},
|
|
|
|
userIsRoot() {
|
|
|
|
return this.$store.getters['user/getIsRoot']
|
|
|
|
},
|
|
|
|
moreMenuItems() {
|
|
|
|
var items = [
|
|
|
|
{
|
|
|
|
func: 'toggleRead',
|
|
|
|
text: `Mark as ${this.userIsRead ? 'Not Read' : 'Read'}`
|
2021-11-13 23:06:32 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
func: 'openCollections',
|
|
|
|
text: 'Add to Collection'
|
2021-11-10 03:30:44 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
if (this.userCanUpdate) {
|
|
|
|
if (this.hasTracks) {
|
|
|
|
items.push({
|
|
|
|
func: 'showEditModalTracks',
|
|
|
|
text: 'Tracks'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
items.push({
|
|
|
|
func: 'showEditModalMatch',
|
|
|
|
text: 'Match'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (this.userCanDownload) {
|
|
|
|
items.push({
|
|
|
|
func: 'showEditModalDownload',
|
|
|
|
text: 'Download'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (this.userIsRoot) {
|
|
|
|
items.push({
|
|
|
|
func: 'rescan',
|
|
|
|
text: 'Re-Scan'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return items
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2021-11-16 03:09:42 +01:00
|
|
|
setShowCard(val) {
|
|
|
|
if (val) this.timesVisible++
|
|
|
|
this.showCard = val
|
|
|
|
},
|
2021-08-27 01:32:05 +02:00
|
|
|
selectBtnClick() {
|
|
|
|
if (this.processingBatch) return
|
|
|
|
this.$store.commit('toggleAudiobookSelected', this.audiobookId)
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
clickError(e) {
|
|
|
|
e.stopPropagation()
|
|
|
|
this.$router.push(`/audiobook/${this.audiobookId}`)
|
|
|
|
},
|
|
|
|
play() {
|
|
|
|
this.$store.commit('setStreamAudiobook', this.audiobook)
|
|
|
|
this.$root.socket.emit('open_stream', this.audiobookId)
|
|
|
|
},
|
|
|
|
editClick() {
|
2021-10-16 03:31:00 +02:00
|
|
|
// this.$store.commit('showEditModal', this.audiobook)
|
|
|
|
this.$emit('edit', this.audiobook)
|
2021-08-27 01:32:05 +02:00
|
|
|
},
|
|
|
|
clickCard(e) {
|
|
|
|
if (this.isSelectionMode) {
|
|
|
|
e.stopPropagation()
|
|
|
|
e.preventDefault()
|
|
|
|
this.selectBtnClick()
|
|
|
|
}
|
2021-10-10 23:36:21 +02:00
|
|
|
},
|
|
|
|
clickReadEBook() {
|
|
|
|
this.$store.commit('showEReader', this.audiobook)
|
2021-11-10 03:30:44 +01:00
|
|
|
},
|
|
|
|
toggleRead() {
|
|
|
|
// More menu func
|
|
|
|
var updatePayload = {
|
|
|
|
isRead: !this.userIsRead
|
|
|
|
}
|
|
|
|
this.isProcessingReadUpdate = true
|
|
|
|
this.$axios
|
2021-11-22 03:00:40 +01:00
|
|
|
.$patch(`/api/me/audiobook/${this.audiobookId}`, updatePayload)
|
2021-11-10 03:30:44 +01:00
|
|
|
.then(() => {
|
|
|
|
this.isProcessingReadUpdate = false
|
|
|
|
this.$toast.success(`"${this.title}" Marked as ${updatePayload.isRead ? 'Read' : 'Not Read'}`)
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Failed', error)
|
|
|
|
this.isProcessingReadUpdate = false
|
|
|
|
this.$toast.error(`Failed to mark as ${updatePayload.isRead ? 'Read' : 'Not Read'}`)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
audiobookScanComplete(result) {
|
|
|
|
this.rescanning = false
|
|
|
|
if (!result) {
|
|
|
|
this.$toast.error(`Re-Scan Failed for "${this.title}"`)
|
|
|
|
} else if (result === 'UPDATED') {
|
|
|
|
this.$toast.success(`Re-Scan complete audiobook was updated`)
|
|
|
|
} else if (result === 'UPTODATE') {
|
|
|
|
this.$toast.success(`Re-Scan complete audiobook was up to date`)
|
|
|
|
} else if (result === 'REMOVED') {
|
|
|
|
this.$toast.error(`Re-Scan complete audiobook was removed`)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
rescan() {
|
|
|
|
this.rescanning = true
|
|
|
|
this.$root.socket.once('audiobook_scan_complete', this.audiobookScanComplete)
|
|
|
|
this.$root.socket.emit('scan_audiobook', this.audiobookId)
|
|
|
|
},
|
|
|
|
showEditModalTracks() {
|
|
|
|
// More menu func
|
|
|
|
this.$store.commit('showEditModalOnTab', { audiobook: this.audiobook, tab: 'tracks' })
|
|
|
|
},
|
|
|
|
showEditModalMatch() {
|
|
|
|
// More menu func
|
|
|
|
this.$store.commit('showEditModalOnTab', { audiobook: this.audiobook, tab: 'match' })
|
|
|
|
},
|
|
|
|
showEditModalDownload() {
|
|
|
|
// More menu func
|
|
|
|
this.$store.commit('showEditModalOnTab', { audiobook: this.audiobook, tab: 'download' })
|
|
|
|
},
|
2021-11-13 23:06:32 +01:00
|
|
|
openCollections() {
|
|
|
|
this.$store.commit('setSelectedAudiobook', this.audiobook)
|
|
|
|
this.$store.commit('globals/setShowUserCollectionsModal', true)
|
|
|
|
},
|
2021-11-10 03:30:44 +01:00
|
|
|
createMoreMenu() {
|
|
|
|
if (!this.$refs.moreIcon) return
|
|
|
|
|
|
|
|
var ComponentClass = Vue.extend(MoreMenu)
|
|
|
|
|
|
|
|
var _this = this
|
|
|
|
var instance = new ComponentClass({
|
|
|
|
propsData: {
|
|
|
|
items: this.moreMenuItems
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.$on('action', (func) => {
|
|
|
|
if (_this[func]) _this[func]()
|
|
|
|
})
|
|
|
|
this.$on('close', () => {
|
|
|
|
_this.isMoreMenuOpen = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
instance.$mount()
|
|
|
|
|
|
|
|
var wrapperBox = this.$refs.moreIcon.getBoundingClientRect()
|
|
|
|
var el = instance.$el
|
|
|
|
|
|
|
|
var elHeight = this.moreMenuItems.length * 28 + 2
|
|
|
|
var elWidth = 130
|
|
|
|
|
|
|
|
var bottomOfIcon = wrapperBox.top + wrapperBox.height
|
|
|
|
var rightOfIcon = wrapperBox.left + wrapperBox.width
|
|
|
|
|
|
|
|
var elTop = bottomOfIcon
|
|
|
|
var elLeft = rightOfIcon
|
|
|
|
if (bottomOfIcon + elHeight > window.innerHeight - 100) {
|
|
|
|
elTop = wrapperBox.top - elHeight
|
|
|
|
elLeft = wrapperBox.left
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rightOfIcon + elWidth > window.innerWidth - 100) {
|
|
|
|
elLeft = rightOfIcon - elWidth
|
|
|
|
}
|
|
|
|
|
|
|
|
el.style.top = elTop + 'px'
|
|
|
|
el.style.left = elLeft + 'px'
|
|
|
|
|
|
|
|
this.isMoreMenuOpen = true
|
|
|
|
document.body.appendChild(el)
|
|
|
|
},
|
|
|
|
clickShowMore() {
|
|
|
|
this.createMoreMenu()
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
2021-11-16 03:09:42 +01:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.showCard = !this.isBookshelfBook
|
2021-09-28 13:44:40 +02:00
|
|
|
}
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
</script>
|