feat(web): show image preview in file view menu
This commit is contained in:
parent
ef373db8d5
commit
8089c6ae68
@ -58,6 +58,24 @@ main {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#menu-file-view {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border-radius: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#preview {
|
||||
max-width: 100%;
|
||||
max-height: 90vh;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
form {
|
||||
flex: 1 1 auto;
|
||||
padding: 2vw 2vw;
|
||||
@ -79,6 +97,14 @@ form {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
#menu-file-view form {
|
||||
min-height: initial;
|
||||
}
|
||||
|
||||
#menu-file-view .list {
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
.list:after {
|
||||
content: "";
|
||||
flex: auto;
|
||||
|
||||
@ -29,7 +29,8 @@ $(document).on("dblclick", ".item", function (e) {
|
||||
});
|
||||
$(".item.selected").removeClass("selected");
|
||||
$(".menu-wrapper").css("display", "flex");
|
||||
$("#menu-view").css("display", "flex");
|
||||
$("#menu-file-view").css("display", "flex");
|
||||
$("#preview").attr("src", "/preview/" + current_sasa.path);
|
||||
$("#name").val(decodeURI(current_sasa.path));
|
||||
$("#btn-full").attr("href", "/files/" + current_sasa.path);
|
||||
let resp = tdb_query("$TFM", 24, '' + id);
|
||||
@ -69,7 +70,7 @@ $(document).on("input", "#text-filter", function (e) {
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("submit", "#menu-view form", function (e) {
|
||||
$(document).on("submit", "#menu-file-view form", function (e) {
|
||||
e.preventDefault();
|
||||
let resp = tdb_query("$TFM", 24, '' + current_sasa.id);
|
||||
if (!resp.status) {
|
||||
@ -77,7 +78,7 @@ $(document).on("submit", "#menu-view form", function (e) {
|
||||
return;
|
||||
}
|
||||
$(".menu-wrapper").css("display", "none");
|
||||
$("#menu-view").css("display", "none");
|
||||
$("#menu-file-view").css("display", "none");
|
||||
resp.data.forEach(tanzaku => {
|
||||
let current = $(`#t${tanzaku.id}`)
|
||||
if (current.hasClass("selected")) {
|
||||
|
||||
@ -37,8 +37,8 @@
|
||||
</div>
|
||||
</main>
|
||||
<div class="menu-wrapper">
|
||||
<div class="menu" id="menu-view">
|
||||
<h2>File menu</h2>
|
||||
<div class="menu" id="menu-file-view">
|
||||
<img id="preview">
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label" for="name">File name</label>
|
||||
|
||||
@ -223,6 +223,9 @@ func main() {
|
||||
r.URL.Path = strings.Join(thumb_path, "/")
|
||||
http.StripPrefix("/thumbs", tfm_fs).ServeHTTP(w, r)
|
||||
}))
|
||||
http.Handle("/preview/", Auth(func(w http.ResponseWriter, r *http.Request) {
|
||||
http.StripPrefix("/preview", tfm_fs).ServeHTTP(w, r)
|
||||
}))
|
||||
log.Println("Running...")
|
||||
err = server.ListenAndServeTLS("/etc/ssl/certs/web-global.crt", "/etc/ssl/private/web-global.key")
|
||||
if errors.Is(err, http.ErrServerClosed) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user