-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.html
More file actions
171 lines (158 loc) Β· 6 KB
/
Copy pathexample.html
File metadata and controls
171 lines (158 loc) Β· 6 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Tab Alert Example</title>
<link rel="shortcut icon" href="tab-alert-icon.png" type="image/png">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<style>
#container {
margin: 20px auto;
width: 800px;
}
input[type="radio"] {
margin-right: 10px;
}
#icon-container {
display: grid;
grid-template-columns: 50% 50%;
}
#sample-code {
border: 1px solid gray;
font-family:'Courier New', Courier, monospace;
margin-top: 25px;
min-height: 100px;
white-space: pre-wrap;
padding: 5px;
}
button {
width: 100px
}
</style>
<script src="TabAlert.js"></script>
<script>
const tabAlert = new TabAlert();
let sampleOptions = {};
function updateSampleCode() {
const message = $('#message').val();
let options = `message: '${message}', `;
sampleOptions.message = message;
const icon = $('input[name="icon"]:checked').val();
if (icon) {
options += `icon: '${icon}', `;
sampleOptions.icon = icon;
}
const times = $('#times').val();
if ((times !== '') && (!isNaN(times))) {
options += `times: ${times}, `;
sampleOptions.times = times;
}
const delay = $('#delay').val();
if ((delay !== '') && (!isNaN(delay))) {
options += `delay: ${delay}, `;
sampleOptions.delay = delay;
}
options = options.replace(/, $/, '');
const code = `const tabAlert = new TabAlert();\ntabAlert.alert({${options}});`;
$('#sample-code').text(code);
}
function startExample() {
tabAlert.alert(sampleOptions);
}
function stopExample() {
tabAlert.stop();
}
$(function() {
$('#message').focus();
$('input').change(updateSampleCode);
});
</script>
</head>
<body>
<div id="container">
<form>
<div class="form-group">
<label for="message">Message</label>
<input type="message" class="form-control" id="message" placeholder="Enter a message">
</div>
<div class="form-group">
<label for="times">Number of Times</label>
<input type="times" class="form-control" id="times" placeholder="Number of times to run. Enter 0 to run indefinitely.">
</div>
<div class="form-group">
<label for="delay">Delay</label>
<input type="delay" class="form-control" id="delay" placeholder="Animation delay in milliseconds (Default is 1000)">
</div>
<div class="form-group">
<label>Icon</label>
<div id="icon-container">
<div>
<input type="radio" name="icon" id="icon-none" value="" checked>
<label for="icon-none">None</label>
<br>
<input type="radio" name="icon" id="icon-bellhop-bell" value="bellhop bell">
<label for="icon-bellhop-bell">π bellhop bell</label>
<br>
<input type="radio" name="icon" id="icon-speech-balloon" value="speech balloon">
<label for="icon-speech-balloon">π¬ speech balloon</label>
<br>
<input type="radio" name="icon" id="icon-police-car-light" value="police car light">
<label for="icon-police-car-light">π¨ police car light</label>
<br>
<input type="radio" name="icon" id="icon-stop-sign" value="stop sign">
<label for="icon-stop-sign">π stop sign</label>
<br>
<input type="radio" name="icon" id="icon-hour-glass-done" value="hour glass done">
<label for="icon-hour-glass-done">β hour glass done</label>
<br>
<input type="radio" name="icon" id="icon-alarm-clock" value="alarm clock">
<label for="icon-alarm-clock">β° alarm clock</label>
<br>
<input type="radio" name="icon" id="icon-stopwatch" value="stopwatch">
<label for="icon-stopwatch">β± stopwatch</label>
<br>
<input type="radio" name="icon" id="icon-timer-clock" value="timer clock">
<label for="icon-timer-clock">β² timer clock</label>
</div>
<div>
<br>
<input type="radio" name="icon" id="icon-star" value="star">
<label for="icon-star">β star</label>
<br>
<input type="radio" name="icon" id="icon-fire" value="fire">
<label for="icon-fire">π₯ fire</label>
<br>
<input type="radio" name="icon" id="icon-party-popper" value="party popper">
<label for="icon-party-popper">π party popper</label>
<br>
<input type="radio" name="icon" id="icon-bell" value="bell">
<label for="icon-bell">π bell</label>
<br>
<input type="radio" name="icon" id="icon-envelope-with-arrow" value="envelope with arrow">
<label for="icon-envelope-with-arrow">π© envelope with arrow</label>
<br>
<input type="radio" name="icon" id="icon-locked" value="locked">
<label for="icon-locked">π locked</label>
<br>
<input type="radio" name="icon" id="icon-exclamation-mark" value="exclamation mark">
<label for="icon-exclamation-mark">β exclamation mark</label>
<br>
<input type="radio" name="icon" id="icon-red-circle" value="red circle">
<label for="icon-red-circle">π΄ red circle</label>
</div>
</div>
</div>
<div>
<button class="btn btn-success" onclick="startExample(); return false;">Start</button>
<button class="btn btn-danger" onclick="stopExample(); return false;">Stop</button>
</div>
</form>
<div id="sample-code"></div>
</div>
</body>
</html>