changed controller setup
This commit is contained in:
parent
d3a30067fa
commit
94017f61ad
@ -39,9 +39,9 @@ const openFile = (eve) => {
|
|||||||
if (ftype === "dir") {
|
if (ftype === "dir") {
|
||||||
listFilesAjax(hash);
|
listFilesAjax(hash);
|
||||||
} else if (ftype === "video") {
|
} else if (ftype === "video") {
|
||||||
showMedia(hash, extension, "video");
|
showFile(title, hash, extension, "video");
|
||||||
} else {
|
} else {
|
||||||
showMedia(hash, extension, "file");
|
showFile(title, hash, extension, "file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
src/core/static/js/react-ui-logic.js
vendored
4
src/core/static/js/react-ui-logic.js
vendored
@ -78,13 +78,13 @@ class FilesList extends React.Component {
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
{card_header}
|
{card_header}
|
||||||
|
<input hash={hash} onClick={this.openThis} ftype={filetype} class="btn btn-secondary btn-sm float-right" title={name} type="button" value="Open"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body text-center">
|
<div class="card-body text-center">
|
||||||
{card_body}
|
{card_body}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<input hash={hash} onClick={this.openThisLocally} ftype={filetype} class="btn btn-secondary btn-sm float-left" type="button" value="Open Locally"/>
|
<input hash={hash} onClick={this.openThisLocally} ftype={filetype} class="btn btn-secondary btn-sm float-right" type="button" value="Open Locally"/>
|
||||||
<input hash={hash} onClick={this.openThis} ftype={filetype} class="btn btn-secondary btn-sm float-right" title={name} type="button" value="Open"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -16,13 +16,31 @@ const scrollFilesToTop = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const showMedia = async (hash, extension, type) => {
|
const closeFile = () => {
|
||||||
|
const video = document.getElementById("video");
|
||||||
|
let title = document.getElementById("selectedFile");
|
||||||
|
|
||||||
|
document.getElementById("image-viewer").style.display = "none";
|
||||||
|
document.getElementById("text-viewer").style.display = "none";
|
||||||
|
document.getElementById("pdf-viewer").style.display = "none";
|
||||||
|
document.getElementById("video-controls").style.display = "none";
|
||||||
|
|
||||||
|
title.innerText = "";
|
||||||
|
video.style.display = "none";
|
||||||
|
video.style.cursor = '';
|
||||||
|
video.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
const showFile = async (title, hash, extension, type) => {
|
||||||
document.getElementById("image-viewer").style.display = "none";
|
document.getElementById("image-viewer").style.display = "none";
|
||||||
document.getElementById("text-viewer").style.display = "none";
|
document.getElementById("text-viewer").style.display = "none";
|
||||||
document.getElementById("pdf-viewer").style.display = "none";
|
document.getElementById("pdf-viewer").style.display = "none";
|
||||||
document.getElementById("video").style.display = "none";
|
document.getElementById("video").style.display = "none";
|
||||||
document.getElementById("video-controls").style.display = "none";
|
document.getElementById("video-controls").style.display = "none";
|
||||||
|
|
||||||
|
let titleElm = document.getElementById("selectedFile");
|
||||||
|
titleElm.innerText = title;
|
||||||
|
|
||||||
if (type === "video") {
|
if (type === "video") {
|
||||||
setupVideo(hash, extension);
|
setupVideo(hash, extension);
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,6 @@ const getTimeFormatted = (duration = null) => {
|
|||||||
return hours + ":" + minutes + ":" + seconds;
|
return hours + ":" + minutes + ":" + seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pauseVideo = () => {
|
|
||||||
const video = document.getElementById("video");
|
|
||||||
video.style.cursor = '';
|
|
||||||
video.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
const togglePlay = (video) => {
|
const togglePlay = (video) => {
|
||||||
shouldPlay = setTimeout(function () {
|
shouldPlay = setTimeout(function () {
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
<div class="modal-dialog modal-xl" role="document">
|
<div class="modal-dialog modal-xl" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3>File Viewer:</h3>
|
<h3>File Viewer:</h3> <span id="selectedFile"></span>
|
||||||
<button onclick="pauseVideo()" type="button" data-dismiss="modal" class="btn btn-danger btn-sm">Close</button>
|
<button onclick="closeFile()" type="button" data-dismiss="modal" class="btn btn-danger btn-sm">Close</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body text-center justify-content-center">
|
<div class="modal-body text-center justify-content-center">
|
||||||
|
Loading…
Reference in New Issue
Block a user