abstracted 0.0.6 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +11 -8
  4. data/app/assets/javascripts/abstract_resources.js +29 -25
  5. data/app/assets/javascripts/crud.js.coffee +174 -29
  6. data/app/assets/javascripts/initializers.js.coffee +403 -58
  7. data/app/assets/javascripts/pagescrolling.js.coffee +92 -0
  8. data/app/assets/stylesheets/abstract_resources.css +5 -0
  9. data/app/assets/stylesheets/scaffold.css +4 -2
  10. data/app/assets/stylesheets/selectize.css.scss +0 -0
  11. data/app/controllers/abstract_resources_controller.rb +473 -134
  12. data/app/controllers/application_controller.rb +22 -7
  13. data/app/helpers/abstract_resources_helper.rb +515 -9
  14. data/app/helpers/fab_button_helper.rb +82 -0
  15. data/app/models/abstract_resource.rb +141 -89
  16. data/app/models/ancestry_abstract_resource.rb +27 -0
  17. data/app/models/concerns/roleable.rb +1 -1
  18. data/app/policies/abstract_resource_policy.rb +25 -0
  19. data/app/views/abstract_resources/_title.html.haml +2 -0
  20. data/app/views/abstract_resources/activate.html.haml +5 -0
  21. data/app/views/abstract_resources/attach.html.haml +6 -0
  22. data/app/views/abstract_resources/deactivate.html.haml +5 -0
  23. data/app/views/abstract_resources/defer.html.haml +5 -0
  24. data/app/views/abstract_resources/destroy.js.haml +2 -1
  25. data/app/views/abstract_resources/detach.html.haml +5 -0
  26. data/app/views/abstract_resources/edit.html.haml +4 -9
  27. data/app/views/abstract_resources/error.html.haml +2 -0
  28. data/app/views/abstract_resources/error.js.haml +2 -0
  29. data/app/views/abstract_resources/index.html.haml +27 -0
  30. data/app/views/abstract_resources/index.js.haml +2 -0
  31. data/app/views/abstract_resources/new.html.haml +4 -10
  32. data/app/views/abstract_resources/prefer.html.haml +5 -0
  33. data/app/views/abstract_resources/print.html.haml +2 -0
  34. data/app/views/abstract_resources/print.js.haml +2 -0
  35. data/app/views/abstract_resources/show.html.haml +5 -11
  36. data/app/views/layouts/_messages.html.haml +1 -0
  37. data/app/views/layouts/_navigation.html.haml +13 -0
  38. data/bower.json +34 -0
  39. data/config/initializers/exception.rb +19 -0
  40. data/config/initializers/pundit.rb +22 -0
  41. data/config/routes.rb +24 -0
  42. data/lib/abstracted.rb +3 -0
  43. data/lib/abstracted/version.rb +1 -1
  44. data/lib/abstracted_responder.rb +1 -0
  45. data/lib/exceptions.rb +61 -0
  46. data/vendor/assets/components/jquery/.bower.json +38 -0
  47. data/vendor/assets/components/jquery/MIT-LICENSE.txt +21 -0
  48. data/vendor/assets/components/jquery/bower.json +28 -0
  49. data/vendor/assets/components/jquery/dist/jquery.js +9210 -0
  50. data/vendor/assets/components/jquery/dist/jquery.min.js +5 -0
  51. data/vendor/assets/components/jquery/dist/jquery.min.map +1 -0
  52. data/vendor/assets/components/jquery/src/ajax.js +786 -0
  53. data/vendor/assets/components/jquery/src/ajax/jsonp.js +89 -0
  54. data/vendor/assets/components/jquery/src/ajax/load.js +75 -0
  55. data/vendor/assets/components/jquery/src/ajax/parseJSON.js +13 -0
  56. data/vendor/assets/components/jquery/src/ajax/parseXML.js +28 -0
  57. data/vendor/assets/components/jquery/src/ajax/script.js +64 -0
  58. data/vendor/assets/components/jquery/src/ajax/var/nonce.js +5 -0
  59. data/vendor/assets/components/jquery/src/ajax/var/rquery.js +3 -0
  60. data/vendor/assets/components/jquery/src/ajax/xhr.js +136 -0
  61. data/vendor/assets/components/jquery/src/attributes.js +11 -0
  62. data/vendor/assets/components/jquery/src/attributes/attr.js +141 -0
  63. data/vendor/assets/components/jquery/src/attributes/classes.js +158 -0
  64. data/vendor/assets/components/jquery/src/attributes/prop.js +94 -0
  65. data/vendor/assets/components/jquery/src/attributes/support.js +35 -0
  66. data/vendor/assets/components/jquery/src/attributes/val.js +161 -0
  67. data/vendor/assets/components/jquery/src/callbacks.js +205 -0
  68. data/vendor/assets/components/jquery/src/core.js +502 -0
  69. data/vendor/assets/components/jquery/src/core/access.js +60 -0
  70. data/vendor/assets/components/jquery/src/core/init.js +123 -0
  71. data/vendor/assets/components/jquery/src/core/parseHTML.js +39 -0
  72. data/vendor/assets/components/jquery/src/core/ready.js +97 -0
  73. data/vendor/assets/components/jquery/src/core/var/rsingleTag.js +4 -0
  74. data/vendor/assets/components/jquery/src/css.js +450 -0
  75. data/vendor/assets/components/jquery/src/css/addGetHookIf.js +22 -0
  76. data/vendor/assets/components/jquery/src/css/curCSS.js +57 -0
  77. data/vendor/assets/components/jquery/src/css/defaultDisplay.js +70 -0
  78. data/vendor/assets/components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
  79. data/vendor/assets/components/jquery/src/css/support.js +96 -0
  80. data/vendor/assets/components/jquery/src/css/swap.js +28 -0
  81. data/vendor/assets/components/jquery/src/css/var/cssExpand.js +3 -0
  82. data/vendor/assets/components/jquery/src/css/var/getStyles.js +12 -0
  83. data/vendor/assets/components/jquery/src/css/var/isHidden.js +13 -0
  84. data/vendor/assets/components/jquery/src/css/var/rmargin.js +3 -0
  85. data/vendor/assets/components/jquery/src/css/var/rnumnonpx.js +5 -0
  86. data/vendor/assets/components/jquery/src/data.js +178 -0
  87. data/vendor/assets/components/jquery/src/data/Data.js +181 -0
  88. data/vendor/assets/components/jquery/src/data/accepts.js +20 -0
  89. data/vendor/assets/components/jquery/src/data/var/data_priv.js +5 -0
  90. data/vendor/assets/components/jquery/src/data/var/data_user.js +5 -0
  91. data/vendor/assets/components/jquery/src/deferred.js +149 -0
  92. data/vendor/assets/components/jquery/src/deprecated.js +13 -0
  93. data/vendor/assets/components/jquery/src/dimensions.js +50 -0
  94. data/vendor/assets/components/jquery/src/effects.js +648 -0
  95. data/vendor/assets/components/jquery/src/effects/Tween.js +114 -0
  96. data/vendor/assets/components/jquery/src/effects/animatedSelector.js +13 -0
  97. data/vendor/assets/components/jquery/src/event.js +868 -0
  98. data/vendor/assets/components/jquery/src/event/ajax.js +13 -0
  99. data/vendor/assets/components/jquery/src/event/alias.js +39 -0
  100. data/vendor/assets/components/jquery/src/event/support.js +9 -0
  101. data/vendor/assets/components/jquery/src/exports/amd.js +24 -0
  102. data/vendor/assets/components/jquery/src/exports/global.js +32 -0
  103. data/vendor/assets/components/jquery/src/intro.js +44 -0
  104. data/vendor/assets/components/jquery/src/jquery.js +37 -0
  105. data/vendor/assets/components/jquery/src/manipulation.js +580 -0
  106. data/vendor/assets/components/jquery/src/manipulation/_evalUrl.js +18 -0
  107. data/vendor/assets/components/jquery/src/manipulation/support.js +32 -0
  108. data/vendor/assets/components/jquery/src/manipulation/var/rcheckableType.js +3 -0
  109. data/vendor/assets/components/jquery/src/offset.js +207 -0
  110. data/vendor/assets/components/jquery/src/outro.js +1 -0
  111. data/vendor/assets/components/jquery/src/queue.js +142 -0
  112. data/vendor/assets/components/jquery/src/queue/delay.js +22 -0
  113. data/vendor/assets/components/jquery/src/selector-native.js +172 -0
  114. data/vendor/assets/components/jquery/src/selector-sizzle.js +14 -0
  115. data/vendor/assets/components/jquery/src/selector.js +1 -0
  116. data/vendor/assets/components/jquery/src/serialize.js +111 -0
  117. data/vendor/assets/components/jquery/src/sizzle/dist/sizzle.js +2067 -0
  118. data/vendor/assets/components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
  119. data/vendor/assets/components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
  120. data/vendor/assets/components/jquery/src/traversing.js +199 -0
  121. data/vendor/assets/components/jquery/src/traversing/findFilter.js +100 -0
  122. data/vendor/assets/components/jquery/src/traversing/var/rneedsContext.js +6 -0
  123. data/vendor/assets/components/jquery/src/var/arr.js +3 -0
  124. data/vendor/assets/components/jquery/src/var/class2type.js +4 -0
  125. data/vendor/assets/components/jquery/src/var/concat.js +5 -0
  126. data/vendor/assets/components/jquery/src/var/hasOwn.js +5 -0
  127. data/vendor/assets/components/jquery/src/var/indexOf.js +5 -0
  128. data/vendor/assets/components/jquery/src/var/pnum.js +3 -0
  129. data/vendor/assets/components/jquery/src/var/push.js +5 -0
  130. data/vendor/assets/components/jquery/src/var/rnotwhite.js +3 -0
  131. data/vendor/assets/components/jquery/src/var/slice.js +5 -0
  132. data/vendor/assets/components/jquery/src/var/strundefined.js +3 -0
  133. data/vendor/assets/components/jquery/src/var/support.js +4 -0
  134. data/vendor/assets/components/jquery/src/var/toString.js +5 -0
  135. data/vendor/assets/components/jquery/src/wrap.js +79 -0
  136. data/vendor/assets/components/microplugin/.bower.json +38 -0
  137. data/vendor/assets/components/microplugin/.gitignore +2 -0
  138. data/vendor/assets/components/microplugin/.npmignore +3 -0
  139. data/vendor/assets/components/microplugin/README.md +115 -0
  140. data/vendor/assets/components/microplugin/bower.json +22 -0
  141. data/vendor/assets/components/microplugin/package.json +15 -0
  142. data/vendor/assets/components/microplugin/src/microplugin.js +135 -0
  143. data/vendor/assets/components/selectize/.bower.json +60 -0
  144. data/vendor/assets/components/selectize/.gitignore +5 -0
  145. data/vendor/assets/components/selectize/LICENSE +202 -0
  146. data/vendor/assets/components/selectize/README.md +105 -0
  147. data/vendor/assets/components/selectize/bower.json +40 -0
  148. data/vendor/assets/components/selectize/dist/css/selectize.bootstrap2.css +487 -0
  149. data/vendor/assets/components/selectize/dist/css/selectize.bootstrap3.css +401 -0
  150. data/vendor/assets/components/selectize/dist/css/selectize.css +317 -0
  151. data/vendor/assets/components/selectize/dist/css/selectize.default.css +387 -0
  152. data/vendor/assets/components/selectize/dist/css/selectize.legacy.css +364 -0
  153. data/vendor/assets/components/selectize/dist/js/selectize.js +3058 -0
  154. data/vendor/assets/components/selectize/dist/js/selectize.min.js +3 -0
  155. data/vendor/assets/components/selectize/dist/js/standalone/selectize.js +3667 -0
  156. data/vendor/assets/components/selectize/dist/js/standalone/selectize.min.js +3 -0
  157. data/vendor/assets/components/selectize/dist/less/plugins/drag_drop.less +16 -0
  158. data/vendor/assets/components/selectize/dist/less/plugins/dropdown_header.less +20 -0
  159. data/vendor/assets/components/selectize/dist/less/plugins/optgroup_columns.less +17 -0
  160. data/vendor/assets/components/selectize/dist/less/plugins/remove_button.less +37 -0
  161. data/vendor/assets/components/selectize/dist/less/selectize.bootstrap2.less +161 -0
  162. data/vendor/assets/components/selectize/dist/less/selectize.bootstrap3.less +150 -0
  163. data/vendor/assets/components/selectize/dist/less/selectize.default.less +84 -0
  164. data/vendor/assets/components/selectize/dist/less/selectize.legacy.less +75 -0
  165. data/vendor/assets/components/selectize/dist/less/selectize.less +295 -0
  166. data/vendor/assets/components/selectize/karma.conf.js +107 -0
  167. data/vendor/assets/components/sifter/.bower.json +44 -0
  168. data/vendor/assets/components/sifter/.gitignore +3 -0
  169. data/vendor/assets/components/sifter/.npmignore +4 -0
  170. data/vendor/assets/components/sifter/README.md +149 -0
  171. data/vendor/assets/components/sifter/bower.json +23 -0
  172. data/vendor/assets/components/sifter/package.json +48 -0
  173. data/vendor/assets/components/sifter/sifter.js +471 -0
  174. data/vendor/assets/components/sifter/sifter.min.js +2 -0
  175. data/vendor/assets/components/sweetalert/.bower.json +36 -0
  176. data/vendor/assets/components/sweetalert/.editorconfig +11 -0
  177. data/vendor/assets/components/sweetalert/.gitignore +5 -0
  178. data/vendor/assets/components/sweetalert/.jshintrc +11 -0
  179. data/vendor/assets/components/sweetalert/.travis.yml +6 -0
  180. data/vendor/assets/components/sweetalert/LICENSE +22 -0
  181. data/vendor/assets/components/sweetalert/README.md +157 -0
  182. data/vendor/assets/components/sweetalert/bower.json +25 -0
  183. data/vendor/assets/components/sweetalert/dev/gulpfile-wrap-template.js +18 -0
  184. data/vendor/assets/components/sweetalert/dev/ie9.css +23 -0
  185. data/vendor/assets/components/sweetalert/dev/loader-animation.css +209 -0
  186. data/vendor/assets/components/sweetalert/dev/modules/default-params.js +26 -0
  187. data/vendor/assets/components/sweetalert/dev/modules/handle-click.js +128 -0
  188. data/vendor/assets/components/sweetalert/dev/modules/handle-dom.js +161 -0
  189. data/vendor/assets/components/sweetalert/dev/modules/handle-key.js +73 -0
  190. data/vendor/assets/components/sweetalert/dev/modules/handle-swal-dom.js +148 -0
  191. data/vendor/assets/components/sweetalert/dev/modules/injected-html.js +69 -0
  192. data/vendor/assets/components/sweetalert/dev/modules/set-params.js +221 -0
  193. data/vendor/assets/components/sweetalert/dev/modules/utils.js +71 -0
  194. data/vendor/assets/components/sweetalert/dev/sweetalert.es6.js +311 -0
  195. data/vendor/assets/components/sweetalert/dev/sweetalert.scss +648 -0
  196. data/vendor/assets/components/sweetalert/dist/sweetalert-dev.js +1281 -0
  197. data/vendor/assets/components/sweetalert/dist/sweetalert.css +932 -0
  198. data/vendor/assets/components/sweetalert/dist/sweetalert.min.js +1 -0
  199. data/vendor/assets/components/sweetalert/example/example.css +442 -0
  200. data/vendor/assets/components/sweetalert/example/example.scss +580 -0
  201. data/vendor/assets/components/sweetalert/example/images/logo_big.png +0 -0
  202. data/vendor/assets/components/sweetalert/example/images/logo_big@2x.png +0 -0
  203. data/vendor/assets/components/sweetalert/example/images/logo_small.png +0 -0
  204. data/vendor/assets/components/sweetalert/example/images/logo_small@2x.png +0 -0
  205. data/vendor/assets/components/sweetalert/example/images/te-logo-small.svg +12 -0
  206. data/vendor/assets/components/sweetalert/example/images/thumbs-up.jpg +0 -0
  207. data/vendor/assets/components/sweetalert/example/images/vs_icon.png +0 -0
  208. data/vendor/assets/components/sweetalert/example/images/vs_icon@2x.png +0 -0
  209. data/vendor/assets/components/sweetalert/gulpfile.js +97 -0
  210. data/vendor/assets/components/sweetalert/index.html +584 -0
  211. data/vendor/assets/components/sweetalert/package.json +45 -0
  212. data/vendor/assets/components/sweetalert/sweetalert.gif +0 -0
  213. data/vendor/assets/components/sweetalert/test/index.html +20 -0
  214. data/vendor/assets/components/sweetalert/test/tests.js +143 -0
  215. data/vendor/assets/components/sweetalert/themes/facebook/facebook.css +111 -0
  216. data/vendor/assets/components/sweetalert/themes/facebook/facebook.scss +146 -0
  217. data/vendor/assets/components/sweetalert/themes/google/google.css +115 -0
  218. data/vendor/assets/components/sweetalert/themes/google/google.scss +148 -0
  219. data/vendor/assets/components/sweetalert/themes/twitter/twitter.css +140 -0
  220. data/vendor/assets/components/sweetalert/themes/twitter/twitter.scss +177 -0
  221. metadata +214 -5
  222. data/abstracted-0.0.4.gem +0 -0
  223. data/abstracted.gemspec +0 -51
  224. data/app/views/abstract_resources/index.html.erb +0 -1
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg width="14px" height="11px" viewBox="0 0 14 11" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
3
+ <!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
4
+ <title>te-logo-small</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <defs></defs>
7
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
8
+ <g id="Website" sketch:type="MSArtboardGroup" transform="translate(-520.000000, -1871.000000)" fill="#AFC1C9">
9
+ <path d="M526.768,1871.832 L524.416,1871.832 L524.416,1881.672 L523.488,1881.672 L523.488,1871.832 L520,1871.832 L520,1871 L527.336,1871 L533.536,1871 L533.536,1871.832 L527.68,1871.832 L527.68,1875.784 L533.424,1875.784 L533.424,1876.616 L527.68,1876.616 L527.68,1880.84 L533.536,1880.84 L533.536,1881.672 L526.768,1881.672 L526.768,1871.832 Z" id="te-logo-small" sketch:type="MSShapeGroup"></path>
10
+ </g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,97 @@
1
+ var gulp = require('gulp');
2
+
3
+ var glob = require('glob');
4
+ var path = require('path');
5
+ var jshint = require('gulp-jshint');
6
+ var sass = require('gulp-sass');
7
+ var concat = require('gulp-concat');
8
+ var uglify = require('gulp-uglify');
9
+ var rename = require('gulp-rename');
10
+ var minifyCSS = require('gulp-minify-css');
11
+ var babelify = require('babelify');
12
+ var browserify = require('browserify');
13
+ var source = require('vinyl-source-stream');
14
+ var buffer = require('vinyl-buffer');
15
+ var wrap = require('gulp-wrap');
16
+ var qunit = require('gulp-qunit');
17
+
18
+ // Lint Task
19
+ gulp.task('lint', function() {
20
+ gulp.src('dev/sweetalert.es6.js')
21
+ .pipe(jshint())
22
+ .pipe(jshint.reporter('default'));
23
+
24
+ return gulp.src('dev/*/*.js')
25
+ .pipe(jshint())
26
+ .pipe(jshint.reporter('default'));
27
+ });
28
+
29
+ // Compile Our Sass
30
+ gulp.task('sass', function() {
31
+
32
+ gulp.src('example/example.scss')
33
+ .pipe(sass())
34
+ .pipe(rename('example.css'))
35
+ .pipe(gulp.dest('example'));
36
+
37
+ // (We don't use minifyCSS since it breaks the ie9 file for some reason)
38
+ gulp.src(['dev/sweetalert.scss', 'dev/ie9.css', 'dev/loader-animation.css'])
39
+ .pipe(sass())
40
+ .pipe(concat('sweetalert.css'))
41
+ .pipe(gulp.dest('dist'));
42
+ });
43
+
44
+
45
+ // Compile theme CSS
46
+ var themes = glob.sync('themes/*').map(function(themeDir) {
47
+ return path.basename(themeDir);
48
+ });
49
+
50
+ themes.forEach(function(name) {
51
+ gulp.task(name + '-theme', function() {
52
+ return gulp.src('themes/' + name + '/' + name + '.scss')
53
+ .pipe(sass()) // etc
54
+ .pipe(rename(name + '.css'))
55
+ .pipe(gulp.dest('themes/' + name))
56
+ });
57
+ });
58
+
59
+ gulp.task('themes', themes.map(function(name){ return name + '-theme'; }));
60
+
61
+
62
+ // Concatenate & Minify JS
63
+ gulp.task('scripts', function() {
64
+ return browserify({
65
+ entries: './dev/sweetalert.es6.js',
66
+ debug: true
67
+ })
68
+ .transform(babelify)
69
+ .bundle()
70
+ .pipe(source('sweetalert-dev.js'))
71
+ .pipe(wrap({
72
+ src: './dev/gulpfile-wrap-template.js'
73
+ }))
74
+ .pipe(gulp.dest('dist')) // Developer version
75
+
76
+ .pipe(rename('sweetalert.min.js'))
77
+ .pipe(buffer())
78
+ .pipe(uglify())
79
+ .pipe(gulp.dest('dist')); // User version
80
+ });
81
+
82
+ gulp.task('test', function() {
83
+ return gulp.src('./test/index.html')
84
+ .pipe(qunit({
85
+ timeout: 20
86
+ }));
87
+ });
88
+
89
+ // Watch Files For Changes
90
+ gulp.task('watch', function() {
91
+ gulp.watch(['dev/*.js', 'dev/*/*.js'], ['lint', 'scripts']);
92
+ gulp.watch(['dev/*.scss', 'dev/*.css'], ['sass']);
93
+ gulp.watch('themes/*/*.scss', ['themes']);
94
+ });
95
+
96
+ // Default Task
97
+ gulp.task('default', ['lint', 'sass', 'scripts', 'watch', 'test']);
@@ -0,0 +1,584 @@
1
+ <!doctype html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
8
+ <title>SweetAlert</title>
9
+
10
+ <link rel="stylesheet" href="example/example.css">
11
+ <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
12
+
13
+ <!-- This is what you need -->
14
+ <script src="dist/sweetalert-dev.js"></script>
15
+ <link rel="stylesheet" href="dist/sweetalert.css">
16
+ <!--.......................-->
17
+
18
+ </head>
19
+
20
+ <body>
21
+
22
+ <h1>Sweet Alert</h1>
23
+ <h2>A beautiful replacement for JavaScript's "Alert"</h2>
24
+ <button class="download">Download</button>
25
+
26
+ <!-- What does it do? -->
27
+ <h3>So... What does it do?</h3>
28
+ <p>Here’s a comparison of a standard error message. The first one uses the built-in <strong>alert</strong>-function, while the second is using <strong>sweetAlert</strong>.</p>
29
+
30
+ <div class="showcase normal">
31
+ <h4>Normal alert</h4>
32
+ <button>Show error message</button>
33
+
34
+ <h5>Code:</h5>
35
+ <pre><span class="attr">alert</span>(<span class="str">"Oops... Something went wrong!"</span>);
36
+
37
+ </pre>
38
+
39
+ <div class="vs-icon"></div>
40
+ </div>
41
+
42
+ <div class="showcase sweet">
43
+ <h4>Sweet Alert</h4>
44
+ <button>Show error message</button>
45
+
46
+ <h5>Code:</h5>
47
+ <pre><span class="attr">sweetAlert</span>(<span class="str">"Oops..."</span>, <span class="str">"Something went wrong!"</span>, <span class="str">"error"</span>);</pre>
48
+ </div>
49
+
50
+ <p>Pretty cool huh? SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. It's even highly customizeable, as you can see below!</p>
51
+
52
+
53
+ <!-- Examples -->
54
+ <h3>More examples</h3>
55
+
56
+ <p class="center">In these examples, we're using the shorthand function <strong>swal</strong> to call sweetAlert.</p>
57
+
58
+ <ul class="examples">
59
+
60
+ <li class="message">
61
+ <div class="ui">
62
+ <p>A basic message</p>
63
+ <button>Try me!</button>
64
+ </div>
65
+ <pre><span class="attr">swal</span>(<span class="str">"Here's a message!"</span>)</pre>
66
+ </li>
67
+
68
+ <li class="title-text">
69
+ <div class="ui">
70
+ <p>A title with a text under</p>
71
+ <button>Try me!</button>
72
+ </div>
73
+ <pre><span class="attr">swal</span>(<span class="str">"Here's a message!"</span>, <span class="str">"It's pretty, isn't it?"</span>)</pre>
74
+ </li>
75
+
76
+ <li class="success">
77
+ <div class="ui">
78
+ <p>A success message!</p>
79
+ <button>Try me!</button>
80
+ </div>
81
+ <pre><span class="attr">swal</span>(<span class="str">"Good job!"</span>, <span class="str">"You clicked the button!"</span>, <span class="str">"success"</span>)</pre>
82
+ </li>
83
+
84
+ <li class="warning confirm">
85
+ <div class="ui">
86
+ <p>A warning message, with a function attached to the "Confirm"-button...</p>
87
+ <button>Try me!</button>
88
+ </div>
89
+ <pre><span class="attr">swal</span>({
90
+ &nbsp;&nbsp;title: <span class="str">"Are you sure?"</span>,
91
+ &nbsp;&nbsp;text: <span class="str">"You will not be able to recover this imaginary file!"</span>,
92
+ &nbsp;&nbsp;type: <span class="str">"warning"</span>,
93
+ &nbsp;&nbsp;showCancelButton: <span class="val">true</span>,
94
+ &nbsp;&nbsp;confirmButtonColor: <span class="str">"#DD6B55"</span>,
95
+ &nbsp;&nbsp;confirmButtonText: <span class="str">"Yes, delete it!"</span>,
96
+ &nbsp;&nbsp;closeOnConfirm: <span class="val">false</span>
97
+ },
98
+ <span class="func"><i>function</i></span>(){
99
+ &nbsp;&nbsp;<span class="attr">swal</span>(<span class="str">"Deleted!"</span>, <span class="str">"Your imaginary file has been deleted."</span>, <span class="str">"success"</span>);
100
+ });</pre>
101
+ </li>
102
+
103
+ <li class="warning cancel">
104
+ <div class="ui">
105
+ <p>... and by passing a parameter, you can execute something else for "Cancel".</p>
106
+ <button>Try me!</button>
107
+ </div>
108
+ <pre><span class="attr">swal</span>({
109
+ &nbsp;&nbsp;title: <span class="str">"Are you sure?"</span>,
110
+ &nbsp;&nbsp;text: <span class="str">"You will not be able to recover this imaginary file!"</span>,
111
+ &nbsp;&nbsp;type: <span class="str">"warning"</span>,
112
+ &nbsp;&nbsp;showCancelButton: <span class="val">true</span>,
113
+ &nbsp;&nbsp;confirmButtonColor: <span class="str">"#DD6B55"</span>,
114
+ &nbsp;&nbsp;confirmButtonText: <span class="str">"Yes, delete it!"</span>,
115
+ &nbsp;&nbsp;cancelButtonText: <span class="str">"No, cancel plx!"</span>,
116
+ &nbsp;&nbsp;closeOnConfirm: <span class="val">false</span>,
117
+ &nbsp;&nbsp;closeOnCancel: <span class="val">false</span>
118
+ },
119
+ <span class="func"><i>function</i></span>(isConfirm){
120
+ &nbsp;&nbsp;<span class="tag">if</span> (isConfirm) {
121
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="attr">swal</span>(<span class="str">"Deleted!"</span>, <span class="str">"Your imaginary file has been deleted."</span>, <span class="str">"success"</span>);
122
+ &nbsp;&nbsp;} <span class="tag">else</span> {
123
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="attr">swal</span>(<span class="str">"Cancelled"</span>, <span class="str">"Your imaginary file is safe :)"</span>, <span class="str">"error"</span>);
124
+ &nbsp;&nbsp;}
125
+ });</pre>
126
+ </li>
127
+
128
+ <li class="custom-icon">
129
+ <div class="ui">
130
+ <p>A message with a custom icon</p>
131
+ <button>Try me!</button>
132
+ </div>
133
+ <pre><span class="attr">swal</span>({
134
+ &nbsp;&nbsp;title: <span class="str">"Sweet!"</span>,
135
+ &nbsp;&nbsp;text: <span class="str">"Here's a custom image."</span>,
136
+ &nbsp;&nbsp;imageUrl: <span class="str">"images/thumbs-up.jpg"</span>
137
+ });</pre>
138
+ </li>
139
+
140
+ <li class="message-html">
141
+ <div class="ui">
142
+ <p>An HTML message</p>
143
+ <button>Try me!</button>
144
+ </div>
145
+ <pre><span class="attr">swal</span>({
146
+ &nbsp;&nbsp;title: <span class="str">"HTML &lt;small&gt;Title&lt;/small&gt;!"</span>,
147
+ &nbsp;&nbsp;text: <span class="str">"A custom &lt;span style="color:#F8BB86"&gt;html&lt;span&gt; message."</span>,
148
+ &nbsp;&nbsp;html: <span class="val">true</span>
149
+ });</pre>
150
+ </li>
151
+
152
+ <li class="timer">
153
+ <div class="ui">
154
+ <p>A message with auto close timer</p>
155
+ <button>Try me!</button>
156
+ </div>
157
+ <pre><span class="attr">swal</span>({
158
+ &nbsp;&nbsp;title: <span class="str">"Auto close alert!"</span>,
159
+ &nbsp;&nbsp;text: <span class="str">"I will close in 2 seconds."</span>,
160
+ &nbsp;&nbsp;timer: <span class="val">2000</span>,
161
+ &nbsp;&nbsp;showConfirmButton: <span class="val">false</span>
162
+ });</pre>
163
+ </li>
164
+
165
+
166
+ <li class="input">
167
+ <div class="ui">
168
+ <p>A replacement for the "prompt" function</p>
169
+ <button>Try me!</button>
170
+ </div>
171
+ <pre><span class="attr">swal</span>({
172
+ &nbsp;&nbsp;title: <span class="str">"An input!"</span>,
173
+ &nbsp;&nbsp;text: <span class="str">"Write something interesting:"</span>,
174
+ &nbsp;&nbsp;type: <span class="str">"input"</span>,
175
+ &nbsp;&nbsp;showCancelButton: <span class="val">true</span>,
176
+ &nbsp;&nbsp;closeOnConfirm: <span class="val">false</span>,
177
+ &nbsp;&nbsp;animation: <span class="str">"slide-from-top"</span>,
178
+ &nbsp;&nbsp;inputPlaceholder: <span class="str">"Write something"</span>
179
+ },
180
+ <span class="func"><i>function</i></span>(<span class="arg">inputValue</span>){
181
+ &nbsp;&nbsp;<span class="tag">if</span> (inputValue <span class="tag">===</span> <span class="val">false</span>) <span class="tag">return</span> <span class="val">false</span>;
182
+ &nbsp;&nbsp;
183
+ &nbsp;&nbsp;<span class="tag">if</span> (inputValue <span class="tag">===</span> <span class="str">""</span>) {
184
+ &nbsp;&nbsp;&nbsp;&nbsp;swal<span class="tag">.</span><span class="attr">showInputError</span>(<span class="str">"You need to write something!"</span>);
185
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="tag">return</span> <span class="val">false</span>
186
+ &nbsp;&nbsp;}
187
+ &nbsp;&nbsp;
188
+ &nbsp;&nbsp;<span class="attr">swal</span>(<span class="str">"Nice!"</span>, <span class="str">"You wrote: "</span> + inputValue, <span class="str">"success"</span>);
189
+ });</pre>
190
+ </li>
191
+
192
+ <li class="ajax">
193
+ <div class="ui">
194
+ <p>With a loader (for AJAX request for example)</p>
195
+ <button>Try me!</button>
196
+ </div>
197
+ <pre><span class="attr">swal</span>({
198
+ &nbsp;&nbsp;title: <span class="str">"Ajax request example"</span>,
199
+ &nbsp;&nbsp;text: <span class="str">"Submit to run ajax request"</span>,
200
+ &nbsp;&nbsp;type: <span class="str">"info"</span>,
201
+ &nbsp;&nbsp;showCancelButton: <span class="val">true</span>,
202
+ &nbsp;&nbsp;closeOnConfirm: <span class="val">false</span>,
203
+ &nbsp;&nbsp;showLoaderOnConfirm: <span class="val">true</span>,
204
+ },
205
+ <span class="func"><i>function</i></span>(){
206
+ &nbsp;&nbsp;<span class="attr">setTimeout</span>(<span class="func"><i>function</i></span>(){
207
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="attr">swal</span>(<span class="str">"Ajax request finished!"</span>);
208
+ &nbsp;&nbsp;}, <span class="val">2000</span>);
209
+ });</pre>
210
+ </li>
211
+
212
+ <li class="theme">
213
+ <div class="ui">
214
+ <p>You can also change the theme of SweetAlert!</p>
215
+ <button>Try me!</button>
216
+ </div>
217
+ <pre>&lt;<span class="tag">link</span> <span class="attr">rel</span>=<span class="str">"stylesheet"</span> <span class="tag">type</span>=<span class="str">"text/css"</span> <span class="tag">href</span>=<span class="str">"dist/sweetalert.css"</span>&gt;
218
+ &lt;<span class="tag">link</span> <span class="attr">rel</span>=<span class="str">"stylesheet"</span> <span class="tag">type</span>=<span class="str">"text/css"</span> <span class="tag">href</span>=<span class="str">"themes/twitter.css"</span>&gt;</pre>
219
+ </li>
220
+
221
+ </ul>
222
+
223
+
224
+ <!-- Download & Install -->
225
+ <h3 id="download-section">Download & install</h3>
226
+
227
+ <div class="center-container">
228
+ <p class="center"><b>Method 1:</b> Install through bower:</p>
229
+ <pre class="center">$ bower install sweetalert</pre>
230
+ </div>
231
+
232
+ <div class="center-container">
233
+ <p class="center"><b>Method 2:</b> Install through NPM:</p>
234
+ <pre class="center">$ npm install sweetalert</pre>
235
+ </div>
236
+
237
+ <p class="center"><b>Method 3:</b> Download the sweetAlert <strong>CSS</strong> and <strong>JavaScript</strong> files.</p>
238
+
239
+ <a class="button" href="https://github.com/t4t5/sweetalert/archive/master.zip" download>Download files</a>
240
+
241
+ <ol>
242
+ <li>
243
+ <p>Initialize the plugin by referencing the necessary files:</p>
244
+ <pre>&lt;<span class="tag">script</span> <span class="attr">src</span>=<span class="str">"dist/sweetalert.min.js"</span>&gt;&lt;/<span class="tag">script</span>&gt;
245
+ &lt;<span class="tag">link</span> <span class="attr">rel</span>=<span class="str">"stylesheet"</span> <span class="tag">type</span>=<span class="str">"text/css"</span> <span class="tag">href</span>=<span class="str">"dist/sweetalert.css"</span>&gt;</pre>
246
+ </li>
247
+
248
+ <li>
249
+ <p>Call the sweetAlert-function after the page has loaded</p>
250
+ <pre><span class="attr">swal</span>({
251
+ &nbsp;&nbsp;title: <span class="str">"Error!"</span>,
252
+ &nbsp;&nbsp;text: <span class="str">"Here's my error message!"</span>,
253
+ &nbsp;&nbsp;type: <span class="str">"error"</span>,
254
+ &nbsp;&nbsp;confirmButtonText: <span class="str">"Cool"</span>
255
+ });
256
+ </pre>
257
+ </li>
258
+ </ol>
259
+
260
+
261
+
262
+ <!-- Configuration -->
263
+ <h3>Configuration</h3>
264
+
265
+ <p class="center">Here are the keys that you can use if you pass an object into sweetAlert:</p>
266
+
267
+ <table>
268
+ <tr class="titles">
269
+ <th>
270
+ <div class="border-left"></div>
271
+ Argument
272
+ </th>
273
+ <th>Default value</th>
274
+ <th>
275
+ <div class="border-right"></div>
276
+ Description
277
+ </th>
278
+ </tr>
279
+ <tr>
280
+ <td><b>title</b></td>
281
+ <td><i>null (required)</i></td>
282
+ <td>The title of the modal. It can either be added to the object under the key "title" or passed as the first parameter of the function.</td>
283
+ </tr>
284
+ <tr>
285
+ <td><b>text</b></td>
286
+ <td><i>null</i></td>
287
+ <td>A description for the modal. It can either be added to the object under the key "text" or passed as the second parameter of the function.</td>
288
+ </tr>
289
+ <tr>
290
+ <td><b>type</b></td>
291
+ <td><i>null</i></td>
292
+ <td>The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "<strong>warning</strong>", "<strong>error</strong>", "<strong>success</strong>" and "<strong>info"</strong>. You can also set it as "<strong>input</strong>" to get a prompt modal. It can either be put in the object under the key "type" or passed as the third parameter of the function.</td>
293
+ </tr>
294
+ <tr>
295
+ <td><b>allowEscapeKey</b></td>
296
+ <td><i>true</i></td>
297
+ <td>If set to <strong>true</strong>, the user can dismiss the modal by pressing the Escape key.</td>
298
+ </tr>
299
+ <tr>
300
+ <td><b>customClass</b></td>
301
+ <td><i>null</i></td>
302
+ <td>A custom CSS class for the modal. It can be added to the object under the key "customClass".</td>
303
+ </tr>
304
+ <tr>
305
+ <td><b>allowOutsideClick</b></td>
306
+ <td><i>false</i></td>
307
+ <td>If set to <strong>true</strong>, the user can dismiss the modal by clicking outside it.</td>
308
+ </tr>
309
+ <tr>
310
+ <td><b>showCancelButton</b></td>
311
+ <td><i>false</i></td>
312
+ <td>If set to <strong>true</strong>, a "Cancel"-button will be shown, which the user can click on to dismiss the modal.</td>
313
+ </tr>
314
+ <tr>
315
+ <td><b>showConfirmButton</b></td>
316
+ <td><i>true</i></td>
317
+ <td>If set to <strong>false</strong>, the "OK/Confirm"-button will be hidden. Make sure you set a timer or set allowOutsideClick to true when using this, in order not to annoy the user.</td>
318
+ </tr>
319
+ <tr>
320
+ <td><b>confirmButtonText</b></td>
321
+ <td><i>"OK"</i></td>
322
+ <td>Use this to change the text on the "Confirm"-button. If showCancelButton is set as true, the confirm button will automatically show "Confirm" instead of "OK".</td>
323
+ </tr>
324
+ <tr>
325
+ <td><b>confirmButtonColor</b></td>
326
+ <td><i>"#AEDEF4"</i></td>
327
+ <td>Use this to change the background color of the "Confirm"-button (must be a HEX value).</td>
328
+ </tr>
329
+ <tr>
330
+ <td><b>cancelButtonText</b></td>
331
+ <td><i>"Cancel"</i></td>
332
+ <td>Use this to change the text on the "Cancel"-button.</td>
333
+ </tr>
334
+ <tr>
335
+ <td><b>closeOnConfirm</b></td>
336
+ <td><i>true</i></td>
337
+ <td>Set to <i>false</i> if you want the modal to stay open even if the user presses the "Confirm"-button. This is especially useful if the function attached to the "Confirm"-button is another SweetAlert.</td>
338
+ </tr>
339
+ <tr>
340
+ <td><b>closeOnCancel</b></td>
341
+ <td><i>true</i></td>
342
+ <td>Same as closeOnConfirm, but for the cancel button.</td>
343
+ </tr>
344
+ <tr>
345
+ <td><b>imageUrl</b></td>
346
+ <td><i>null</i></td>
347
+ <td>Add a customized icon for the modal. Should contain a string with the path to the image.</td>
348
+ </tr>
349
+ <tr>
350
+ <td><b>imageSize</b></td>
351
+ <td><i>"80x80"</i></td>
352
+ <td>If imageUrl is set, you can specify imageSize to describes how big you want the icon to be in px. Pass in a string with two values separated by an "x". The first value is the width, the second is the height.</td>
353
+ </tr>
354
+ <tr>
355
+ <td><b>timer</b></td>
356
+ <td><i>null</i></td>
357
+ <td>Auto close timer of the modal. Set in ms (milliseconds).</td>
358
+ </tr>
359
+ <tr>
360
+ <td><b>html</b></td>
361
+ <td><i>false</i></td>
362
+ <td>If set to true, will not escape title and text parameters. (Set to false if you're worried about XSS attacks.)</td>
363
+ </tr>
364
+ <tr>
365
+ <td><b>animation</b></td>
366
+ <td><i>true</i></td>
367
+ <td>If set to <strong>false</strong>, the modal's animation will be disabled. Possible (string) values : <strong>pop</strong> (default when animation set to true), <strong>slide-from-top</strong>, <strong>slide-from-bottom</strong></td>
368
+ </tr>
369
+ <tr>
370
+ <td><b>inputType</b></td>
371
+ <td><i>"text"</i></td>
372
+ <td>Change the type of the input field when using <strong>type: "input"</strong> (this can be useful if you want users to type in their password for example).</td>
373
+ </tr>
374
+ <tr>
375
+ <td><b>inputPlaceholder</b></td>
376
+ <td><i>null</i></td>
377
+ <td>When using the input-type, you can specify a placeholder to help the user.</td>
378
+ </tr>
379
+ <tr>
380
+ <td><b>inputValue</b></td>
381
+ <td><i>null</i></td>
382
+ <td>Specify a default text value that you want your input to show when using <strong>type: "input"</strong></td>
383
+ </tr>
384
+ <tr>
385
+ <td><b>showLoaderOnConfirm</b></td>
386
+ <td><i>false</i></td>
387
+ <td>Set to <strong>true</strong> to disable the buttons and show that something is loading.</td>
388
+ </tr>
389
+ </table>
390
+
391
+
392
+ <!-- Methods -->
393
+ <h3>Methods</h3>
394
+
395
+ <p class="center">SweetAlert also comes with some simple methods that you can call:</p>
396
+
397
+ <table>
398
+ <tr class="titles">
399
+ <th>
400
+ <div class="border-left"></div>
401
+ Function
402
+ </th>
403
+ <th>Example</th>
404
+ <th>
405
+ <div class="border-right"></div>
406
+ Description
407
+ </th>
408
+ </tr>
409
+ <tr>
410
+ <td>setDefaults</td>
411
+ <td><i>swal.setDefaults({ confirmButtonColor: '#0000' });</i></td>
412
+ <td>If you end up using a lot of the same settings when calling SweetAlert, you can use setDefaults at the start of your program to set them once and for all!</td>
413
+ </tr>
414
+ <tr>
415
+ <td>close</td>
416
+ <td><i>swal.close();</i></td>
417
+ <td>Close the currently open SweetAlert programatically.</td>
418
+ </tr>
419
+ <tr>
420
+ <td>showInputError</td>
421
+ <td><i>swal.showInputError("Invalid email!");</i></td>
422
+ <td>Show an error message after validating the input field, if the user's data is bad</td>
423
+ </tr>
424
+ <tr>
425
+ <td>enableButtons, disableButtons</td>
426
+ <td><i>swal.disableButtons();</i></td>
427
+ <td>Disable or enable the user to click on the cancel and confirm buttons.</td>
428
+ </tr>
429
+ </table>
430
+
431
+
432
+
433
+ <!-- Contribute -->
434
+ <h3>Contribute</h3>
435
+ <p>SweetAlert was created by <a href="http://tristanedwards.me" target="_blank">Tristan Edwards</a>, you can follow him on <a href="https://twitter.com/t4t5" target="_blank" class="twitter">Twitter</a> or <a href="https://dribbble.com/tristanedwards" target="_blank" class="dribbble">Dribbble</a> for updates and other cool projects!</p>
436
+ <p>Feel free to fork SweetAlert on <a href="https://github.com/t4t5/sweetalert" class="github">GitHub</a> if you have any features that you want to add!</p>
437
+
438
+
439
+ <footer>
440
+ <span class="te-logo">TE</span> • <script>document.write(new Date().getFullYear())</script>
441
+ </footer>
442
+
443
+
444
+ <script>
445
+
446
+ document.querySelector('button.download').onclick = function(){
447
+ $("html, body").animate({ scrollTop: $("#download-section").offset().top }, 1000);
448
+ };
449
+
450
+ document.querySelector('.showcase.normal button').onclick = function(){
451
+ alert("Oops... Something went wrong!");
452
+ };
453
+
454
+ document.querySelector('.showcase.sweet button').onclick = function(){
455
+ swal("Oops...", "Something went wrong!", "error");
456
+ };
457
+
458
+ document.querySelector('ul.examples li.message button').onclick = function(){
459
+ swal("Here's a message!");
460
+ };
461
+
462
+ document.querySelector('ul.examples li.timer button').onclick = function(){
463
+ swal({
464
+ title: "Auto close alert!",
465
+ text: "I will close in 2 seconds.",
466
+ timer: 2000,
467
+ showConfirmButton: false
468
+ });
469
+ };
470
+
471
+ document.querySelector('ul.examples li.title-text button').onclick = function(){
472
+ swal("Here's a message!", "It's pretty, isn't it?");
473
+ };
474
+
475
+ document.querySelector('ul.examples li.success button').onclick = function(){
476
+ swal("Good job!", "You clicked the button!", "success");
477
+ };
478
+
479
+ document.querySelector('ul.examples li.warning.confirm button').onclick = function(){
480
+ swal({
481
+ title: "Are you sure?",
482
+ text: "You will not be able to recover this imaginary file!",
483
+ type: "warning",
484
+ showCancelButton: true,
485
+ confirmButtonColor: '#DD6B55',
486
+ confirmButtonText: 'Yes, delete it!',
487
+ closeOnConfirm: false
488
+ },
489
+ function(){
490
+ swal("Deleted!", "Your imaginary file has been deleted!", "success");
491
+ });
492
+ };
493
+
494
+ document.querySelector('ul.examples li.warning.cancel button').onclick = function(){
495
+ swal({
496
+ title: "Are you sure?",
497
+ text: "You will not be able to recover this imaginary file!",
498
+ type: "warning",
499
+ showCancelButton: true,
500
+ confirmButtonColor: '#DD6B55',
501
+ confirmButtonText: 'Yes, delete it!',
502
+ cancelButtonText: "No, cancel plx!",
503
+ closeOnConfirm: false,
504
+ closeOnCancel: false
505
+ },
506
+ function(isConfirm){
507
+ if (isConfirm){
508
+ swal("Deleted!", "Your imaginary file has been deleted!", "success");
509
+ } else {
510
+ swal("Cancelled", "Your imaginary file is safe :)", "error");
511
+ }
512
+ });
513
+ };
514
+
515
+ document.querySelector('ul.examples li.custom-icon button').onclick = function(){
516
+ swal({
517
+ title: "Sweet!",
518
+ text: "Here's a custom image.",
519
+ imageUrl: 'example/images/thumbs-up.jpg'
520
+ });
521
+ };
522
+
523
+ document.querySelector('ul.examples li.message-html button').onclick = function(){
524
+ swal({
525
+ title: "HTML <small>Title</small>!",
526
+ text: 'A custom <span style="color:#F8BB86">html<span> message.',
527
+ html: true
528
+ });
529
+ };
530
+
531
+ document.querySelector('ul.examples li.input button').onclick = function(){
532
+ swal({
533
+ title: "An input!",
534
+ text: 'Write something interesting:',
535
+ type: 'input',
536
+ showCancelButton: true,
537
+ closeOnConfirm: false,
538
+ animation: "slide-from-top",
539
+ inputPlaceholder: "Write something",
540
+ },
541
+ function(inputValue){
542
+ if (inputValue === false) return false;
543
+
544
+ if (inputValue === "") {
545
+ swal.showInputError("You need to write something!");
546
+ return false;
547
+ }
548
+
549
+ swal("Nice!", 'You wrote: ' + inputValue, "success");
550
+
551
+ });
552
+ };
553
+
554
+ document.querySelector('ul.examples li.theme button').onclick = function() {
555
+ swal({
556
+ title: "Themes!",
557
+ text: "Here's the Twitter theme for SweetAlert!",
558
+ confirmButtonText: "Cool!",
559
+ customClass: 'twitter'
560
+ });
561
+ };
562
+
563
+ document.querySelector('ul.examples li.ajax button').onclick = function() {
564
+ swal({
565
+ title: 'Ajax request example',
566
+ text: 'Submit to run ajax request',
567
+ type: 'info',
568
+ showCancelButton: true,
569
+ closeOnConfirm: false,
570
+ showLoaderOnConfirm: true,
571
+ }, function(){
572
+ setTimeout(function() {
573
+ swal('Ajax request finished!');
574
+ }, 2000);
575
+ });
576
+ };
577
+
578
+ </script>
579
+
580
+
581
+
582
+ </body>
583
+
584
+ </html>