Henrique Dias 346412eb2a Improvements :)
Former-commit-id: c1c1881302a241fdc7140e6aabeb9b49977bd7c6 [formerly 84bb454c2f34baffd9dfa91645b8aff149e52620] [formerly 29e258c7a16db1ca8a3fde7c5e4e3cffc47899a6 [formerly 84ddad027fed623021092d56872ff138bc5ea416]]
Former-commit-id: 0018a51df5bc801b783a3ffe17d9f33c504ce094 [formerly 0072c425cd4754e38f30007ab9f5272ea4b40370]
Former-commit-id: d298f006e58ef9e4987def4bc354818062b30fcd
2017-06-28 22:20:28 +01:00

44 lines
1.4 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>
<!-- TODO: add more buttons -->
</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 '../page'
export default {
name: 'preview',
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)
}
}
}
</script>