semantic-ui-sass 0.19.3.1 → 1.7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +5 -6
  4. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  5. data/app/assets/fonts/semantic-ui/icons.otf +0 -0
  6. data/app/assets/fonts/semantic-ui/icons.svg +472 -367
  7. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  8. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  9. data/app/assets/images/semantic-ui/flags.png +0 -0
  10. data/app/assets/javascripts/semantic-ui.js +9 -5
  11. data/app/assets/javascripts/semantic-ui/accordion.js +169 -102
  12. data/app/assets/javascripts/semantic-ui/api.js +840 -0
  13. data/app/assets/javascripts/semantic-ui/checkbox.js +203 -46
  14. data/app/assets/javascripts/semantic-ui/{behavior/colorize.js → colorize.js} +4 -2
  15. data/app/assets/javascripts/semantic-ui/dimmer.js +110 -76
  16. data/app/assets/javascripts/semantic-ui/dropdown.js +897 -285
  17. data/app/assets/javascripts/semantic-ui/{behavior/form.js → form.js} +127 -42
  18. data/app/assets/javascripts/semantic-ui/modal.js +294 -219
  19. data/app/assets/javascripts/semantic-ui/nag.js +120 -186
  20. data/app/assets/javascripts/semantic-ui/popup.js +491 -223
  21. data/app/assets/javascripts/semantic-ui/progress.js +779 -0
  22. data/app/assets/javascripts/semantic-ui/rating.js +66 -22
  23. data/app/assets/javascripts/semantic-ui/search.js +219 -99
  24. data/app/assets/javascripts/semantic-ui/shape.js +72 -29
  25. data/app/assets/javascripts/semantic-ui/sidebar.js +678 -142
  26. data/app/assets/javascripts/semantic-ui/site.js +487 -0
  27. data/app/assets/javascripts/semantic-ui/{behavior/state.js → state.js} +116 -151
  28. data/app/assets/javascripts/semantic-ui/sticky.js +771 -0
  29. data/app/assets/javascripts/semantic-ui/tab.js +680 -603
  30. data/app/assets/javascripts/semantic-ui/transition.js +269 -158
  31. data/app/assets/javascripts/semantic-ui/video.js +113 -32
  32. data/app/assets/javascripts/semantic-ui/visibility.js +970 -0
  33. data/app/assets/javascripts/semantic-ui/visit.js +513 -0
  34. data/app/assets/stylesheets/semantic-ui.scss +2 -0
  35. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +58 -14
  36. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +464 -372
  37. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +1385 -533
  38. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +482 -655
  39. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +238 -139
  40. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +631 -280
  41. data/app/assets/stylesheets/semantic-ui/elements/_all.scss +3 -2
  42. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1614 -657
  43. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +143 -80
  44. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1018 -0
  45. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +302 -145
  46. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1653 -1365
  47. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +160 -59
  48. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +247 -118
  49. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +501 -470
  50. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +888 -0
  51. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +189 -98
  52. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +125 -0
  53. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +147 -212
  54. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +328 -190
  55. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +261 -185
  56. data/app/assets/stylesheets/semantic-ui/globals/_all.scss +2 -0
  57. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +430 -0
  58. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +128 -0
  59. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +190 -106
  60. data/app/assets/stylesheets/semantic-ui/modules/_all.scss +2 -1
  61. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +303 -201
  62. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +72 -63
  63. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +711 -331
  64. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +262 -140
  65. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +82 -71
  66. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +163 -119
  67. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +435 -0
  68. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +163 -68
  69. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +223 -150
  70. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +39 -40
  71. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +413 -147
  72. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +80 -0
  73. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +49 -20
  74. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +542 -568
  75. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +69 -37
  76. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +265 -0
  77. data/app/assets/stylesheets/semantic-ui/views/_all.scss +1 -1
  78. data/app/assets/stylesheets/semantic-ui/views/_card.scss +758 -0
  79. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +133 -92
  80. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +200 -87
  81. data/app/assets/stylesheets/semantic-ui/views/_item.scss +298 -523
  82. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +390 -12
  83. data/lib/semantic/ui/sass/version.rb +2 -2
  84. data/tasks/converter.rb +99 -216
  85. metadata +22 -27
  86. data/app/assets/fonts/semantic-ui/basic.icons.eot +0 -0
  87. data/app/assets/fonts/semantic-ui/basic.icons.svg +0 -450
  88. data/app/assets/fonts/semantic-ui/basic.icons.ttf +0 -0
  89. data/app/assets/fonts/semantic-ui/basic.icons.woff +0 -0
  90. data/app/assets/images/semantic-ui/loader-large-inverted.gif +0 -0
  91. data/app/assets/images/semantic-ui/loader-large.gif +0 -0
  92. data/app/assets/images/semantic-ui/loader-medium-inverted.gif +0 -0
  93. data/app/assets/images/semantic-ui/loader-medium.gif +0 -0
  94. data/app/assets/images/semantic-ui/loader-mini-inverted.gif +0 -0
  95. data/app/assets/images/semantic-ui/loader-mini.gif +0 -0
  96. data/app/assets/images/semantic-ui/loader-small-inverted.gif +0 -0
  97. data/app/assets/images/semantic-ui/loader-small.gif +0 -0
  98. data/app/assets/javascripts/semantic-ui/behavior/api.js +0 -634
  99. data/app/assets/javascripts/semantic-ui/chatroom.js +0 -772
  100. data/app/assets/stylesheets/semantic-ui/depends/_basic.icon.scss +0 -4
  101. data/app/assets/stylesheets/semantic-ui/depends/_icon.scss +0 -4
  102. data/app/assets/stylesheets/semantic-ui/depends/_loader.scss +0 -8
  103. data/app/assets/stylesheets/semantic-ui/elements/_basic.icon.scss +0 -1124
  104. data/app/assets/stylesheets/semantic-ui/elements/_progress.scss +0 -280
  105. data/app/assets/stylesheets/semantic-ui/modules/_chatroom.scss +0 -299
  106. data/app/assets/stylesheets/semantic-ui/modules/_reveal.scss +0 -322
  107. data/app/assets/stylesheets/semantic-ui/views/_list.scss +0 -700
@@ -0,0 +1,779 @@
1
+ /*
2
+ * # Semantic - Progress
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2014 Contributor
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+
12
+ ;(function ( $, window, document, undefined ) {
13
+
14
+ "use strict";
15
+
16
+ $.fn.progress = function(parameters) {
17
+ var
18
+ $allModules = $(this),
19
+
20
+ moduleSelector = $allModules.selector || '',
21
+
22
+ time = new Date().getTime(),
23
+ performance = [],
24
+
25
+ query = arguments[0],
26
+ methodInvoked = (typeof query == 'string'),
27
+ queryArguments = [].slice.call(arguments, 1),
28
+
29
+ returnedValue
30
+ ;
31
+
32
+ $allModules
33
+ .each(function() {
34
+ var
35
+ settings = ( $.isPlainObject(parameters) )
36
+ ? $.extend(true, {}, $.fn.progress.settings, parameters)
37
+ : $.extend({}, $.fn.progress.settings),
38
+
39
+ className = settings.className,
40
+ metadata = settings.metadata,
41
+ namespace = settings.namespace,
42
+ selector = settings.selector,
43
+ error = settings.error,
44
+
45
+ eventNamespace = '.' + namespace,
46
+ moduleNamespace = 'module-' + namespace,
47
+
48
+ $module = $(this),
49
+ $bar = $(this).find(selector.bar),
50
+ $progress = $(this).find(selector.progress),
51
+ $label = $(this).find(selector.label),
52
+
53
+ element = this,
54
+ instance = $module.data(moduleNamespace),
55
+
56
+ animating = false,
57
+ transitionEnd,
58
+ module
59
+ ;
60
+
61
+ module = {
62
+
63
+ initialize: function() {
64
+ module.debug('Initializing progress bar', settings);
65
+
66
+ transitionEnd = module.get.transitionEnd();
67
+
68
+ module.read.metadata();
69
+ module.set.duration();
70
+ module.set.initials();
71
+ module.instantiate();
72
+ },
73
+
74
+ instantiate: function() {
75
+ module.verbose('Storing instance of progress', module);
76
+ instance = module;
77
+ $module
78
+ .data(moduleNamespace, module)
79
+ ;
80
+ },
81
+ destroy: function() {
82
+ module.verbose('Destroying previous progress for', $module);
83
+ clearInterval(instance.interval);
84
+ module.remove.state();
85
+ $module.removeData(moduleNamespace);
86
+ instance = undefined;
87
+ },
88
+
89
+ reset: function() {
90
+ module.set.percent(0);
91
+ },
92
+
93
+ complete: function() {
94
+ if(module.percent === undefined || module.percent < 100) {
95
+ module.set.percent(100);
96
+ }
97
+ },
98
+
99
+ read: {
100
+ metadata: function() {
101
+ if( $module.data(metadata.percent) ) {
102
+ module.verbose('Current percent value set from metadata');
103
+ module.percent = $module.data(metadata.percent);
104
+ }
105
+ if( $module.data(metadata.total) ) {
106
+ module.verbose('Total value set from metadata');
107
+ module.total = $module.data(metadata.total);
108
+ }
109
+ if( $module.data(metadata.value) ) {
110
+ module.verbose('Current value set from metadata');
111
+ module.value = $module.data(metadata.value);
112
+ }
113
+ },
114
+ currentValue: function() {
115
+ return (module.value !== undefined)
116
+ ? module.value
117
+ : false
118
+ ;
119
+ }
120
+ },
121
+
122
+ increment: function(incrementValue) {
123
+ var
124
+ total = module.total || false,
125
+ edgeValue,
126
+ startValue,
127
+ newValue
128
+ ;
129
+ if(total) {
130
+ startValue = module.value || 0;
131
+ incrementValue = incrementValue || 1;
132
+ newValue = startValue + incrementValue;
133
+ edgeValue = module.total;
134
+ module.debug('Incrementing value by', incrementValue, startValue, edgeValue);
135
+ if(newValue > edgeValue ) {
136
+ module.debug('Value cannot increment above total', edgeValue);
137
+ newValue = edgeValue;
138
+ }
139
+ module.set.progress(newValue);
140
+ }
141
+ else {
142
+ startValue = module.percent || 0;
143
+ incrementValue = incrementValue || module.get.randomValue();
144
+ newValue = startValue + incrementValue;
145
+ edgeValue = 100;
146
+ module.debug('Incrementing percentage by', incrementValue, startValue);
147
+ if(newValue > edgeValue ) {
148
+ module.debug('Value cannot increment above 100 percent');
149
+ newValue = edgeValue;
150
+ }
151
+ module.set.progress(newValue);
152
+ }
153
+ },
154
+ decrement: function(decrementValue) {
155
+ var
156
+ total = module.total || false,
157
+ edgeValue = 0,
158
+ startValue,
159
+ newValue
160
+ ;
161
+ if(total) {
162
+ startValue = module.value || 0;
163
+ decrementValue = decrementValue || 1;
164
+ newValue = startValue - decrementValue;
165
+ module.debug('Decrementing value by', decrementValue, startValue);
166
+ }
167
+ else {
168
+ startValue = module.percent || 0;
169
+ decrementValue = decrementValue || module.get.randomValue();
170
+ newValue = startValue - decrementValue;
171
+ module.debug('Decrementing percentage by', decrementValue, startValue);
172
+ }
173
+
174
+ if(newValue < edgeValue) {
175
+ module.debug('Value cannot decrement below 0');
176
+ newValue = 0;
177
+ }
178
+ module.set.progress(newValue);
179
+ },
180
+
181
+ get: {
182
+ text: function(templateText) {
183
+ var
184
+ value = module.value || 0,
185
+ total = module.total || 0,
186
+ percent = (module.is.visible() && animating)
187
+ ? module.get.displayPercent()
188
+ : module.percent || 0
189
+ ;
190
+ templateText = templateText || '';
191
+ templateText = templateText
192
+ .replace('{value}', value)
193
+ .replace('{total}', total)
194
+ .replace('{percent}', percent)
195
+ ;
196
+ module.debug('Adding variables to progress bar text', templateText);
197
+ return templateText;
198
+ },
199
+ randomValue: function() {
200
+ module.debug('Generating random increment percentage');
201
+ return Math.floor((Math.random() * settings.random.max) + settings.random.min);
202
+ },
203
+
204
+ transitionEnd: function() {
205
+ var
206
+ element = document.createElement('element'),
207
+ transitions = {
208
+ 'transition' :'transitionend',
209
+ 'OTransition' :'oTransitionEnd',
210
+ 'MozTransition' :'transitionend',
211
+ 'WebkitTransition' :'webkitTransitionEnd'
212
+ },
213
+ transition
214
+ ;
215
+ for(transition in transitions){
216
+ if( element.style[transition] !== undefined ){
217
+ return transitions[transition];
218
+ }
219
+ }
220
+ },
221
+
222
+ // gets current displayed percentage (if animating values this is the intermediary value)
223
+ displayPercent: function() {
224
+ var
225
+ barWidth = $bar.width(),
226
+ totalWidth = $module.width(),
227
+ minDisplay = parseInt($bar.css('min-width'), 10),
228
+ displayPercent = (barWidth > minDisplay)
229
+ ? (barWidth / totalWidth * 100)
230
+ : module.percent
231
+ ;
232
+ if(settings.precision === 0) {
233
+ return Math.round(displayPercent);
234
+ }
235
+ return Math.round(displayPercent * (10 * settings.precision) / (10 * settings.precision) );
236
+ },
237
+
238
+ percent: function() {
239
+ return module.percent || 0;
240
+ },
241
+ value: function() {
242
+ return module.value || false;
243
+ },
244
+ total: function() {
245
+ return module.total || false;
246
+ }
247
+ },
248
+
249
+ is: {
250
+ success: function() {
251
+ return $module.hasClass(className.success);
252
+ },
253
+ warning: function() {
254
+ return $module.hasClass(className.warning);
255
+ },
256
+ error: function() {
257
+ return $module.hasClass(className.error);
258
+ },
259
+ active: function() {
260
+ return $module.hasClass(className.active);
261
+ },
262
+ visible: function() {
263
+ return $module.is(':visible');
264
+ }
265
+ },
266
+
267
+ remove: {
268
+ state: function() {
269
+ module.verbose('Removing stored state');
270
+ delete module.total;
271
+ delete module.percent;
272
+ delete module.value;
273
+ },
274
+ active: function() {
275
+ module.verbose('Removing active state');
276
+ $module.removeClass(className.active);
277
+ },
278
+ success: function() {
279
+ module.verbose('Removing success state');
280
+ $module.removeClass(className.success);
281
+ },
282
+ warning: function() {
283
+ module.verbose('Removing warning state');
284
+ $module.removeClass(className.warning);
285
+ },
286
+ error: function() {
287
+ module.verbose('Removing error state');
288
+ $module.removeClass(className.error);
289
+ }
290
+ },
291
+
292
+ set: {
293
+ barWidth: function(value) {
294
+ if(value > 100) {
295
+ module.error(error.tooHigh, value);
296
+ }
297
+ else if (value < 0) {
298
+ module.error(error.tooLow, value);
299
+ }
300
+ else {
301
+ $bar
302
+ .css('width', value + '%')
303
+ ;
304
+ $module
305
+ .attr('data-percent', parseInt(value, 10))
306
+ ;
307
+ }
308
+ },
309
+ duration: function(duration) {
310
+ duration = duration || settings.duration;
311
+ duration = (typeof duration == 'number')
312
+ ? duration + 'ms'
313
+ : duration
314
+ ;
315
+ module.verbose('Setting progress bar transition duration', duration);
316
+ $bar
317
+ .css({
318
+ '-webkit-transition-duration': duration,
319
+ '-moz-transition-duration': duration,
320
+ '-ms-transition-duration': duration,
321
+ '-o-transition-duration': duration,
322
+ 'transition-duration': duration
323
+ })
324
+ ;
325
+ },
326
+ initials: function() {
327
+ if(settings.total !== false) {
328
+ module.verbose('Current total set in settings', settings.total);
329
+ module.total = settings.total;
330
+ }
331
+ if(settings.value !== false) {
332
+ module.verbose('Current value set in settings', settings.value);
333
+ module.value = settings.value;
334
+ }
335
+ if(settings.percent !== false) {
336
+ module.verbose('Current percent set in settings', settings.percent);
337
+ module.percent = settings.percent;
338
+ }
339
+ if(module.percent !== undefined) {
340
+ module.set.percent(module.percent);
341
+ }
342
+ else if(module.value !== undefined) {
343
+ module.set.progress(module.value);
344
+ }
345
+ },
346
+ percent: function(percent) {
347
+ percent = (typeof percent == 'string')
348
+ ? +(percent.replace('%', ''))
349
+ : percent
350
+ ;
351
+ if(percent > 0 && percent < 1) {
352
+ module.verbose('Module percentage passed as decimal, converting');
353
+ percent = percent * 100;
354
+ }
355
+ // round percentage
356
+ if(settings.precision === 0) {
357
+ percent = Math.round(percent);
358
+ }
359
+ else {
360
+ percent = Math.round(percent * (10 * settings.precision) / (10 * settings.precision) );
361
+ }
362
+ module.percent = percent;
363
+ if(module.total) {
364
+ module.value = Math.round( (percent / 100) * module.total);
365
+ }
366
+ if(settings.limitValues) {
367
+ module.value = (module.value > 100)
368
+ ? 100
369
+ : (module.value < 0)
370
+ ? 0
371
+ : module.value
372
+ ;
373
+ }
374
+ module.set.barWidth(percent);
375
+ if( module.is.visible() ) {
376
+ module.set.labelInterval();
377
+ }
378
+ module.set.labels();
379
+ settings.onChange.call(element, percent, module.value, module.total);
380
+ },
381
+ labelInterval: function() {
382
+ clearInterval(module.interval);
383
+ $bar
384
+ .one(transitionEnd + eventNamespace, function() {
385
+ module.verbose('Bar finished animating, removing continuous label updates');
386
+ clearInterval(module.interval);
387
+ animating = false;
388
+ module.set.labels();
389
+ })
390
+ ;
391
+ animating = true;
392
+ module.interval = setInterval(module.set.labels, settings.framerate);
393
+ },
394
+ labels: function() {
395
+ module.verbose('Setting both bar progress and outer label text');
396
+ module.set.barLabel();
397
+ module.set.state();
398
+ },
399
+ label: function(text) {
400
+ text = text || '';
401
+ if(text) {
402
+ text = module.get.text(text);
403
+ module.debug('Setting label to text', text);
404
+ $label.text(text);
405
+ }
406
+ },
407
+ state: function(percent) {
408
+ percent = (percent !== undefined)
409
+ ? percent
410
+ : module.percent
411
+ ;
412
+ if(percent === 100) {
413
+ if(settings.autoSuccess && !(module.is.warning() || module.is.error())) {
414
+ module.set.success();
415
+ module.debug('Automatically triggering success at 100%');
416
+ }
417
+ else {
418
+ module.verbose('Reached 100% removing active state');
419
+ module.remove.active();
420
+ }
421
+ }
422
+ else if(percent > 0) {
423
+ module.verbose('Adjusting active progress bar label', percent);
424
+ module.set.active();
425
+ }
426
+ else {
427
+ module.remove.active();
428
+ module.set.label(settings.text.active);
429
+ }
430
+ },
431
+ barLabel: function(text) {
432
+ if(text !== undefined) {
433
+ $progress.text( module.get.text(text) );
434
+ }
435
+ else if(settings.label == 'ratio' && module.total) {
436
+ module.debug('Adding ratio to bar label');
437
+ $progress.text( module.get.text(settings.text.ratio) );
438
+ }
439
+ else if(settings.label == 'percent') {
440
+ module.debug('Adding percentage to bar label');
441
+ $progress.text( module.get.text(settings.text.percent) );
442
+ }
443
+ },
444
+ active: function(text) {
445
+ text = text || settings.text.active;
446
+ module.debug('Setting active state');
447
+ if(settings.showActivity && !module.is.active() ) {
448
+ $module.addClass(className.active);
449
+ }
450
+ module.remove.warning();
451
+ module.remove.error();
452
+ module.remove.success();
453
+ if(text) {
454
+ module.set.label(text);
455
+ }
456
+ settings.onActive.call(element, module.value, module.total);
457
+ },
458
+ success : function(text) {
459
+ text = text || settings.text.success;
460
+ module.debug('Setting success state');
461
+ $module.addClass(className.success);
462
+ module.remove.active();
463
+ module.remove.warning();
464
+ module.remove.error();
465
+ module.complete();
466
+ if(text) {
467
+ module.set.label(text);
468
+ }
469
+ settings.onSuccess.call(element, module.total);
470
+ },
471
+ warning : function(text) {
472
+ text = text || settings.text.warning;
473
+ module.debug('Setting warning state');
474
+ $module.addClass(className.warning);
475
+ module.remove.active();
476
+ module.remove.success();
477
+ module.remove.error();
478
+ module.complete();
479
+ if(text) {
480
+ module.set.label(text);
481
+ }
482
+ settings.onWarning.call(element, module.value, module.total);
483
+ },
484
+ error : function(text) {
485
+ text = text || settings.text.error;
486
+ module.debug('Setting error state');
487
+ $module.addClass(className.error);
488
+ module.remove.active();
489
+ module.remove.success();
490
+ module.remove.warning();
491
+ module.complete();
492
+ if(text) {
493
+ module.set.label(text);
494
+ }
495
+ settings.onError.call(element, module.value, module.total);
496
+ },
497
+ total: function(totalValue) {
498
+ module.total = totalValue;
499
+ },
500
+ progress: function(value) {
501
+ var
502
+ numericValue = (typeof value === 'string')
503
+ ? (value.replace(/[^\d.]/g, '') !== '')
504
+ ? +(value.replace(/[^\d.]/g, ''))
505
+ : false
506
+ : value,
507
+ percentComplete
508
+ ;
509
+ if(numericValue === false) {
510
+ module.error(error.nonNumeric, value);
511
+ }
512
+ if(module.total) {
513
+ module.value = numericValue;
514
+ percentComplete = (numericValue / module.total) * 100;
515
+ module.debug('Calculating percent complete from total', percentComplete);
516
+ module.set.percent( percentComplete );
517
+ }
518
+ else {
519
+ percentComplete = numericValue;
520
+ module.debug('Setting value to exact percentage value', percentComplete);
521
+ module.set.percent( percentComplete );
522
+ }
523
+ }
524
+ },
525
+
526
+ setting: function(name, value) {
527
+ module.debug('Changing setting', name, value);
528
+ if( $.isPlainObject(name) ) {
529
+ $.extend(true, settings, name);
530
+ }
531
+ else if(value !== undefined) {
532
+ settings[name] = value;
533
+ }
534
+ else {
535
+ return settings[name];
536
+ }
537
+ },
538
+ internal: function(name, value) {
539
+ if( $.isPlainObject(name) ) {
540
+ $.extend(true, module, name);
541
+ }
542
+ else if(value !== undefined) {
543
+ module[name] = value;
544
+ }
545
+ else {
546
+ return module[name];
547
+ }
548
+ },
549
+ debug: function() {
550
+ if(settings.debug) {
551
+ if(settings.performance) {
552
+ module.performance.log(arguments);
553
+ }
554
+ else {
555
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
556
+ module.debug.apply(console, arguments);
557
+ }
558
+ }
559
+ },
560
+ verbose: function() {
561
+ if(settings.verbose && settings.debug) {
562
+ if(settings.performance) {
563
+ module.performance.log(arguments);
564
+ }
565
+ else {
566
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
567
+ module.verbose.apply(console, arguments);
568
+ }
569
+ }
570
+ },
571
+ error: function() {
572
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
573
+ module.error.apply(console, arguments);
574
+ },
575
+ performance: {
576
+ log: function(message) {
577
+ var
578
+ currentTime,
579
+ executionTime,
580
+ previousTime
581
+ ;
582
+ if(settings.performance) {
583
+ currentTime = new Date().getTime();
584
+ previousTime = time || currentTime;
585
+ executionTime = currentTime - previousTime;
586
+ time = currentTime;
587
+ performance.push({
588
+ 'Name' : message[0],
589
+ 'Arguments' : [].slice.call(message, 1) || '',
590
+ 'Element' : element,
591
+ 'Execution Time' : executionTime
592
+ });
593
+ }
594
+ clearTimeout(module.performance.timer);
595
+ module.performance.timer = setTimeout(module.performance.display, 100);
596
+ },
597
+ display: function() {
598
+ var
599
+ title = settings.name + ':',
600
+ totalTime = 0
601
+ ;
602
+ time = false;
603
+ clearTimeout(module.performance.timer);
604
+ $.each(performance, function(index, data) {
605
+ totalTime += data['Execution Time'];
606
+ });
607
+ title += ' ' + totalTime + 'ms';
608
+ if(moduleSelector) {
609
+ title += ' \'' + moduleSelector + '\'';
610
+ }
611
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
612
+ console.groupCollapsed(title);
613
+ if(console.table) {
614
+ console.table(performance);
615
+ }
616
+ else {
617
+ $.each(performance, function(index, data) {
618
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
619
+ });
620
+ }
621
+ console.groupEnd();
622
+ }
623
+ performance = [];
624
+ }
625
+ },
626
+ invoke: function(query, passedArguments, context) {
627
+ var
628
+ object = instance,
629
+ maxDepth,
630
+ found,
631
+ response
632
+ ;
633
+ passedArguments = passedArguments || queryArguments;
634
+ context = element || context;
635
+ if(typeof query == 'string' && object !== undefined) {
636
+ query = query.split(/[\. ]/);
637
+ maxDepth = query.length - 1;
638
+ $.each(query, function(depth, value) {
639
+ var camelCaseValue = (depth != maxDepth)
640
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
641
+ : query
642
+ ;
643
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
644
+ object = object[camelCaseValue];
645
+ }
646
+ else if( object[camelCaseValue] !== undefined ) {
647
+ found = object[camelCaseValue];
648
+ return false;
649
+ }
650
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
651
+ object = object[value];
652
+ }
653
+ else if( object[value] !== undefined ) {
654
+ found = object[value];
655
+ return false;
656
+ }
657
+ else {
658
+ module.error(error.method, query);
659
+ return false;
660
+ }
661
+ });
662
+ }
663
+ if ( $.isFunction( found ) ) {
664
+ response = found.apply(context, passedArguments);
665
+ }
666
+ else if(found !== undefined) {
667
+ response = found;
668
+ }
669
+ if($.isArray(returnedValue)) {
670
+ returnedValue.push(response);
671
+ }
672
+ else if(returnedValue !== undefined) {
673
+ returnedValue = [returnedValue, response];
674
+ }
675
+ else if(response !== undefined) {
676
+ returnedValue = response;
677
+ }
678
+ return found;
679
+ }
680
+ };
681
+
682
+ if(methodInvoked) {
683
+ if(instance === undefined) {
684
+ module.initialize();
685
+ }
686
+ module.invoke(query);
687
+ }
688
+ else {
689
+ if(instance !== undefined) {
690
+ module.destroy();
691
+ }
692
+ module.initialize();
693
+ }
694
+ })
695
+ ;
696
+
697
+ return (returnedValue !== undefined)
698
+ ? returnedValue
699
+ : this
700
+ ;
701
+ };
702
+
703
+ $.fn.progress.settings = {
704
+
705
+ name : 'Progress',
706
+ namespace : 'progress',
707
+
708
+ debug : false,
709
+ verbose : true,
710
+ performance : true,
711
+
712
+ random : {
713
+ min : 2,
714
+ max : 5
715
+ },
716
+
717
+ duration : 300,
718
+
719
+ autoSuccess : true,
720
+ showActivity : true,
721
+ limitValues : true,
722
+
723
+ label : 'percent',
724
+ precision : 1,
725
+ framerate : (1000 / 30), /// 30 fps
726
+
727
+ percent : false,
728
+ total : false,
729
+ value : false,
730
+
731
+ onChange : function(percent, value, total){},
732
+ onSuccess : function(total){},
733
+ onActive : function(value, total){},
734
+ onError : function(value, total){},
735
+ onWarning : function(value, total){},
736
+
737
+ error : {
738
+ method : 'The method you called is not defined.',
739
+ nonNumeric : 'Progress value is non numeric',
740
+ tooHigh : 'Value specified is above 100%',
741
+ tooLow : 'Value specified is below 0%'
742
+ },
743
+
744
+ regExp: {
745
+ variable: /\{\$*[A-z0-9]+\}/g
746
+ },
747
+
748
+ metadata: {
749
+ percent : 'percent',
750
+ total : 'total',
751
+ value : 'value'
752
+ },
753
+
754
+ selector : {
755
+ bar : '> .bar',
756
+ label : '> .label',
757
+ progress : '.bar > .progress'
758
+ },
759
+
760
+ text : {
761
+ active : false,
762
+ error : false,
763
+ success : false,
764
+ warning : false,
765
+ percent : '{percent}%',
766
+ ratio : '{value} of {total}'
767
+ },
768
+
769
+ className : {
770
+ active : 'active',
771
+ error : 'error',
772
+ success : 'success',
773
+ warning : 'warning'
774
+ }
775
+
776
+ };
777
+
778
+
779
+ })( jQuery, window , document );