This repository has been archived by the owner on Apr 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgui.js
84 lines (75 loc) · 2.54 KB
/
gui.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
$(document).ready(function()
{
// Start with an empty monitor
monitor = null;
// Instantiate monitor when clicking on button
$("#btn-instantiate").click(function()
{
var verdict_box = document.getElementById("verdict-box");
var text = document.getElementById("input-formula").value;
var lsp = new LTLStringParser();
monitor = lsp.parseFromString(text);
if (monitor === null)
{
//verdict_box.className = 'verdict-nomonitor';
$("#verdict-box").css({ 'background-color': 'darkgrey' });
verdict_box.innerHTML = 'no monitor';
alert("Could not instantiate the monitor. This is generally caused by a syntax error in the expression.");
}
else
{
//verdict_box.className = 'verdict-inconclusive';
$("#verdict-box").css({ 'background-color': 'yellow' });
verdict_box.innerHTML = 'inconclusive';
}
});
// Evaluate monitor when clicking on button
document.getElementById("btn-evaluate").onclick = function()
{
$("#verdict-box").css({ 'background-color': 'white' });
monitor.processEvent(document);
var verdict_box = document.getElementById("verdict-box");
var verdict = monitor.getVerdict();
if (verdict == MONITOR_TRUE)
{
//verdict_box.className = 'verdict-true';
verdict_box.innerHTML = 'true';
$("#verdict-box").animate({ 'background-color': 'green' });
}
else if (verdict == MONITOR_FALSE)
{
//verdict_box.className = 'verdict-false';
verdict_box.innerHTML = 'false';
$("#verdict-box").animate({ 'background-color': 'red' });
}
else
{
//verdict_box.className = 'verdict-inconclusive';
verdict_box.innerHTML = 'inconclusive';
$("#verdict-box").animate({ 'background-color': 'yellow' });
}
};
$("#monitor select").change(function() {
$("#input-formula").val($(this).val());
console.log($(this).val());
});
$("#btn-help").click(function() {
$("#help").dialog({ height: 400, width: 650 });
return false;
});
$('#main-title').bind('dblclick', function() {
$(this).attr('contentEditable', true);
}).blur(
function() {
$(this).attr('contentEditable', false);
});
$("#main-title-div").resizable();
$("#yellowbox").draggable().resizable();
$("#thelist li").resizable();
$('#thelist li').bind('dblclick', function() {
$(this).attr('contentEditable', true);
}).blur(
function() {
$(this).attr('contentEditable', false);
});
});