feat(web): initialize TFM page
Only table of thumbs by now
This commit is contained in:
parent
b55865b8e7
commit
5725015408
@ -60,7 +60,6 @@ main:hover {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-content: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
|
||||
53
web/public/css/tfm.css
Normal file
53
web/public/css/tfm.css
Normal file
@ -0,0 +1,53 @@
|
||||
main {
|
||||
position: relative;
|
||||
height: 70vh;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.contents-wrapper {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.item {
|
||||
position: relative;
|
||||
margin: 16px;
|
||||
padding: 0;
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
border-radius: 20px;
|
||||
background-image: url(/images/loader.gif);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.item .overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #0000;
|
||||
}
|
||||
|
||||
.item:hover .overlay {
|
||||
background-color: #0002;
|
||||
}
|
||||
|
||||
.item.selected .overlay {
|
||||
background-color: #0004;
|
||||
}
|
||||
|
||||
.thumb {
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
}
|
||||
18
web/public/js/tdbms.js
Normal file
18
web/public/js/tdbms.js
Normal file
@ -0,0 +1,18 @@
|
||||
function tdb_query(trdb, trc, trb) {
|
||||
output = null;
|
||||
$.ajax({
|
||||
url: "/TDBMS",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: `{"trdb":"${trdb}","trc":${trc},"trb":"${trb}"}`,
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (resp) {
|
||||
output = resp;
|
||||
},
|
||||
failure: function (err) {
|
||||
alert(err);
|
||||
}
|
||||
});
|
||||
return output;
|
||||
}
|
||||
39
web/public/js/tfm.js
Normal file
39
web/public/js/tfm.js
Normal file
@ -0,0 +1,39 @@
|
||||
$(window).on("load", function () {
|
||||
sasa_load(-1);
|
||||
})
|
||||
|
||||
$(document).keyup(function (e) {
|
||||
if (e.key === "Escape") {
|
||||
$(".selected").removeClass("selected");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("click", ".item", function (e) {
|
||||
let wasSelected = $(this).hasClass("selected");
|
||||
if (!e.ctrlKey) {
|
||||
$(".selected").removeClass("selected");
|
||||
wasSelected = false;
|
||||
}
|
||||
if (wasSelected) {
|
||||
$(this).removeClass("selected");
|
||||
} else {
|
||||
$(this).addClass("selected");
|
||||
}
|
||||
});
|
||||
|
||||
function sasa_load(id) {
|
||||
resp = tdb_query("$TFM", 16, id < 0 ? "" : `${id}`);
|
||||
if (resp == null) {
|
||||
alert("Unauthorized, go to /auth and authorize");
|
||||
return;
|
||||
}
|
||||
if (!resp.status) {
|
||||
alert("Something went wrong");
|
||||
return;
|
||||
}
|
||||
if (id < 0) {
|
||||
resp.data.forEach((sasa) => {
|
||||
$(".contents-wrapper").append(`<div class="item" id="s${sasa.id}" title="${sasa.path.split('/').slice(-1)}" style="background-image: url(${"/thumbs/" + sasa.path})"><div class="overlay"></div></div>`);
|
||||
});
|
||||
}
|
||||
}
|
||||
38
web/public/tfm.html
Normal file
38
web/public/tfm.html
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>File Manager | Tanabata</title>
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/images/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/images/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/images/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="/images/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/images/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/images/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/images/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/images/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/images/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/images/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
|
||||
<link rel="manifest" href="/tanabata.webmanifest">
|
||||
<meta name="msapplication-TileColor" content="#5c913b">
|
||||
<meta name="msapplication-TileImage" content="/images/ms-icon-144x144.png">
|
||||
<meta name="theme-color" content="#5c913b">
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/general.css">
|
||||
<link rel="stylesheet" href="/css/tfm.css">
|
||||
<script src="/js/jquery-3.6.0.min.js"></script>
|
||||
<script src="/js/tdbms.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Tanabata File Manager</h1>
|
||||
<main>
|
||||
<div class="contents-wrapper">
|
||||
</div>
|
||||
</main>
|
||||
<script src="/js/tfm.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user