forked from lipis/bootstrap-sweetalert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·307 lines (275 loc) · 12.1 KB
/
index.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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!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">
<meta property="og:title" content="Social Buttons for Bootstrap" />
<meta property="og:description" content="A beautiful replacement for JavaScript's 'alert' for Bootstrap" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://lipis.github.io/bootstrap-sweetalert/" />
<meta property="og:image" content="http://lipis.github.io/bootstrap-social/assets/bootstrap-sweetalert.png" />
<title>SweetAlert for Bootstrap</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-2.1.1.js"></script>
<link href="assets/docs.css" rel="stylesheet">
<!-- Debug -->
<script src="//localhost:32123/livereload.js"></script>
<!-- This is what you need -->
<script src="lib/sweet-alert.js"></script>
<link rel="stylesheet" href="lib/sweet-alert.css">
<!--.......................-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42119746-3', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<div class="jumbotron">
<h1>SweetAlert for Bootstrap</h1>
<p>A beautiful replacement for JavaScript's "alert"</p>
<p class="small">
This is just a clone for Bootstrap of the original
<a href="http://tristanedwards.me/sweetalert" target="_blank" onclick="_gaq.push(['_trackEvent', 'exit', 'header', 'Original']);">SweetAlert</a>.
</p>
<p>
<a class="btn btn-outline btn-lg" href="https://github.com/lipis/sweetalert" onclick="_gaq.push(['_trackEvent', 'exit', 'main', 'GitHub']);">
<span class="fa fa-github"></span>
View on GitHub
</a>
</p>
<ul class="jumbotron-links">
<li><a href="http://lipis.github.io/bootstrap-social" onclick="_gaq.push(['_trackEvent', 'exit', 'header', 'bootstrap-social']);"><i class="fa fa-group"></i> bootstrap-social</a></li>
<li><a href="http://lipis.github.io/flag-icon-css" onclick="_gaq.push(['_trackEvent', 'exit', 'header', 'flag-icon-css']);"><i class="fa fa-flag"></i> flag-icon-css</a></li>
</ul>
<iframe src="http://ghbtns.com/github-btn.html?user=lipis&repo=bootstrap-sweetalert&type=watch&count=true" class="social-share"></iframe>
<a href="https://twitter.com/share" class="social-share twitter-share-button" data-url="http://lipis.github.io/bootstrap-sweetalert/" data-text="SweetAlert for Bootstrap! A beautiful replacement for JavaScript's 'alert'." data-via="lipis" data-hashtags="bootstrap">Tweet</a>
</div>
<div class="container">
<h1>Try any of those!</h1>
<div class="examples">
<button class="btn btn-lg btn-primary sweet-10" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Primary']);">Primary</button>
<button class="btn btn-lg btn-info sweet-11" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Info']);">Info</button>
<button class="btn btn-lg btn-success sweet-12" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Success']);">Success</button>
<button class="btn btn-lg btn-warning sweet-13" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Warning']);">Warning</button>
<button class="btn btn-lg btn-danger sweet-14" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Danger']);">Danger</button>
</div>
<h2>Install via Bower</h2>
<pre class="text-center lead">$ bower install bootstrap-sweetalert</pre>
<p class="text-muted text-center lead">
Continue playing with the examples or check how to use it on
<a href="https://github.com/lipis/bootstrap-sweetalert#sweetalert-for-bootstrap">GitHub</a>.
</p>
<h2>Original Examples</h2>
<h4>Basic example</h4>
<div class="row">
<div class="col-sm-2 text-center">
<p><button class="btn btn-primary sweet-1" onclick="_gaq.push(['_trackEvent', 'example', 'try', 'sweet-1']);">Try It</button></p>
</div>
<div class="col-sm-10">
<pre class="code">swal("Here's a message!")</pre>
</div>
</div>
<h4>A title with a text under</h4>
<div class="row">
<div class="col-sm-2 text-center">
<p><button class="btn btn-primary sweet-2" onclick="_gaq.push(['_trackEvent', 'example', 'try', 'sweet-2']);">Try It</button></p>
</div>
<div class="col-sm-10">
<pre>swal("Here's a message!", "It's pretty, isn't it?")</pre>
</div>
</div>
<h4>A success message!</h4>
<div class="row">
<div class="col-sm-2 text-center">
<p><button class="btn btn-primary sweet-3" onclick="_gaq.push(['_trackEvent', 'example', 'try', 'sweet-3']);">Try It</button></p>
</div>
<div class="col-sm-10">
<pre>swal("Good job!", "You clicked the button!", "success")</pre>
</div>
</div>
<h4>A warning message, with a function attached to the "Confirm" button...</h4>
<div class="row">
<div class="col-sm-2 text-center">
<p><button class="btn btn-primary sweet-4" onclick="_gaq.push(['_trackEvent', 'example', 'try', 'sweet-4']);">Try It</button></p>
</div>
<div class="col-sm-10">
<pre>
swal({
title: "Are you sure?",
text: "Your will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
},
function(){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
});</pre>
</div>
</div>
<h4>...and by passing a parameter, you can execute something else for "Cancel".</h4>
<div class="row">
<div class="col-sm-2 text-center">
<p><button class="btn btn-primary sweet-5" onclick="_gaq.push(['_trackEvent', 'example', 'try', 'sweet-5']);">Try It</button></p>
</div>
<div class="col-sm-10">
<pre>
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes, delete it!",
cancelButtonText: "No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm) {
if (isConfirm) {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});</pre>
</div>
</div>
<h4>A message with a custom icon</h4>
<div class="row">
<div class="col-sm-2 text-center">
<p><button class="btn btn-primary sweet-6" onclick="_gaq.push(['_trackEvent', 'exit', 'footer', 'Lipis']);">Try It</button></p>
</div>
<div class="col-sm-10">
<pre>
swal({
title: "Sweet!",
text: "Here's a custom image.",
imageUrl: 'thumbs-up.jpg'
});</pre>
</div>
</div>
</div>
<footer>
<ul class="links">
<li><a href="http://lip.is" onclick="_gaq.push(['_trackEvent', 'exit', 'footer', 'Lipis']);">Lipis</a></li>
<li><a href="http://github.com/lipis" onclick="_gaq.push(['_trackEvent', 'exit', 'footer', 'GitHub']);"><i class="fa fa-github"></i> GitHub</a></li>
<li><a href="http://twitter.com/lipis" onclick="_gaq.push(['_trackEvent', 'exit', 'footer', 'Twitter']);"><i class="fa fa-twitter"></i> Twitter</a></li>
<li><a href="http://google.com/+PanayiotisLipiridis" onclick="_gaq.push(['_trackEvent', 'exit', 'footer', 'Google+']);"><i class="fa fa-google-plus"></i> Google+</a></li>
<li><a href="http://opensource.org/licenses/MIT" onclick="_gaq.push(['_trackEvent', 'exit', 'footer', 'MIT']);"><i class="fa fa-building"></i> MIT License</a></li>
</ul>
</footer>
<script>
document.querySelector('.sweet-1').onclick = function(){
swal("Here's a message!");
};
document.querySelector('.sweet-2').onclick = function(){
swal("Here's a message!", "It's pretty, isn't it?")
};
document.querySelector('.sweet-3').onclick = function(){
swal("Good job!", "You clicked the button!", "success");
};
document.querySelector('.sweet-4').onclick = function(){
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonClass: 'btn-danger',
confirmButtonText: 'Yes, delete it!',
closeOnConfirm: false,
//closeOnCancel: false
},
function(){
swal("Deleted!", "Your imaginary file has been deleted!", "success");
});
};
document.querySelector('.sweet-5').onclick = function(){
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonClass: 'btn-danger',
confirmButtonText: 'Yes, delete it!',
cancelButtonText: "No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm){
if (isConfirm){
swal("Deleted!", "Your imaginary file has been deleted!", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});
};
document.querySelector('.sweet-6').onclick = function(){
swal({
title: "Sweet!",
text: "Here's a custom image.",
imageUrl: 'assets/thumbs-up.jpg'
});
};
document.querySelector('.sweet-10').onclick = function(){
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "info",
showCancelButton: true,
confirmButtonClass: 'btn-primary',
confirmButtonText: 'Primary!'
});
};
document.querySelector('.sweet-11').onclick = function(){
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "info",
showCancelButton: true,
confirmButtonClass: 'btn-info',
confirmButtonText: 'Info!'
});
};
document.querySelector('.sweet-12').onclick = function(){
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "success",
showCancelButton: true,
confirmButtonClass: 'btn-success',
confirmButtonText: 'Success!'
});
};
document.querySelector('.sweet-13').onclick = function(){
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonClass: 'btn-warning',
confirmButtonText: 'Warning!'
});
};
document.querySelector('.sweet-14').onclick = function(){
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "error",
showCancelButton: true,
confirmButtonClass: 'btn-danger',
confirmButtonText: 'Danger!'
});
};
</script>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
</script>
</body>
</html>