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;
|
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 {
|
form {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
padding: 2vw 2vw;
|
padding: 2vw 2vw;
|
||||||
@ -79,6 +97,14 @@ form {
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#menu-file-view form {
|
||||||
|
min-height: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu-file-view .list {
|
||||||
|
height: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
.list:after {
|
.list:after {
|
||||||
content: "";
|
content: "";
|
||||||
flex: auto;
|
flex: auto;
|
||||||
|
|||||||
@ -29,7 +29,8 @@ $(document).on("dblclick", ".item", function (e) {
|
|||||||
});
|
});
|
||||||
$(".item.selected").removeClass("selected");
|
$(".item.selected").removeClass("selected");
|
||||||
$(".menu-wrapper").css("display", "flex");
|
$(".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));
|
$("#name").val(decodeURI(current_sasa.path));
|
||||||
$("#btn-full").attr("href", "/files/" + current_sasa.path);
|
$("#btn-full").attr("href", "/files/" + current_sasa.path);
|
||||||
let resp = tdb_query("$TFM", 24, '' + id);
|
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();
|
e.preventDefault();
|
||||||
let resp = tdb_query("$TFM", 24, '' + current_sasa.id);
|
let resp = tdb_query("$TFM", 24, '' + current_sasa.id);
|
||||||
if (!resp.status) {
|
if (!resp.status) {
|
||||||
@ -77,7 +78,7 @@ $(document).on("submit", "#menu-view form", function (e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(".menu-wrapper").css("display", "none");
|
$(".menu-wrapper").css("display", "none");
|
||||||
$("#menu-view").css("display", "none");
|
$("#menu-file-view").css("display", "none");
|
||||||
resp.data.forEach(tanzaku => {
|
resp.data.forEach(tanzaku => {
|
||||||
let current = $(`#t${tanzaku.id}`)
|
let current = $(`#t${tanzaku.id}`)
|
||||||
if (current.hasClass("selected")) {
|
if (current.hasClass("selected")) {
|
||||||
|
|||||||
@ -37,8 +37,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<div class="menu-wrapper">
|
<div class="menu-wrapper">
|
||||||
<div class="menu" id="menu-view">
|
<div class="menu" id="menu-file-view">
|
||||||
<h2>File menu</h2>
|
<img id="preview">
|
||||||
<form>
|
<form>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-2 col-form-label" for="name">File name</label>
|
<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, "/")
|
r.URL.Path = strings.Join(thumb_path, "/")
|
||||||
http.StripPrefix("/thumbs", tfm_fs).ServeHTTP(w, r)
|
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...")
|
log.Println("Running...")
|
||||||
err = server.ListenAndServeTLS("/etc/ssl/certs/web-global.crt", "/etc/ssl/private/web-global.key")
|
err = server.ListenAndServeTLS("/etc/ssl/certs/web-global.crt", "/etc/ssl/private/web-global.key")
|
||||||
if errors.Is(err, http.ErrServerClosed) {
|
if errors.Is(err, http.ErrServerClosed) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user