From 1400e3e71144d4dc8a48874301b90960485a3768 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Sep 2023 16:37:06 -0400 Subject: [PATCH] webchat: got active tab onclick working This patch adds the ability to click on the already existing active tab and have it populate the to_call input box. --- aprsd/web/chat/static/js/send-message.js | 2 +- aprsd/web/chat/templates/index.html | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/aprsd/web/chat/static/js/send-message.js b/aprsd/web/chat/static/js/send-message.js index 8cd3ac0..447aa8c 100644 --- a/aprsd/web/chat/static/js/send-message.js +++ b/aprsd/web/chat/static/js/send-message.js @@ -172,7 +172,7 @@ function create_callsign_tab(callsign, active=false) { } item_html = '' diff --git a/aprsd/web/chat/templates/index.html b/aprsd/web/chat/templates/index.html index 3f92c2f..ce815f9 100644 --- a/aprsd/web/chat/templates/index.html +++ b/aprsd/web/chat/templates/index.html @@ -48,16 +48,16 @@ console.log('Wipe local storage'); localStorage.clear(); }); + + // When a tab is clicked, populate the to_call form field. + $(document).on('shown.bs.tab', 'button[data-bs-toggle="tab"]', function (e) { + var tab = $(e.target); + var callsign = tab.attr("callsign"); + var to_call = $('#to_call'); + to_call.val(callsign); + }); }); - // When a tab is clicked, populate the to_call form field. - $(document).on('shown.bs.tab', 'button[data-bs-toggle="tab"]', function (e) { - var tab = $(e.target); - var callsign = tab.attr("callsign"); - var to_call = $('#to_call'); - console.log("Tab clicked on " + callsign); - to_call.val(callsign); - });