From e042ca287b7d0df6e5875af20f71b970b1fe510d Mon Sep 17 00:00:00 2001 From: echicken <echicken@bbs.electronicchicken.com> Date: Thu, 10 Jan 2019 22:15:27 -0500 Subject: [PATCH] Unbreak enter-to-send. --- web/root/js/common.js | 8 +++----- web/sidebar/.examples/001-nodelist.xjs | 24 ++++++++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/web/root/js/common.js b/web/root/js/common.js index 31b570b0b2..53151221af 100644 --- a/web/root/js/common.js +++ b/web/root/js/common.js @@ -42,10 +42,8 @@ function scrollUp() { function sendTelegram(alias) { function send_tg(evt) { if (typeof evt !== 'undefined') evt.preventDefault(); - $.getJSON('./api/system.ssjs?call=send-telegram&user=' + alias + '&telegram=' + $('#telegram').val(), - function(data) { - } - ); + $.getJSON('./api/system.ssjs?call=send-telegram&user=' + alias + '&telegram=' + $('#telegram').val(), function(data) { + }); $('#popUpModal').modal('hide'); } $('#popUpModalTitle').html('Send a telegram to ' + alias); @@ -55,9 +53,9 @@ function sendTelegram(alias) { + '<input type="submit" value="submit" class="hidden">' + '</form>' ); - $('#popUpModalActionButton').show(); $('#send-telegram-form').submit(send_tg); $('#popUpModalActionButton').click(send_tg); + $('#popUpModalActionButton').show(); $('#popUpModal').modal('show'); } diff --git a/web/sidebar/.examples/001-nodelist.xjs b/web/sidebar/.examples/001-nodelist.xjs index 16a4b50c20..1e40c77740 100644 --- a/web/sidebar/.examples/001-nodelist.xjs +++ b/web/sidebar/.examples/001-nodelist.xjs @@ -84,20 +84,28 @@ <?xjs if (settings.nodelist_ibbs) { ?> function _send_ibbs_telegram(sys, host, user) { - $('#popUpModalTitle').html('Send a telegram to ' + user + '@' + sys); - $('#popUpModalBody').html('<input type="text" class="form-control" placeholder="My message" name="telegram" id="telegram">'); - $('#popUpModalActionButton').show(); - $('#popUpModalActionButton').click(function () { - $.getJSON( - './api/sbbsimsg.ssjs?call=send_telegram' + function send_ibbs_tg(evt) { + if (typeof evt !== 'undefined') evt.preventDefault(); + $.getJSON( + './api/sbbsimsg.ssjs?call=send_telegram' + '&username=' + user + '&host=' + host + '&message=' + $('#telegram').val(), - function (data) { + function (data) { } ); $('#popUpModal').modal('hide'); - }); + }; + $('#popUpModalTitle').html('Send a telegram to ' + user + '@' + sys); + $('#popUpModalBody').html( + '<form id="ibbs-telegram-form">' + + '<input type="text" class="form-control" placeholder="My message" name="telegram" id="telegram">' + + '<input type="submit" value="submit" class="hidden">' + + '</form>' + ); + $('#popUpModalActionButton').show(); + $('#ibbs-telegram-form').submit(send_ibbs_tg); + $('#popUpModalActionButton').click(send_ibbs_tg); $('#popUpModal').modal('show'); } -- GitLab