aboutsummaryrefslogtreecommitdiff
path: root/index.html
blob: ef717e5993803af7513f1a52b7eb39ea8e7c94fc (plain) (blame)
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
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>CleanLogic</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
        <style type="text/css">
            textarea {
                font-family: monospace;
                resize: vertical;
                width: 100%;
            }

            textarea#expressions {
                height: 200px;
            }

            textarea#truthtable {
                height: 400px;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <h1>CleanLogic</h1>
            <p class="lead">Logic toolbox in <a href="http://clean.cs.ru.nl/Clean" target="_blank">Clean</a></p>
            <p>Copyright &copy; 2015 Camil Staps. This project is licensed under the MIT license. For more details, see the <a href="LICENSE" target="_blank">LICENSE</a> file.</p>
            <p>This project is maintained on <a href="https://github.com/camilstaps/CleanLogic" target="_blank">GitHub</a>. For more information, see the <a href="README.md">readme file</a>.</p>

            <hr/>

            <div class="row">
                <div class="col-md-3">
                    <h2>Expressions</h2>
                    <p>Enter expressions here, one per line:</p>
                    <textarea class="form-control" id="expressions">p & q -> q & p</textarea>
                    <a href="#legend" data-toggle="collapse" class="pull-right">Legend</a><br/>
                    <div class="collapse" id="legend">
                        <table class="table table-condensed table-striped">
                            <tr><th>Name</th><th>Normally</th><th>Here</th></tr>
                            <tr><td>Negation</td><td>&not;</td><td><code>~</code></td></tr>
                            <tr><td>Conjunction</td><td>&and;</td><td><code>&amp;</code></td></tr>
                            <tr><td>Disjunction</td><td>&or;</td><td><code>|</code></td></tr>
                            <tr><td>Implication</td><td>&rarr;</td><td><code>-&gt;</code></td></tr>
                            <tr><td>Equivalence</td><td>&harr;</td><td><code>&lt;-&gt;</code></td></tr>
                        </table>
                    </div>
                    <div class="checkbox"><label for="extended" title="Display intermediate steps (max. one expression)"><input type="checkbox" id="extended">&nbsp;Intermediate steps</label></div>
                    <button class="btn btn-primary" id="view">View</button>
                </div>
                <div class="col-md-9">
                    <h2>Truth table</h2>
                    <p>Truth tables are generated with a server-side <a href="http://clean.cs.ru.nl/Clean" target="_blank">Clean</a> program.</p>
                    <textarea class="form-control" id="truthtable"></textarea>
                </div>
            </div>
        </div>
    
        <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script>
            $('#view').click(function(){
                console.log($('#expressions').val().split("\n"));
                $.ajax({
                    url: 'request.php',
                    data: {
                        extended: $('#extended').prop('checked'),
                        expressions: $('#expressions').val().split("\n")
                    },
                    success: function (data) {
                        $('#truthtable').val(data);
                    }
                });
            }).trigger('click');
        </script>
    </body>
</html>