-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
36 lines (32 loc) · 1.04 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var entropiCurOp;
var entropiRequest;
window.addEventListener('load', function(){
var form = jQuery("#entropi-run-parser");
if (form.find('button').text() == 'Stop') {
entropiCurOp = "run";
}
form.on("submit", function(e){
e.preventDefault();
if (entropiCurOp!='run') {
form.find('input[name="operation"]').val("run");
var buttonText = "Stop";
entropiCurOp = "run";
} else {
form.find('input[name="operation"]').val("stop");
var buttonText = "Stopping. Refresh this page in a while to confirm the stop.";
entropiCurOp = "stop";
}
entropiRequest = jQuery.ajax({
url: window.location.href,
type: "post",
data: jQuery(this).serialize(),
dataType: "json",
success: function(resp) {
if (resp.status == 'ok') {
entropiCurOp = false;
}
}
});
form.find("button").text(buttonText);
});
});