From 6b9755ee68f422460f19edff44c03a1ef01307ab Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 14 Jun 2025 17:36:43 +0900 Subject: [PATCH] [~] use compact form of aws_contoller and aws_action (aws_c and aws_c) [+] load_to_clipboard(url) The url request to server to provide the html content by ajax call [+] jq_query has new argument "after_callback" which will be executed at the end of the query --- resources/web/public/xlib/js/xlib.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/resources/web/public/xlib/js/xlib.js b/resources/web/public/xlib/js/xlib.js index b119b7a..c320751 100644 --- a/resources/web/public/xlib/js/xlib.js +++ b/resources/web/public/xlib/js/xlib.js @@ -128,7 +128,7 @@ $(document).ready(function() { return; } - $.ajax("?aws_controller=root&aws_action=do_send_sms&send_to=" + number + "&message=" + encodeURIComponent(sms_message)); + $.ajax("?aws_c=root&aws_a=do_send_sms&send_to=" + number + "&message=" + encodeURIComponent(sms_message)); $(this).dialog('destroy'); } }; @@ -138,7 +138,7 @@ $(document).ready(function() { if (!number) { return; } - $.ajax("?aws_controller=root&aws_action=do_phone_call&call_to=" + number); + $.ajax("?aws_c=root&aws_a=do_phone_call&call_to=" + number); }; hk_send_sms = function (e) { @@ -441,6 +441,25 @@ function load_js_files(scripts, done_cb){ }); }; + Xlib.load_to_clipboard = function (url_args) { + console.log('jq_load_to_clipboard url_args ['+url_args+']'); + //var dialog_elem = $('#'+dialog_id); + $.ajax({ + dataType: 'json', + url: url_args + }).done(function (data) { + //load_css_files(data.css_files); + const html_clip = new Blob([data.html], {type: 'text/html'}); + const clip = [new ClipboardItem({ + ['text/html']:html_clip, + })]; + navigator.clipboard.write(clip).then( + () => {alert('copy success')}, + () => {} + ); + }); + }; + Xlib.cxm_dialog_msg_hide = function (container_id) { var cxm_dialog_msg_elem = $('#' + container_id + ' .cxm_dlg_msg'); @@ -589,7 +608,7 @@ function load_js_files(scripts, done_cb){ } }; - Xlib.jq_query = function (url, container_id) { + Xlib.jq_query = function (url, container_id, after_callback) { $.ajax({ type: 'POST', dataType: 'json', @@ -621,7 +640,10 @@ function load_js_files(scripts, done_cb){ Xlib.cxm_dialog_msg_show(container_id); msg_container.prepend(data.answer_content.message); - } + }; + if (after_callback && (typeof after_callback == "function")) { + after_callback(); + } }); }; @@ -981,3 +1003,4 @@ function select_hide_show(id, select_element) { $('#' + option_selected_jq_element.data("linked_element")).show(); } + -- libgit2 0.21.4