fomantic-ui-sass 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +370 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +177 -0
- data/Rakefile +8 -0
- data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.svg +1008 -0
- data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/icons.otf +0 -0
- data/app/assets/fonts/semantic-ui/icons.svg +1518 -0
- data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.svg +366 -0
- data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/images/semantic-ui/flags.png +0 -0
- data/app/assets/javascripts/semantic-ui.js +27 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +613 -0
- data/app/assets/javascripts/semantic-ui/api.js +1167 -0
- data/app/assets/javascripts/semantic-ui/calendar.js +1476 -0
- data/app/assets/javascripts/semantic-ui/checkbox.js +828 -0
- data/app/assets/javascripts/semantic-ui/colorize.js +280 -0
- data/app/assets/javascripts/semantic-ui/dimmer.js +735 -0
- data/app/assets/javascripts/semantic-ui/dropdown.js +4030 -0
- data/app/assets/javascripts/semantic-ui/embed.js +706 -0
- data/app/assets/javascripts/semantic-ui/form.js +1707 -0
- data/app/assets/javascripts/semantic-ui/modal.js +1090 -0
- data/app/assets/javascripts/semantic-ui/nag.js +507 -0
- data/app/assets/javascripts/semantic-ui/popup.js +1532 -0
- data/app/assets/javascripts/semantic-ui/progress.js +923 -0
- data/app/assets/javascripts/semantic-ui/range.js +278 -0
- data/app/assets/javascripts/semantic-ui/rating.js +511 -0
- data/app/assets/javascripts/semantic-ui/search.js +1515 -0
- data/app/assets/javascripts/semantic-ui/shape.js +921 -0
- data/app/assets/javascripts/semantic-ui/sidebar.js +1033 -0
- data/app/assets/javascripts/semantic-ui/site.js +490 -0
- data/app/assets/javascripts/semantic-ui/state.js +708 -0
- data/app/assets/javascripts/semantic-ui/sticky.js +959 -0
- data/app/assets/javascripts/semantic-ui/tab.js +952 -0
- data/app/assets/javascripts/semantic-ui/toast.js +592 -0
- data/app/assets/javascripts/semantic-ui/transition.js +1106 -0
- data/app/assets/javascripts/semantic-ui/video.js +532 -0
- data/app/assets/javascripts/semantic-ui/visibility.js +1311 -0
- data/app/assets/javascripts/semantic-ui/visit.js +525 -0
- data/app/assets/stylesheets/semantic-ui.scss +5 -0
- data/app/assets/stylesheets/semantic-ui/collections/_all.scss +6 -0
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +124 -0
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +1158 -0
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +2093 -0
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +2193 -0
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +606 -0
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1117 -0
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +16 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +4530 -0
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +145 -0
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +259 -0
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1036 -0
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +762 -0
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +6330 -0
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +310 -0
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +519 -0
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1395 -0
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +959 -0
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +458 -0
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +242 -0
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +152 -0
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +295 -0
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +884 -0
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +675 -0
- data/app/assets/stylesheets/semantic-ui/globals/_all.scss +3 -0
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +485 -0
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +206 -0
- data/app/assets/stylesheets/semantic-ui/globals/_variables.scss +4 -0
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +247 -0
- data/app/assets/stylesheets/semantic-ui/modules/_all.scss +20 -0
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +165 -0
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +718 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +464 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1745 -0
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +165 -0
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +646 -0
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +148 -0
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +789 -0
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +523 -0
- data/app/assets/stylesheets/semantic-ui/modules/_range.scss +192 -0
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +263 -0
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +445 -0
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +154 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +626 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +78 -0
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +92 -0
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +291 -0
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +2059 -0
- data/app/assets/stylesheets/semantic-ui/modules/_video.scss +125 -0
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +275 -0
- data/app/assets/stylesheets/semantic-ui/views/_all.scss +6 -0
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +1124 -0
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +296 -0
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +314 -0
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +555 -0
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +583 -0
- data/app/helpers/semantic_breadcrumbs_helper.rb +10 -0
- data/app/helpers/semantic_flash_helper.rb +22 -0
- data/app/helpers/semantic_icon_helper.rb +8 -0
- data/app/views/semantic/_breadcrumbs.html.erb +12 -0
- data/fomantic-ui-sass.gemspec +31 -0
- data/lib/fomantic-ui-sass.rb +62 -0
- data/lib/fomantic/ui/sass/breadcrumbs.rb +41 -0
- data/lib/fomantic/ui/sass/engine.rb +23 -0
- data/lib/fomantic/ui/sass/version.rb +8 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/semantic_breadcrumbs_helper_spec.rb +38 -0
- data/spec/helpers/semantic_flash_helper_spec.rb +36 -0
- data/spec/helpers/semantic_icon_helper_spec.rb +48 -0
- data/spec/spec_helper.rb +17 -0
- data/tasks/converter.rb +216 -0
- data/templates/project/manifest.rb +29 -0
- data/templates/project/styles.scss +1 -0
- metadata +390 -0
@@ -0,0 +1,592 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI - Toast
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Released under the MIT license
|
7
|
+
* http://opensource.org/licenses/MIT
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
;(function ($, window, document, undefined) {
|
12
|
+
|
13
|
+
'use strict';
|
14
|
+
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
16
|
+
? window
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
18
|
+
? self
|
19
|
+
: Function('return this')()
|
20
|
+
;
|
21
|
+
|
22
|
+
$.fn.toast = function(parameters) {
|
23
|
+
var
|
24
|
+
$allModules = $(this),
|
25
|
+
moduleSelector = $allModules.selector || '',
|
26
|
+
|
27
|
+
time = new Date().getTime(),
|
28
|
+
performance = [],
|
29
|
+
|
30
|
+
query = arguments[0],
|
31
|
+
methodInvoked = (typeof query == 'string'),
|
32
|
+
queryArguments = [].slice.call(arguments, 1),
|
33
|
+
returnedValue
|
34
|
+
;
|
35
|
+
$allModules
|
36
|
+
.each(function() {
|
37
|
+
var
|
38
|
+
settings = ( $.isPlainObject(parameters) )
|
39
|
+
? $.extend(true, {}, $.fn.toast.settings, parameters)
|
40
|
+
: $.extend({}, $.fn.toast.settings),
|
41
|
+
|
42
|
+
className = settings.className,
|
43
|
+
selector = settings.selector,
|
44
|
+
error = settings.error,
|
45
|
+
namespace = settings.namespace,
|
46
|
+
|
47
|
+
eventNamespace = '.' + namespace,
|
48
|
+
moduleNamespace = namespace + '-module',
|
49
|
+
|
50
|
+
$module = $(this),
|
51
|
+
$toastBox = $('<div/>',{'class':settings.className.box}),
|
52
|
+
$toast = $('<div/>'),
|
53
|
+
$progress = $('<div/>',{'class':settings.className.progress+' '+settings.class}),
|
54
|
+
$progressBar = $('<div/>',{'class':'bar'}),
|
55
|
+
|
56
|
+
$close = $('<i/>',{'class':'close icon'}),
|
57
|
+
$context = (settings.context)
|
58
|
+
? $(settings.context)
|
59
|
+
: $('body'),
|
60
|
+
|
61
|
+
element = this,
|
62
|
+
instance = $module.data(moduleNamespace),
|
63
|
+
|
64
|
+
module
|
65
|
+
;
|
66
|
+
module = {
|
67
|
+
|
68
|
+
initialize: function() {
|
69
|
+
module.verbose('Initializing element');
|
70
|
+
if(typeof settings.showProgress !== 'string' || ['top','bottom'].indexOf(settings.showProgress) === -1 ) {
|
71
|
+
settings.showProgress = false;
|
72
|
+
}
|
73
|
+
if (!module.has.container()) {
|
74
|
+
module.create.container();
|
75
|
+
}
|
76
|
+
|
77
|
+
module.create.toast();
|
78
|
+
|
79
|
+
module.bind.events();
|
80
|
+
|
81
|
+
if(settings.displayTime > 0) {
|
82
|
+
module.closeTimer = setTimeout(module.close, settings.displayTime+(!!settings.showProgress ? 300 : 0));
|
83
|
+
}
|
84
|
+
module.show();
|
85
|
+
},
|
86
|
+
|
87
|
+
destroy: function() {
|
88
|
+
module.debug('Removing toast', $toast);
|
89
|
+
$toast.remove();
|
90
|
+
$toast = undefined;
|
91
|
+
settings.onRemove.call($toast, element);
|
92
|
+
},
|
93
|
+
|
94
|
+
show: function(callback) {
|
95
|
+
callback = callback || function(){};
|
96
|
+
module.debug('Showing toast');
|
97
|
+
if(settings.onShow.call($toast, element) === false) {
|
98
|
+
module.debug('onShow callback returned false, cancelling toast animation');
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
module.animate.show(callback);
|
102
|
+
},
|
103
|
+
|
104
|
+
close: function(callback) {
|
105
|
+
if(module.closeTimer) {
|
106
|
+
clearTimeout(module.closeTimer);
|
107
|
+
}
|
108
|
+
callback = callback || function(){};
|
109
|
+
module.remove.visible();
|
110
|
+
module.unbind.events();
|
111
|
+
module.animate.close(callback);
|
112
|
+
|
113
|
+
},
|
114
|
+
|
115
|
+
create: {
|
116
|
+
container: function() {
|
117
|
+
module.verbose('Creating container');
|
118
|
+
$context.append('<div class="ui ' + settings.position + ' ' + className.container + '"></div>');
|
119
|
+
},
|
120
|
+
toast: function() {
|
121
|
+
var $content = $('<div/>').addClass(className.content);
|
122
|
+
module.verbose('Creating toast');
|
123
|
+
if(settings.closeIcon) {
|
124
|
+
$toast.append($close);
|
125
|
+
$toast.css('cursor','default');
|
126
|
+
}
|
127
|
+
|
128
|
+
var iconClass = typeof settings.showIcon === 'string' ? settings.showIcon : settings.showIcon && settings.icons[settings.class] ? settings.icons[settings.class] : '';
|
129
|
+
if (iconClass != '') {
|
130
|
+
var $icon = $('<i/>').addClass(iconClass + ' ' + className.icon);
|
131
|
+
|
132
|
+
$toast
|
133
|
+
.addClass(className.icon)
|
134
|
+
.append($icon)
|
135
|
+
;
|
136
|
+
}
|
137
|
+
|
138
|
+
if (settings.title !== '') {
|
139
|
+
var
|
140
|
+
$title = $('<div/>')
|
141
|
+
.addClass(className.title)
|
142
|
+
.text(settings.title)
|
143
|
+
;
|
144
|
+
|
145
|
+
$content.append($title);
|
146
|
+
}
|
147
|
+
|
148
|
+
$content.append($('<div/>').html(settings.message));
|
149
|
+
|
150
|
+
$toast
|
151
|
+
.addClass(settings.class + ' ' + className.toast)
|
152
|
+
.append($content)
|
153
|
+
;
|
154
|
+
$toast.css('opacity', settings.opacity);
|
155
|
+
if(settings.compact || $toast.hasClass('compact')) {
|
156
|
+
$toastBox.addClass('compact');
|
157
|
+
}
|
158
|
+
if($toast.hasClass('toast') && !$toast.hasClass('inverted')){
|
159
|
+
$progress.addClass('inverted');
|
160
|
+
} else {
|
161
|
+
$progress.removeClass('inverted');
|
162
|
+
}
|
163
|
+
$toast = $toastBox.append($toast);
|
164
|
+
if(!!settings.showProgress && settings.displayTime > 0){
|
165
|
+
$progress
|
166
|
+
.addClass(settings.showProgress)
|
167
|
+
.append($progressBar);
|
168
|
+
if ($progress.hasClass('top')) {
|
169
|
+
$toast.prepend($progress);
|
170
|
+
} else {
|
171
|
+
$toast.append($progress);
|
172
|
+
}
|
173
|
+
$progressBar.css('transition','width '+(settings.displayTime/1000)+'s linear');
|
174
|
+
$progressBar.width(settings.progressUp?'0%':'100%');
|
175
|
+
setTimeout(function() {
|
176
|
+
if(typeof $progress !== 'undefined'){
|
177
|
+
$progressBar.width(settings.progressUp?'100%':'0%');
|
178
|
+
}
|
179
|
+
},300);
|
180
|
+
}
|
181
|
+
if (settings.newestOnTop) {
|
182
|
+
$toast.prependTo(module.get.container());
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
$toast.appendTo(module.get.container());
|
186
|
+
}
|
187
|
+
}
|
188
|
+
},
|
189
|
+
|
190
|
+
bind: {
|
191
|
+
events: function() {
|
192
|
+
module.debug('Binding events to toast');
|
193
|
+
(settings.closeIcon ? $close : $toast)
|
194
|
+
.on('click' + eventNamespace, module.event.click)
|
195
|
+
;
|
196
|
+
}
|
197
|
+
},
|
198
|
+
|
199
|
+
unbind: {
|
200
|
+
events: function() {
|
201
|
+
module.debug('Unbinding events to toast');
|
202
|
+
(settings.closeIcon ? $close : $toast)
|
203
|
+
.off('click' + eventNamespace)
|
204
|
+
;
|
205
|
+
}
|
206
|
+
},
|
207
|
+
|
208
|
+
animate: {
|
209
|
+
show: function(callback) {
|
210
|
+
callback = $.isFunction(callback) ? callback : function(){};
|
211
|
+
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
212
|
+
module.set.visible();
|
213
|
+
$toast
|
214
|
+
.transition({
|
215
|
+
animation : settings.transition.showMethod + ' in',
|
216
|
+
queue : false,
|
217
|
+
debug : settings.debug,
|
218
|
+
verbose : settings.verbose,
|
219
|
+
duration : settings.transition.showDuration,
|
220
|
+
onComplete : function() {
|
221
|
+
callback.call($toast, element);
|
222
|
+
settings.onVisible.call($toast, element);
|
223
|
+
}
|
224
|
+
})
|
225
|
+
;
|
226
|
+
}
|
227
|
+
else {
|
228
|
+
module.error(error.noTransition);
|
229
|
+
}
|
230
|
+
},
|
231
|
+
close: function(callback) {
|
232
|
+
callback = $.isFunction(callback) ? callback : function(){};
|
233
|
+
module.debug('Closing toast');
|
234
|
+
if(settings.onHide.call($toast, element) === false) {
|
235
|
+
module.debug('onHide callback returned false, cancelling toast animation');
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
239
|
+
$toast
|
240
|
+
.transition({
|
241
|
+
animation : settings.transition.hideMethod + ' out',
|
242
|
+
queue : false,
|
243
|
+
duration : settings.transition.hideDuration,
|
244
|
+
debug : settings.debug,
|
245
|
+
verbose : settings.verbose,
|
246
|
+
|
247
|
+
onBeforeHide: function(callback){
|
248
|
+
callback = $.isFunction(callback)?callback : function(){};
|
249
|
+
if(settings.transition.closeEasing !== ''){
|
250
|
+
$toast.css('opacity',0);
|
251
|
+
$toast.wrap('<div/>').parent().slideUp(500,settings.transition.closeEasing,function(){
|
252
|
+
$toast.parent().remove();
|
253
|
+
callback.call($toast);
|
254
|
+
});
|
255
|
+
} else {
|
256
|
+
callback.call($toast);
|
257
|
+
}
|
258
|
+
},
|
259
|
+
onComplete : function() {
|
260
|
+
module.destroy();
|
261
|
+
callback.call($toast, element);
|
262
|
+
settings.onHidden.call($toast, element);
|
263
|
+
}
|
264
|
+
})
|
265
|
+
;
|
266
|
+
}
|
267
|
+
else {
|
268
|
+
module.error(error.noTransition);
|
269
|
+
}
|
270
|
+
}
|
271
|
+
},
|
272
|
+
|
273
|
+
has: {
|
274
|
+
container: function() {
|
275
|
+
module.verbose('Determining if there is already a container');
|
276
|
+
return ($context.find(module.helpers.toClass(settings.position) + selector.container).length > 0);
|
277
|
+
}
|
278
|
+
},
|
279
|
+
|
280
|
+
get: {
|
281
|
+
container: function() {
|
282
|
+
return ($context.find(module.helpers.toClass(settings.position) + selector.container)[0]);
|
283
|
+
}
|
284
|
+
},
|
285
|
+
|
286
|
+
set: {
|
287
|
+
visible: function() {
|
288
|
+
$toast.addClass(className.visible);
|
289
|
+
}
|
290
|
+
},
|
291
|
+
|
292
|
+
remove: {
|
293
|
+
visible: function() {
|
294
|
+
$toast.removeClass(className.visible);
|
295
|
+
}
|
296
|
+
},
|
297
|
+
|
298
|
+
event: {
|
299
|
+
click: function() {
|
300
|
+
settings.onClick.call($toast, element);
|
301
|
+
module.close();
|
302
|
+
}
|
303
|
+
},
|
304
|
+
|
305
|
+
helpers: {
|
306
|
+
toClass: function(selector) {
|
307
|
+
var
|
308
|
+
classes = selector.split(' '),
|
309
|
+
result = ''
|
310
|
+
;
|
311
|
+
|
312
|
+
classes.forEach(function (element) {
|
313
|
+
result += '.' + element;
|
314
|
+
});
|
315
|
+
|
316
|
+
return result;
|
317
|
+
}
|
318
|
+
},
|
319
|
+
|
320
|
+
setting: function(name, value) {
|
321
|
+
module.debug('Changing setting', name, value);
|
322
|
+
if( $.isPlainObject(name) ) {
|
323
|
+
$.extend(true, settings, name);
|
324
|
+
}
|
325
|
+
else if(value !== undefined) {
|
326
|
+
if($.isPlainObject(settings[name])) {
|
327
|
+
$.extend(true, settings[name], value);
|
328
|
+
}
|
329
|
+
else {
|
330
|
+
settings[name] = value;
|
331
|
+
}
|
332
|
+
}
|
333
|
+
else {
|
334
|
+
return settings[name];
|
335
|
+
}
|
336
|
+
},
|
337
|
+
internal: function(name, value) {
|
338
|
+
if( $.isPlainObject(name) ) {
|
339
|
+
$.extend(true, module, name);
|
340
|
+
}
|
341
|
+
else if(value !== undefined) {
|
342
|
+
module[name] = value;
|
343
|
+
}
|
344
|
+
else {
|
345
|
+
return module[name];
|
346
|
+
}
|
347
|
+
},
|
348
|
+
debug: function() {
|
349
|
+
if(!settings.silent && settings.debug) {
|
350
|
+
if(settings.performance) {
|
351
|
+
module.performance.log(arguments);
|
352
|
+
}
|
353
|
+
else {
|
354
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
355
|
+
module.debug.apply(console, arguments);
|
356
|
+
}
|
357
|
+
}
|
358
|
+
},
|
359
|
+
verbose: function() {
|
360
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
361
|
+
if(settings.performance) {
|
362
|
+
module.performance.log(arguments);
|
363
|
+
}
|
364
|
+
else {
|
365
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
366
|
+
module.verbose.apply(console, arguments);
|
367
|
+
}
|
368
|
+
}
|
369
|
+
},
|
370
|
+
error: function() {
|
371
|
+
if(!settings.silent) {
|
372
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
373
|
+
module.error.apply(console, arguments);
|
374
|
+
}
|
375
|
+
},
|
376
|
+
performance: {
|
377
|
+
log: function(message) {
|
378
|
+
var
|
379
|
+
currentTime,
|
380
|
+
executionTime,
|
381
|
+
previousTime
|
382
|
+
;
|
383
|
+
if(settings.performance) {
|
384
|
+
currentTime = new Date().getTime();
|
385
|
+
previousTime = time || currentTime;
|
386
|
+
executionTime = currentTime - previousTime;
|
387
|
+
time = currentTime;
|
388
|
+
performance.push({
|
389
|
+
'Name' : message[0],
|
390
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
391
|
+
'Element' : element,
|
392
|
+
'Execution Time' : executionTime
|
393
|
+
});
|
394
|
+
}
|
395
|
+
clearTimeout(module.performance.timer);
|
396
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
397
|
+
},
|
398
|
+
display: function() {
|
399
|
+
var
|
400
|
+
title = settings.name + ':',
|
401
|
+
totalTime = 0
|
402
|
+
;
|
403
|
+
time = false;
|
404
|
+
clearTimeout(module.performance.timer);
|
405
|
+
$.each(performance, function(index, data) {
|
406
|
+
totalTime += data['Execution Time'];
|
407
|
+
});
|
408
|
+
title += ' ' + totalTime + 'ms';
|
409
|
+
if(moduleSelector) {
|
410
|
+
title += ' \'' + moduleSelector + '\'';
|
411
|
+
}
|
412
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
413
|
+
console.groupCollapsed(title);
|
414
|
+
if(console.table) {
|
415
|
+
console.table(performance);
|
416
|
+
}
|
417
|
+
else {
|
418
|
+
$.each(performance, function(index, data) {
|
419
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
420
|
+
});
|
421
|
+
}
|
422
|
+
console.groupEnd();
|
423
|
+
}
|
424
|
+
performance = [];
|
425
|
+
}
|
426
|
+
},
|
427
|
+
invoke: function(query, passedArguments, context) {
|
428
|
+
var
|
429
|
+
object = instance,
|
430
|
+
maxDepth,
|
431
|
+
found,
|
432
|
+
response
|
433
|
+
;
|
434
|
+
passedArguments = passedArguments || queryArguments;
|
435
|
+
context = element || context;
|
436
|
+
if(typeof query == 'string' && object !== undefined) {
|
437
|
+
query = query.split(/[\. ]/);
|
438
|
+
maxDepth = query.length - 1;
|
439
|
+
$.each(query, function(depth, value) {
|
440
|
+
var camelCaseValue = (depth != maxDepth)
|
441
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
442
|
+
: query
|
443
|
+
;
|
444
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
445
|
+
object = object[camelCaseValue];
|
446
|
+
}
|
447
|
+
else if( object[camelCaseValue] !== undefined ) {
|
448
|
+
found = object[camelCaseValue];
|
449
|
+
return false;
|
450
|
+
}
|
451
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
452
|
+
object = object[value];
|
453
|
+
}
|
454
|
+
else if( object[value] !== undefined ) {
|
455
|
+
found = object[value];
|
456
|
+
return false;
|
457
|
+
}
|
458
|
+
else {
|
459
|
+
module.error(error.method, query);
|
460
|
+
return false;
|
461
|
+
}
|
462
|
+
});
|
463
|
+
}
|
464
|
+
if ( $.isFunction( found ) ) {
|
465
|
+
response = found.apply(context, passedArguments);
|
466
|
+
}
|
467
|
+
else if(found !== undefined) {
|
468
|
+
response = found;
|
469
|
+
}
|
470
|
+
if($.isArray(returnedValue)) {
|
471
|
+
returnedValue.push(response);
|
472
|
+
}
|
473
|
+
else if(returnedValue !== undefined) {
|
474
|
+
returnedValue = [returnedValue, response];
|
475
|
+
}
|
476
|
+
else if(response !== undefined) {
|
477
|
+
returnedValue = response;
|
478
|
+
}
|
479
|
+
return found;
|
480
|
+
}
|
481
|
+
};
|
482
|
+
|
483
|
+
if(methodInvoked) {
|
484
|
+
if(instance === undefined) {
|
485
|
+
module.initialize();
|
486
|
+
}
|
487
|
+
module.invoke(query);
|
488
|
+
}
|
489
|
+
else {
|
490
|
+
if(instance !== undefined) {
|
491
|
+
instance.invoke('destroy');
|
492
|
+
}
|
493
|
+
module.initialize();
|
494
|
+
}
|
495
|
+
})
|
496
|
+
;
|
497
|
+
|
498
|
+
return (returnedValue !== undefined)
|
499
|
+
? returnedValue
|
500
|
+
: this
|
501
|
+
;
|
502
|
+
};
|
503
|
+
|
504
|
+
$.fn.toast.settings = {
|
505
|
+
|
506
|
+
name : 'Toast',
|
507
|
+
namespace : 'toast',
|
508
|
+
|
509
|
+
silent : false,
|
510
|
+
debug : false,
|
511
|
+
verbose : false,
|
512
|
+
performance : true,
|
513
|
+
|
514
|
+
context : 'body',
|
515
|
+
|
516
|
+
position : 'top right',
|
517
|
+
class : 'info',
|
518
|
+
|
519
|
+
title : '',
|
520
|
+
message : '',
|
521
|
+
displayTime : 3000, // set to zero to require manually dismissal, otherwise hides on its own
|
522
|
+
showIcon : true,
|
523
|
+
newestOnTop : false,
|
524
|
+
showProgress : false,
|
525
|
+
progressUp : true, //if false, the bar will start at 100% and decrease to 0%
|
526
|
+
opacity : 1,
|
527
|
+
compact : true,
|
528
|
+
closeIcon : false,
|
529
|
+
|
530
|
+
// transition settings
|
531
|
+
transition : {
|
532
|
+
showMethod : 'scale',
|
533
|
+
showDuration : 500,
|
534
|
+
hideMethod : 'scale',
|
535
|
+
hideDuration : 500,
|
536
|
+
closeEasing : 'easeOutBounce' //Set to empty string to stack the closed toast area immediately (old behaviour)
|
537
|
+
},
|
538
|
+
|
539
|
+
error: {
|
540
|
+
method : 'The method you called is not defined.',
|
541
|
+
noTransition : 'This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>'
|
542
|
+
},
|
543
|
+
|
544
|
+
className : {
|
545
|
+
container : 'toast-container',
|
546
|
+
box : 'toast-box',
|
547
|
+
progress : 'ui attached active progress',
|
548
|
+
toast : 'ui toast',
|
549
|
+
icon : 'icon',
|
550
|
+
visible : 'visible',
|
551
|
+
content : 'content',
|
552
|
+
title : 'title'
|
553
|
+
},
|
554
|
+
|
555
|
+
icons : {
|
556
|
+
info : 'info',
|
557
|
+
success : 'checkmark',
|
558
|
+
warning : 'warning',
|
559
|
+
error : 'times'
|
560
|
+
},
|
561
|
+
|
562
|
+
selector : {
|
563
|
+
container : '.toast-container',
|
564
|
+
box : '.toast-box',
|
565
|
+
toast : '.ui.toast'
|
566
|
+
},
|
567
|
+
|
568
|
+
// callbacks
|
569
|
+
onShow : function(){},
|
570
|
+
onVisible : function(){},
|
571
|
+
onClick : function(){},
|
572
|
+
onHide : function(){},
|
573
|
+
onHidden : function(){},
|
574
|
+
onRemove : function(){},
|
575
|
+
};
|
576
|
+
|
577
|
+
$.extend( $.easing, {
|
578
|
+
easeOutBounce: function (x, t, b, c, d) {
|
579
|
+
if ((t/=d) < (1/2.75)) {
|
580
|
+
return c*(7.5625*t*t) + b;
|
581
|
+
} else if (t < (2/2.75)) {
|
582
|
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
583
|
+
} else if (t < (2.5/2.75)) {
|
584
|
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
585
|
+
} else {
|
586
|
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
587
|
+
}
|
588
|
+
}
|
589
|
+
});
|
590
|
+
|
591
|
+
|
592
|
+
})( jQuery, window, document );
|