From ea600dfc7ac44634adc64c0e4f9b67237e6f953e Mon Sep 17 00:00:00 2001 From: alterdekim Date: Sun, 7 Jul 2024 04:39:24 +0300 Subject: [PATCH] language combobox fix 4 (script-editor) --- .../static/javascript/script-editor.js | 26 ++++++++++++++++++- .../resources/templates/script-editor.html | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/resources/static/javascript/script-editor.js b/src/main/resources/static/javascript/script-editor.js index b137119..33233c1 100644 --- a/src/main/resources/static/javascript/script-editor.js +++ b/src/main/resources/static/javascript/script-editor.js @@ -30,4 +30,28 @@ $( document ).ready(function() { if ($.urlParam("script_id") != "-1") { getActionScript(); } -}); \ No newline at end of file +}); + +function grab_form() { + let arr = []; + arr["action_body_text"] = editor.getValue(); + arr["action_desc_text"] = $("#action_desc_text").val(); + arr["action_name_text"] = $("#action_name_text").val(); + return arr; +} + +function add_entry() { + $.ajax({ + url: "/api/add_entry", + type: "POST", + data: grab_form() + }).done(function() { + window.location.href = "/panel?section=actions"; + }); +} + +function edit_submit_entry() { + $.post("/api/remove_entry", "section=actions&entry_id="+($.urlParam("script_id")), function(data, status) { + add_entry(); + }); +} \ No newline at end of file diff --git a/src/main/resources/templates/script-editor.html b/src/main/resources/templates/script-editor.html index f6953c5..d92d343 100644 --- a/src/main/resources/templates/script-editor.html +++ b/src/main/resources/templates/script-editor.html @@ -57,7 +57,7 @@ - +