feat(web): add TFM tags page
This commit is contained in:
parent
58bd284101
commit
351e0be3ca
59
web/public/js/tfm-tags.js
Normal file
59
web/public/js/tfm-tags.js
Normal file
@ -0,0 +1,59 @@
|
||||
$(window).on("load", function () {
|
||||
sappyou_load();
|
||||
sappyou.forEach((tanzaku) => {
|
||||
$(".contents-wrapper").append(`<div class="item tanzaku" id="t${tanzaku.id}">${tanzaku.name}</div>`);
|
||||
});
|
||||
sasahyou_load();
|
||||
sasahyou.forEach((sasa) => {
|
||||
$(".list").append(`<div class="list-item sasa" id="s${sasa.id}" title="${sasa.path.split('/').slice(-1)}" style="background-image: url(${"/thumbs/" + sasa.path})"><div class="overlay"></div></div>`);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("dblclick", ".item", function (e) {
|
||||
e.preventDefault();
|
||||
let id = parseInt($(this).attr("id").slice(1));
|
||||
sappyou.every(tanzaku => {
|
||||
if (tanzaku.id === id) {
|
||||
current_tanzaku = tanzaku;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
$(".item.selected").removeClass("selected");
|
||||
$(".menu-wrapper").css("display", "flex");
|
||||
$("#name").val(decodeURI(current_tanzaku.name));
|
||||
let resp = tdb_query("$TFM", 40, '' + id);
|
||||
if (!resp.status) {
|
||||
alert("Something went wrong!");
|
||||
return;
|
||||
}
|
||||
resp.data.forEach(sasa => {
|
||||
$(`#s${sasa.id}`).addClass("selected");
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", "#btn-confirm", function (e) {
|
||||
e.preventDefault();
|
||||
let resp = tdb_query("$TFM", 40, '' + current_tanzaku.id);
|
||||
if (!resp.status) {
|
||||
alert("Something went wrong!");
|
||||
return;
|
||||
}
|
||||
$(".menu-wrapper").css("display", "none");
|
||||
resp.data.forEach(sasa => {
|
||||
let current = $(`#s${sasa.id}`)
|
||||
if (current.hasClass("selected")) {
|
||||
current.removeClass("selected");
|
||||
} else {
|
||||
if (!tdb_query("$TFM", 9, '' + sasa.id + ' ' + current_tanzaku.id).status) {
|
||||
console.log("ERROR: failed to remove kazari: " + sasa.id + '-' + current_tanzaku.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".sasa.selected").each(function (index, element) {
|
||||
if (!tdb_query("$TFM", 10, '' + $(element).attr("id").slice(1) + ' ' + current_tanzaku.id)) {
|
||||
console.log("ERROR: failed to add kazari: " + $(element).attr("id").slice(1) + '-' + current_tanzaku.id);
|
||||
}
|
||||
});
|
||||
$(".list-item").removeClass("selected");
|
||||
});
|
||||
57
web/public/tfm/tags.html
Normal file
57
web/public/tfm/tags.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Tags | Tanabata File Manager</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>
|
||||
<script src="/js/tfm.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1><a href="/tfm" title="TFM: Home">TFM: Tags</a></h1>
|
||||
<main>
|
||||
<div class="contents-wrapper">
|
||||
</div>
|
||||
</main>
|
||||
<div class="menu-wrapper">
|
||||
<div class="menu">
|
||||
<h2>Tag menu</h2>
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label" for="name">Tag name</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="name" class="form-control" id="name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group list" style="height: calc(100vh - 230px)"></div>
|
||||
<div class="form-group button-flex">
|
||||
<button class="btn btn-primary" id="btn-confirm">Confirm</button>
|
||||
<button class="btn btn-outline-danger" id="btn-close">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/tfm-tags.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user