diff --git a/web/public/css/tfm.css b/web/public/css/tfm.css index d5997c2..5dfd06e 100644 --- a/web/public/css/tfm.css +++ b/web/public/css/tfm.css @@ -51,3 +51,42 @@ main { min-width: 100%; min-height: 100%; } + +.menu-wrapper { + display: none; + flex-direction: column; + justify-content: center; + align-items: center; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: #0008; +} + +.menu { + background-color: #eee; + box-shadow: 0 0 0.5vw black; + border-radius: 16px; + width: 80vw; + height: 80vh; + max-width: 700px; + transition: 0.3s; + overflow: hidden; +} + +form#sasa-menu { + margin: 0; + padding: 2vw 2vw; + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; +} + +#tanzaku-list { + height: 40vh; + overflow-y: scroll; + overflow-x: hidden; +} diff --git a/web/public/js/tfm.js b/web/public/js/tfm.js index 56f4b65..0e098e4 100644 --- a/web/public/js/tfm.js +++ b/web/public/js/tfm.js @@ -1,5 +1,58 @@ +var sasahyou, sappyou, shoppyou; + +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) { + sasahyou = resp.data; + sasahyou.forEach((sasa) => { + $(".contents-wrapper").append(`
`); + }); + } +} + +function tanzaku_load(id) { + resp = tdb_query("$TFM", 32, 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) { + sappyou = resp.data; + sappyou.forEach((tanzaku) => { + $("#tanzaku-list").append(`
`); + }); + } +} + +function kazari_load() { + resp = tdb_query("$TFM", 8, ""); + if (resp == null) { + alert("Unauthorized, go to /auth and authorize"); + return; + } + if (!resp.status) { + alert("Something went wrong"); + return; + } + shoppyou = resp.data; +} + $(window).on("load", function () { sasa_load(-1); + tanzaku_load(-1); + kazari_load(); }) $(document).keyup(function (e) { @@ -21,19 +74,28 @@ $(document).on("click", ".item", function (e) { } }); -function sasa_load(id) { - resp = tdb_query("$TFM", 16, id < 0 ? "" : `${id}`); - if (resp == null) { - alert("Unauthorized, go to /auth and authorize"); - return; - } +$(document).on("dblclick", ".item", function (e) { + let id = parseInt($(this).attr("id").slice(1)); + let sasa; + sasahyou.every(current_sasa => { + if (current_sasa.id === id) { + sasa = current_sasa; + return false; + } + return true; + }); + $(".menu-wrapper").css("display", "flex"); + $("#sasa-name").val(decodeURI(sasa.path)); + let resp = tdb_query("$TFM", 24, '' + id); if (!resp.status) { - alert("Something went wrong"); + alert("Something went wrong!"); return; } - if (id < 0) { - resp.data.forEach((sasa) => { - $(".contents-wrapper").append(`
`); - }); - } -} + resp.data.forEach(tanzaku => { + $(`#ct${tanzaku.id}`).prop("checked", true); + }); +}); + +$(document).on("click", ".menu-wrapper", function (e) { + $(".menu-wrapper").css("display", "none"); +}); diff --git a/web/public/tfm.html b/web/public/tfm.html index b3179d0..d0747f6 100644 --- a/web/public/tfm.html +++ b/web/public/tfm.html @@ -33,6 +33,21 @@
+