alert.html 2.21 KB
Newer Older
Rafael Ostertag's avatar
Rafael Ostertag committed
1
2
3
4
5
6
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css">
7
    <link rel="stylesheet" href="../css/qfq-bs.css">
Rafael Ostertag's avatar
Rafael Ostertag committed
8
9
10
11
12
13
14
    <title>Alert</title>
</head>
<body>

<button id="showalert1">Show Alert 1</button>
<button id="showalert2">Show Alert 2</button>
<button id="showalert3">Show Alert 3 primed</button>
15
<button id="showmanyalert1">Show Many Alert 1</button>
16
17
18
19
20
<a id="alertinlink" onclick="
var alert = new QfqNS.Alert('Text being displayed', 'info', [
  { label: 'OK', eventName: 'ok' },
  { label: 'Cancel', eventName: 'cancel'}
]);
Rafael Ostertag's avatar
Rafael Ostertag committed
21

22
23
24
25
26
27
28
alert.on('alert.ok', function() {
  window.location = $('#alertinlink').attr('href');
});

alert.show();
return false;
" href="http://www.google.ch">Link alert</a>
Rafael Ostertag's avatar
Rafael Ostertag committed
29
30
31

<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
32
<script src="../js/EventEmitter.min.js"></script>
33
<script src="../js/qfq.debug.js"></script>
Rafael Ostertag's avatar
Rafael Ostertag committed
34
35
36
37

<script>
    $(function () {
        $('#showalert1').click(function () {
38
            var alert = new QfqNS.Alert("This is alert 1", 'error', [{label: "OK", eventName: "ok", focus: true},
39
40
                {label: "Cancel", eventName: "cancel"}]);
            alert.on('alert.ok', function () {
Rafael Ostertag's avatar
Rafael Ostertag committed
41
42
                console.log("OK button alert 1");
            });
43
            alert.on('alert.cancel', function () {
Rafael Ostertag's avatar
Rafael Ostertag committed
44
45
                console.log("Cancel button alert 1");
            });
Rafael Ostertag's avatar
Rafael Ostertag committed
46
47
48
49
            alert.show();
        });

        $('#showalert2').click(function () {
Rafael Ostertag's avatar
Rafael Ostertag committed
50
            var alert = new QfqNS.Alert("This is alert 2", 'warning');
Rafael Ostertag's avatar
Rafael Ostertag committed
51
52
53
54
55
56
57
58
            alert.show();
        });

        $('#showalert3').click(function () {
            var alert = new QfqNS.Alert("This is alert 3. Disappears after 3 secs.");
            alert.timeout = 3000;
            alert.show();
        });
59
60
61
62
63
64
65
66
67
68
69

        $('#showmanyalert1').click(function () {
            var alert = new QfqNS.Alert("This is alert 1", "info");
            alert.show();

            alert = new QfqNS.Alert("This is alert 2", "warning");
            alert.show();

            alert = new QfqNS.Alert("This is alert 3", "error");
            alert.show();
        });
Rafael Ostertag's avatar
Rafael Ostertag committed
70
71
72
73
    });
</script>
</body>
</html>