mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-08 19:22:57 +00:00

Former-commit-id: 9f1f09311813203910d5b323ba80712553ee2741 [formerly 0be00be1de305d786affc6bf0886aed9b20fbc51] [formerly 04597463117e94830b24b87faaaccf3d35284427 [formerly 3f2dc3f1c56a7a636a836d36b94c052f55f32d93]] Former-commit-id: 8d26cc1d96faed73c7974ea7e5e78bf268af3ad9 [formerly a083ac8f68c90a636843c3565bd349657c0ec383] Former-commit-id: ef10f3b3c388d65ceac40785b45dbac190a6cc99
61 lines
1.9 KiB
Vue
61 lines
1.9 KiB
Vue
<template>
|
|
<div id="previewer">
|
|
<div class="bar">
|
|
<button @click="back" class="action" aria-label="Close Preview" id="close">
|
|
<i class="material-icons">close</i>
|
|
</button>
|
|
|
|
<rename-button v-if="allowEdit()"></rename-button>
|
|
<delete-button v-if="allowEdit()"></delete-button>
|
|
<download-button></download-button>
|
|
<info-button></info-button>
|
|
</div>
|
|
|
|
<div class="preview">
|
|
<img v-if="type == 'image'" :src="raw()">
|
|
<audio v-else-if="type == 'audio'" :src="raw()" controls></audio>
|
|
<video v-else-if="type == 'video'" :src="raw()" controls>
|
|
Sorry, your browser doesn't support embedded videos,
|
|
but don't worry, you can <a href="?download=true">download it</a>
|
|
and watch it with your favorite video player!
|
|
</video>
|
|
<object v-else-if="extension == '.pdf'" class="pdf" :data="raw()"></object>
|
|
<a v-else-if="type == 'blob'" href="?download=true"><h2 class="message">Download <i class="material-icons">file_download</i></h2></a>
|
|
<pre v-else >{{ content }}</pre>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import page from '../utils/page'
|
|
import InfoButton from './InfoButton'
|
|
import DeleteButton from './DeleteButton'
|
|
import RenameButton from './RenameButton'
|
|
import DownloadButton from './DownloadButton'
|
|
|
|
export default {
|
|
name: 'preview',
|
|
components: {
|
|
InfoButton,
|
|
DeleteButton,
|
|
RenameButton,
|
|
DownloadButton
|
|
},
|
|
data: function () {
|
|
return window.info.req.data
|
|
},
|
|
methods: {
|
|
raw: function () {
|
|
return this.url + '?raw=true'
|
|
},
|
|
back: function (event) {
|
|
let url = page.removeLastDir(window.location.pathname)
|
|
page.open(url)
|
|
},
|
|
allowEdit: function (event) {
|
|
return window.info.user.allowEdit
|
|
}
|
|
}
|
|
}
|
|
</script>
|