-
Notifications
You must be signed in to change notification settings - Fork 2
/
playsound.html
251 lines (213 loc) · 8.51 KB
/
playsound.html
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.86, maximum-scale=3.0, minimum-scale=0.86">
<meta name="docsearch:language" content="en">
<meta name="docsearch:version" content="5">
<meta name="description" content="Bootstrap Extra is a free and advanced open source front end development framework for the creation of websites and web apps.">
<meta name="keywords" content="HTML, CSS, JavaScript, Responsive, Mobile, App, Jquery">
<meta name="author" content="Irfan Ghuori">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/animation.css" />
<link rel="stylesheet" href="css/bootstrap.css">
<!-- Favicon /-->
<link rel="apple-touch-icon" sizes="57x57" href="./images/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="./images/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="./apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="./images/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="./images/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="./images/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="./images/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="./images/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="./images/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./images/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./images/favicon/favicon-16x16.png">
<link rel="manifest" href="./images/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="./images/favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<!-- Favicon \ -->
<title>Bootstrap Extra</title>
<!-- Fonts and icons -->
<style>
</style>
</head>
<body>
<div class="container"> <br>
<div class="card">
<div class="card-header display-7"> Play Sound With Notification </div>
<div class="card-body">
<div> Esaily add Sound file with open element action
<pre>
<code>
Example: $.playSound("images/beeb.mp3");
</code>
</pre>
</div>
<br>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<td>Element</td>
<td> File Path </td>
<td> Code</td>
</tr>
</thead>
<tr>
<!-- data-toggle="modal" data-target="#exampleModal" --->
<td><button id="modals" type="button" class="btn btn-primary">
<i class="icon-bell"></i> Launch demo modal
</button>
</td>
<td>
images/beeb.mp3
</td>
<td>
<pre>
<code>
$('.button').click( function(){
$('#exampleModal').modal('show');
add script -> $.playSound("images/beeb.mp3");
});
</code>
</pre>
</td>
</tr>
<tr>
<td><button type="button" id="bell" class="btn btn-primary ">
<i class="icon-bell"></i> Launch alert
</button>
</td>
<td>
images/beeb.mp3
</td>
<td>
<pre>
<code>
$('#bell').click( function(){
$.notify({
icon: 'flaticon-alarm-1',
title: 'Bootstrap notify',
message: 'Hello World!',
url: '#index.html',
target: '_self'
},{
// settings
type: 'success'
});
$.playSound("images/beeb.mp3");
});
</code>
</pre>
</td>
</tr>
</table>
</div>
<div>
<pre>
<code class="table-responsive">
Simple example: send data to PHP and show the return results :
$("document").ready(function(){
$(".form-data").submit(function(){
data = $(this).serialize();
$.ajax({
type: "POST",
dataType: "json",
url: "example.php", //Relative or absolute path to response.php file
data: data,
success: function(data) {
if(data.type === 'error')
{
$.notify({
icon: 'flaticon-alarm-1',
title: data.issue,
message: data.opinion
},{
type: 'danger'
});
$.playSound("images/beeb.mp3");
}else if(data.type === 'ok')
{
$.notify({
icon: 'flaticon-alarm-1',
title: data.thanks,
message: data.welcome
},{
type: 'success'
});
$.playSound("images/beeb.mp3");
}
}
});
return false;
});
});
File Example.php:
if(empty($_POST['names']))
{
$return = array('type'=>'error','issue'=>'This username is already taken',
'opinion' => 'Suggestion: irfan3400, irfanghouri');
echo json_encode($return);
}else
{
$return = array('type'=>'ok','thanks'=>'This username is already taken',
'welcome' => 'Thank you for choose us, Check inbox for account activation');
echo json_encode($return);
}
</code>
</pre>
<br>
<div class="display-7 text-center">
Build something awesome :)
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal effect-pulse" id="exampleModal" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script>
$('#modals').click(function() {
$('#exampleModal').modal('show');
$.playSound("images/beeb.mp3");
});
$('#bell').click(function() {
$.notify({
icon: 'flaticon-alarm-1',
title: 'Bootstrap notify',
message: 'Turning standard Bootstrap alerts into "notify" like notifications',
url: '#index.html',
target: '_self'
}, {
// settings
type: 'success'
});
$.playSound("images/beeb.mp3");
});
</script>
</body>
</html>