From 70f593997d71efd8dabe0246558ce84253cb58eb Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Tue, 31 Jan 2023 01:54:33 +0300 Subject: [PATCH] perf(web): improve form submit handling --- web/public/js/tfm-files.js | 4 ++-- web/public/js/tfm-tags.js | 4 ++-- web/public/tfm/files.html | 4 ++-- web/public/tfm/tags.html | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/public/js/tfm-files.js b/web/public/js/tfm-files.js index 49c7e4e..96cea73 100644 --- a/web/public/js/tfm-files.js +++ b/web/public/js/tfm-files.js @@ -61,7 +61,7 @@ $(document).on("input", "#text-filter", function (e) { }); }); -$(document).on("click", "#btn-confirm", function (e) { +$(document).on("submit", "#menu-view form", function (e) { e.preventDefault(); let resp = tdb_query("$TFM", 24, '' + current_sasa.id); if (!resp.status) { @@ -89,7 +89,7 @@ $(document).on("click", "#btn-confirm", function (e) { $("#text-filter").val(""); }); -$(document).on("click", "#btn-add", function (e) { +$(document).on("submit", "#menu-add form", function (e) { e.preventDefault(); let resp = tdb_query("$TFM", 18, $("#new-name").val()); if (!resp.status) { diff --git a/web/public/js/tfm-tags.js b/web/public/js/tfm-tags.js index 935a84c..e341888 100644 --- a/web/public/js/tfm-tags.js +++ b/web/public/js/tfm-tags.js @@ -55,7 +55,7 @@ $(document).on("dblclick", ".item", function (e) { } }); -$(document).on("click", "#btn-confirm", function (e) { +$(document).on("submit", "#menu-view form", function (e) { e.preventDefault(); let resp = tdb_query("$TFM", 40, '' + current_tanzaku.id); if (!resp.status) { @@ -82,7 +82,7 @@ $(document).on("click", "#btn-confirm", function (e) { $(".list-item").removeClass("selected").css("display", "block"); }); -$(document).on("click", "#btn-add", function (e) { +$(document).on("submit", "#menu-add form", function (e) { e.preventDefault(); let resp = tdb_query("$TFM", 34, $("#new-name").val() + '\n' + $("#new-description").val()); if (!resp.status) { diff --git a/web/public/tfm/files.html b/web/public/tfm/files.html index 406728e..6d1717b 100644 --- a/web/public/tfm/files.html +++ b/web/public/tfm/files.html @@ -57,7 +57,7 @@
- + View full
@@ -73,7 +73,7 @@
- +
diff --git a/web/public/tfm/tags.html b/web/public/tfm/tags.html index ba6447f..700e163 100644 --- a/web/public/tfm/tags.html +++ b/web/public/tfm/tags.html @@ -59,7 +59,7 @@
- +
@@ -78,7 +78,7 @@
- +