webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit bd4182c9e045cb5c18e0e3765f54a51aadcf9477
parent c5c4f5707b56db83a026450ef5a749f98c2ffd3c
Author: Sheng <psychopathme@gmail.com>
Date:   Fri,  8 Dec 2017 17:00:14 +0800

Disable button for a short time after submission

Diffstat:
Mstatic/js/main.js | 11++++++++++-
Mtemplates/index.html | 2+-
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/static/js/main.js b/static/js/main.js @@ -1,6 +1,12 @@ jQuery(function($){ + + var status = $('#status'), + btn = $('.btn-primary'); + $('form#connect').submit(function(event) { event.preventDefault(); + status.text(''); + btn.prop('disabled', true); var form = $(this), url = form.attr('action'), @@ -22,7 +28,10 @@ jQuery(function($){ function callback(msg) { // console.log(msg); if (msg.status) { - $('#status').text(msg.status); + status.text(msg.status); + setTimeout(function(){ + btn.prop('disabled', false); + }, 3000); return; } diff --git a/templates/index.html b/templates/index.html @@ -58,7 +58,7 @@ </div> <div class="container"> - <div id="status"></div> + <div id="status" style="color: red;"></div> <div id="terminal"></div> </div>