diff --git a/web/root/js/common.js b/web/root/js/common.js index 31b570b0b2ea84059eb13077e58c17df8f498211..53151221af4ff24e865c5c32a66f86059698452e 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 16a4b50c20e0bbbeaa039763af6b66a22382caa3..1e40c777403cc77219cd85c986c4d8bacee9057a 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'); }