fomantic-ui-sass 2.8.8.1 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
  4. data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
  5. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
  6. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
  7. data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
  8. data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
  9. data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
  10. data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
  11. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
  12. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
  13. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
  14. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
  15. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
  16. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
  17. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
  18. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
  19. data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
  20. data/app/assets/fonts/semantic-ui/brand-icons.svg +41 -6
  21. data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
  22. data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
  23. data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
  24. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  25. data/app/assets/fonts/semantic-ui/icons.svg +245 -7
  26. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  27. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  28. data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
  29. data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
  30. data/app/assets/fonts/semantic-ui/outline-icons.svg +2 -2
  31. data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
  32. data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
  33. data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
  34. data/app/assets/javascripts/semantic-ui/accordion.js +569 -590
  35. data/app/assets/javascripts/semantic-ui/api.js +1153 -1116
  36. data/app/assets/javascripts/semantic-ui/calendar.js +1941 -1698
  37. data/app/assets/javascripts/semantic-ui/checkbox.js +862 -854
  38. data/app/assets/javascripts/semantic-ui/dimmer.js +697 -713
  39. data/app/assets/javascripts/semantic-ui/dropdown.js +4196 -4192
  40. data/app/assets/javascripts/semantic-ui/embed.js +646 -672
  41. data/app/assets/javascripts/semantic-ui/flyout.js +1579 -0
  42. data/app/assets/javascripts/semantic-ui/form.js +2024 -2000
  43. data/app/assets/javascripts/semantic-ui/modal.js +1546 -1384
  44. data/app/assets/javascripts/semantic-ui/nag.js +521 -527
  45. data/app/assets/javascripts/semantic-ui/popup.js +1457 -1463
  46. data/app/assets/javascripts/semantic-ui/progress.js +970 -995
  47. data/app/assets/javascripts/semantic-ui/rating.js +508 -520
  48. data/app/assets/javascripts/semantic-ui/search.js +1521 -1508
  49. data/app/assets/javascripts/semantic-ui/shape.js +784 -811
  50. data/app/assets/javascripts/semantic-ui/sidebar.js +1061 -1002
  51. data/app/assets/javascripts/semantic-ui/site.js +437 -477
  52. data/app/assets/javascripts/semantic-ui/slider.js +1311 -1297
  53. data/app/assets/javascripts/semantic-ui/state.js +639 -658
  54. data/app/assets/javascripts/semantic-ui/sticky.js +848 -891
  55. data/app/assets/javascripts/semantic-ui/tab.js +895 -941
  56. data/app/assets/javascripts/semantic-ui/toast.js +911 -851
  57. data/app/assets/javascripts/semantic-ui/transition.js +1049 -1073
  58. data/app/assets/javascripts/semantic-ui/visibility.js +1214 -1246
  59. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +7 -7
  60. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +389 -407
  61. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +203 -345
  62. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +372 -501
  63. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +154 -226
  64. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +2065 -880
  65. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +867 -1232
  66. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +101 -6
  67. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +75 -93
  68. data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +11148 -9190
  69. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1037 -929
  70. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +124 -146
  71. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +2728 -2759
  72. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +41 -65
  73. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +982 -163
  74. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +432 -479
  75. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +80 -101
  76. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +452 -540
  77. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +56 -76
  78. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +17 -22
  79. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +46 -85
  80. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +263 -255
  81. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +106 -179
  82. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +33 -33
  83. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +14 -18
  84. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +132 -48
  85. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +196 -74
  86. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +43 -29
  87. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +210 -280
  88. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +78 -182
  89. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +339 -423
  90. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +24 -35
  91. data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +546 -0
  92. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +150 -153
  93. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +55 -65
  94. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +530 -310
  95. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +108 -213
  96. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +88 -168
  97. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +73 -102
  98. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +16 -32
  99. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +126 -215
  100. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +110 -138
  101. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -7
  102. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +16 -20
  103. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +111 -141
  104. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +371 -1282
  105. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +39 -50
  106. data/app/assets/stylesheets/semantic-ui/views/_card.scss +949 -458
  107. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +44 -62
  108. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +50 -72
  109. data/app/assets/stylesheets/semantic-ui/views/_item.scss +89 -136
  110. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +78 -119
  111. data/lib/fomantic/ui/sass/version.rb +2 -2
  112. data/tasks/converter.rb +1 -1
  113. metadata +21 -3
@@ -1,554 +1,542 @@
1
1
  /*!
2
2
  * # Fomantic-UI - Rating
3
- * http://github.com/fomantic/Fomantic-UI/
3
+ * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
6
6
  * Released under the MIT license
7
- * http://opensource.org/licenses/MIT
7
+ * https://opensource.org/licenses/MIT
8
8
  *
9
9
  */
10
10
 
11
- ;(function ($, window, document, undefined) {
12
-
13
- 'use strict';
14
-
15
- $.isFunction = $.isFunction || function(obj) {
16
- return typeof obj === "function" && typeof obj.nodeType !== "number";
17
- };
18
-
19
- window = (typeof window != 'undefined' && window.Math == Math)
20
- ? window
21
- : (typeof self != 'undefined' && self.Math == Math)
22
- ? self
23
- : Function('return this')()
24
- ;
25
-
26
- $.fn.rating = function(parameters) {
27
- var
28
- $allModules = $(this),
29
- moduleSelector = $allModules.selector || '',
30
-
31
- time = new Date().getTime(),
32
- performance = [],
33
-
34
- query = arguments[0],
35
- methodInvoked = (typeof query == 'string'),
36
- queryArguments = [].slice.call(arguments, 1),
37
- returnedValue
38
- ;
39
- $allModules
40
- .each(function() {
41
- var
42
- settings = ( $.isPlainObject(parameters) )
43
- ? $.extend(true, {}, $.fn.rating.settings, parameters)
44
- : $.extend({}, $.fn.rating.settings),
45
-
46
- namespace = settings.namespace,
47
- className = settings.className,
48
- metadata = settings.metadata,
49
- selector = settings.selector,
50
- cssVars = settings.cssVars,
51
-
52
- eventNamespace = '.' + namespace,
53
- moduleNamespace = 'module-' + namespace,
54
-
55
- element = this,
56
- instance = $(this).data(moduleNamespace),
57
-
58
- $module = $(this),
59
- $icon = $module.find(selector.icon),
60
-
61
- initialLoad,
62
- module
63
- ;
64
-
65
- module = {
66
-
67
- initialize: function() {
68
- module.verbose('Initializing rating module', settings);
69
-
70
- if($icon.length === 0) {
71
- module.setup.layout();
72
- }
73
-
74
- if(settings.interactive && !module.is.disabled()) {
75
- module.enable();
76
- }
77
- else {
78
- module.disable();
79
- }
80
- module.set.initialLoad();
81
- module.set.rating( module.get.initialRating() );
82
- module.remove.initialLoad();
83
- module.instantiate();
84
- },
11
+ (function ($, window, document) {
12
+ 'use strict';
85
13
 
86
- instantiate: function() {
87
- module.verbose('Instantiating module', settings);
88
- instance = module;
89
- $module
90
- .data(moduleNamespace, module)
91
- ;
92
- },
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
93
17
 
94
- destroy: function() {
95
- module.verbose('Destroying previous instance', instance);
96
- module.remove.events();
97
- $module
98
- .removeData(moduleNamespace)
99
- ;
100
- },
18
+ window = window !== undefined && window.Math === Math
19
+ ? window
20
+ : globalThis;
101
21
 
102
- refresh: function() {
103
- $icon = $module.find(selector.icon);
104
- },
22
+ $.fn.rating = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ moduleSelector = $allModules.selector || '',
105
26
 
106
- setup: {
107
- layout: function() {
108
- var
109
- maxRating = module.get.maxRating(),
110
- icon = module.get.icon(),
111
- html = $.fn.rating.settings.templates.icon(maxRating, icon)
112
- ;
113
- module.debug('Generating icon html dynamically');
114
- $module
115
- .html(html)
116
- ;
117
- module.refresh();
118
- }
119
- },
27
+ time = Date.now(),
28
+ performance = [],
120
29
 
121
- event: {
122
- mouseenter: function() {
30
+ query = arguments[0],
31
+ methodInvoked = typeof query === 'string',
32
+ queryArguments = [].slice.call(arguments, 1),
33
+ returnedValue
34
+ ;
35
+ $allModules.each(function () {
123
36
  var
124
- $activeIcon = $(this)
125
- ;
126
- $activeIcon
127
- .nextAll()
128
- .removeClass(className.selected)
129
- ;
130
- $module
131
- .addClass(className.selected)
132
- ;
133
- $activeIcon
134
- .addClass(className.selected)
135
- .prevAll()
136
- .addClass(className.selected)
137
- ;
138
- },
139
- mouseleave: function() {
140
- $module
141
- .removeClass(className.selected)
142
- ;
143
- $icon
144
- .removeClass(className.selected)
145
- ;
146
- },
147
- click: function() {
148
- var
149
- $activeIcon = $(this),
150
- currentRating = module.get.rating(),
151
- rating = $icon.index($activeIcon) + 1,
152
- canClear = (settings.clearable == 'auto')
153
- ? ($icon.length === 1)
154
- : settings.clearable
37
+ settings = $.isPlainObject(parameters)
38
+ ? $.extend(true, {}, $.fn.rating.settings, parameters)
39
+ : $.extend({}, $.fn.rating.settings),
40
+
41
+ namespace = settings.namespace,
42
+ className = settings.className,
43
+ error = settings.error,
44
+ metadata = settings.metadata,
45
+ selector = settings.selector,
46
+ cssVars = settings.cssVars,
47
+
48
+ eventNamespace = '.' + namespace,
49
+ moduleNamespace = 'module-' + namespace,
50
+
51
+ element = this,
52
+ instance = $(this).data(moduleNamespace),
53
+
54
+ $module = $(this),
55
+ $icon = $module.find(selector.icon),
56
+
57
+ initialLoad,
58
+ module
155
59
  ;
156
- if(canClear && currentRating == rating) {
157
- module.clearRating();
158
- }
159
- else {
160
- module.set.rating( rating );
60
+
61
+ module = {
62
+
63
+ initialize: function () {
64
+ module.verbose('Initializing rating module', settings);
65
+
66
+ if ($icon.length === 0) {
67
+ module.setup.layout();
68
+ }
69
+
70
+ if (settings.interactive && !module.is.disabled()) {
71
+ module.enable();
72
+ } else {
73
+ module.disable();
74
+ }
75
+ module.set.initialLoad();
76
+ module.set.rating(module.get.initialRating());
77
+ module.remove.initialLoad();
78
+ module.instantiate();
79
+ },
80
+
81
+ instantiate: function () {
82
+ module.verbose('Instantiating module', settings);
83
+ instance = module;
84
+ $module
85
+ .data(moduleNamespace, module)
86
+ ;
87
+ },
88
+
89
+ destroy: function () {
90
+ module.verbose('Destroying previous instance', instance);
91
+ module.remove.events();
92
+ $module
93
+ .removeData(moduleNamespace)
94
+ ;
95
+ },
96
+
97
+ refresh: function () {
98
+ $icon = $module.find(selector.icon);
99
+ },
100
+
101
+ setup: {
102
+ layout: function () {
103
+ var
104
+ maxRating = module.get.maxRating(),
105
+ icon = module.get.icon(),
106
+ html = $.fn.rating.settings.templates.icon(maxRating, icon)
107
+ ;
108
+ module.debug('Generating icon html dynamically');
109
+ $module
110
+ .html(html)
111
+ ;
112
+ module.refresh();
113
+ },
114
+ },
115
+
116
+ event: {
117
+ mouseenter: function () {
118
+ var
119
+ $activeIcon = $(this)
120
+ ;
121
+ $activeIcon
122
+ .nextAll()
123
+ .removeClass(className.selected)
124
+ ;
125
+ $module
126
+ .addClass(className.selected)
127
+ ;
128
+ $activeIcon
129
+ .addClass(className.selected)
130
+ .prevAll()
131
+ .addClass(className.selected)
132
+ ;
133
+ },
134
+ mouseleave: function () {
135
+ $module
136
+ .removeClass(className.selected)
137
+ ;
138
+ $icon
139
+ .removeClass(className.selected)
140
+ ;
141
+ },
142
+ click: function () {
143
+ var
144
+ $activeIcon = $(this),
145
+ currentRating = module.get.rating(),
146
+ rating = $icon.index($activeIcon) + 1,
147
+ canClear = settings.clearable === 'auto'
148
+ ? $icon.length === 1
149
+ : settings.clearable
150
+ ;
151
+ if (canClear && currentRating === rating) {
152
+ module.clearRating();
153
+ } else {
154
+ module.set.rating(rating);
155
+ }
156
+ },
157
+ },
158
+
159
+ clearRating: function () {
160
+ module.debug('Clearing current rating');
161
+ module.set.rating(0);
162
+ },
163
+
164
+ bind: {
165
+ events: function () {
166
+ module.verbose('Binding events');
167
+ $module
168
+ .on('mouseenter' + eventNamespace, selector.icon, module.event.mouseenter)
169
+ .on('mouseleave' + eventNamespace, selector.icon, module.event.mouseleave)
170
+ .on('click' + eventNamespace, selector.icon, module.event.click)
171
+ ;
172
+ },
173
+ },
174
+
175
+ remove: {
176
+ events: function () {
177
+ module.verbose('Removing events');
178
+ $module
179
+ .off(eventNamespace)
180
+ ;
181
+ },
182
+ initialLoad: function () {
183
+ initialLoad = false;
184
+ },
185
+ },
186
+
187
+ enable: function () {
188
+ module.debug('Setting rating to interactive mode');
189
+ module.bind.events();
190
+ $module
191
+ .removeClass(className.disabled)
192
+ ;
193
+ },
194
+
195
+ disable: function () {
196
+ module.debug('Setting rating to read-only mode');
197
+ module.remove.events();
198
+ $module
199
+ .addClass(className.disabled)
200
+ ;
201
+ },
202
+
203
+ is: {
204
+ initialLoad: function () {
205
+ return initialLoad;
206
+ },
207
+ disabled: function () {
208
+ return $module.hasClass(className.disabled);
209
+ },
210
+ },
211
+
212
+ get: {
213
+ icon: function () {
214
+ var icon = $module.data(metadata.icon);
215
+ if (icon) {
216
+ $module.removeData(metadata.icon);
217
+ }
218
+
219
+ return icon || settings.icon;
220
+ },
221
+ initialRating: function () {
222
+ if ($module.data(metadata.rating) !== undefined) {
223
+ $module.removeData(metadata.rating);
224
+
225
+ return $module.data(metadata.rating);
226
+ }
227
+
228
+ return settings.initialRating;
229
+ },
230
+ maxRating: function () {
231
+ if ($module.data(metadata.maxRating) !== undefined) {
232
+ $module.removeData(metadata.maxRating);
233
+
234
+ return $module.data(metadata.maxRating);
235
+ }
236
+
237
+ return settings.maxRating;
238
+ },
239
+ rating: function () {
240
+ var
241
+ currentRating = $icon.filter('.' + className.active).length
242
+ ;
243
+ module.verbose('Current rating retrieved', currentRating);
244
+
245
+ return currentRating;
246
+ },
247
+ },
248
+
249
+ set: {
250
+ rating: function (rating) {
251
+ var
252
+ ratingIndex = Math.floor(
253
+ rating - 1 >= 0
254
+ ? rating - 1
255
+ : 0
256
+ ),
257
+ $activeIcon = $icon.eq(ratingIndex),
258
+ $partialActiveIcon = rating <= 1
259
+ ? $activeIcon
260
+ : $activeIcon.next(),
261
+ filledPercentage = (rating % 1) * 100
262
+ ;
263
+ $module
264
+ .removeClass(className.selected)
265
+ ;
266
+ $icon
267
+ .removeClass(className.selected)
268
+ .removeClass(className.active)
269
+ .removeClass(className.partiallyActive)
270
+ ;
271
+ if (rating > 0) {
272
+ module.verbose('Setting current rating to', rating);
273
+ $activeIcon
274
+ .prevAll()
275
+ .addBack()
276
+ .addClass(className.active)
277
+ ;
278
+ if ($activeIcon.next() && rating % 1 !== 0) {
279
+ $partialActiveIcon
280
+ .addClass(className.partiallyActive)
281
+ .addClass(className.active)
282
+ ;
283
+ $partialActiveIcon
284
+ .css(cssVars.filledCustomPropName, filledPercentage + '%')
285
+ ;
286
+ if ($partialActiveIcon.css('backgroundColor') === 'transparent') {
287
+ $partialActiveIcon
288
+ .removeClass(className.partiallyActive)
289
+ .removeClass(className.active)
290
+ ;
291
+ }
292
+ }
293
+ }
294
+ if (!module.is.initialLoad()) {
295
+ settings.onRate.call(element, rating);
296
+ }
297
+ },
298
+ initialLoad: function () {
299
+ initialLoad = true;
300
+ },
301
+ },
302
+
303
+ setting: function (name, value) {
304
+ module.debug('Changing setting', name, value);
305
+ if ($.isPlainObject(name)) {
306
+ $.extend(true, settings, name);
307
+ } else if (value !== undefined) {
308
+ if ($.isPlainObject(settings[name])) {
309
+ $.extend(true, settings[name], value);
310
+ } else {
311
+ settings[name] = value;
312
+ }
313
+ } else {
314
+ return settings[name];
315
+ }
316
+ },
317
+ internal: function (name, value) {
318
+ if ($.isPlainObject(name)) {
319
+ $.extend(true, module, name);
320
+ } else if (value !== undefined) {
321
+ module[name] = value;
322
+ } else {
323
+ return module[name];
324
+ }
325
+ },
326
+ debug: function () {
327
+ if (!settings.silent && settings.debug) {
328
+ if (settings.performance) {
329
+ module.performance.log(arguments);
330
+ } else {
331
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
332
+ module.debug.apply(console, arguments);
333
+ }
334
+ }
335
+ },
336
+ verbose: function () {
337
+ if (!settings.silent && settings.verbose && settings.debug) {
338
+ if (settings.performance) {
339
+ module.performance.log(arguments);
340
+ } else {
341
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
342
+ module.verbose.apply(console, arguments);
343
+ }
344
+ }
345
+ },
346
+ error: function () {
347
+ if (!settings.silent) {
348
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
349
+ module.error.apply(console, arguments);
350
+ }
351
+ },
352
+ performance: {
353
+ log: function (message) {
354
+ var
355
+ currentTime,
356
+ executionTime,
357
+ previousTime
358
+ ;
359
+ if (settings.performance) {
360
+ currentTime = Date.now();
361
+ previousTime = time || currentTime;
362
+ executionTime = currentTime - previousTime;
363
+ time = currentTime;
364
+ performance.push({
365
+ Name: message[0],
366
+ Arguments: [].slice.call(message, 1) || '',
367
+ Element: element,
368
+ 'Execution Time': executionTime,
369
+ });
370
+ }
371
+ clearTimeout(module.performance.timer);
372
+ module.performance.timer = setTimeout(module.performance.display, 500);
373
+ },
374
+ display: function () {
375
+ var
376
+ title = settings.name + ':',
377
+ totalTime = 0
378
+ ;
379
+ time = false;
380
+ clearTimeout(module.performance.timer);
381
+ $.each(performance, function (index, data) {
382
+ totalTime += data['Execution Time'];
383
+ });
384
+ title += ' ' + totalTime + 'ms';
385
+ if (moduleSelector) {
386
+ title += ' \'' + moduleSelector + '\'';
387
+ }
388
+ if ($allModules.length > 1) {
389
+ title += ' (' + $allModules.length + ')';
390
+ }
391
+ if (performance.length > 0) {
392
+ console.groupCollapsed(title);
393
+ if (console.table) {
394
+ console.table(performance);
395
+ } else {
396
+ $.each(performance, function (index, data) {
397
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
398
+ });
399
+ }
400
+ console.groupEnd();
401
+ }
402
+ performance = [];
403
+ },
404
+ },
405
+ invoke: function (query, passedArguments, context) {
406
+ var
407
+ object = instance,
408
+ maxDepth,
409
+ found,
410
+ response
411
+ ;
412
+ passedArguments = passedArguments || queryArguments;
413
+ context = context || element;
414
+ if (typeof query === 'string' && object !== undefined) {
415
+ query = query.split(/[ .]/);
416
+ maxDepth = query.length - 1;
417
+ $.each(query, function (depth, value) {
418
+ var camelCaseValue = depth !== maxDepth
419
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
420
+ : query
421
+ ;
422
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
423
+ object = object[camelCaseValue];
424
+ } else if (object[camelCaseValue] !== undefined) {
425
+ found = object[camelCaseValue];
426
+
427
+ return false;
428
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
429
+ object = object[value];
430
+ } else if (object[value] !== undefined) {
431
+ found = object[value];
432
+
433
+ return false;
434
+ } else {
435
+ module.error(error.method, query);
436
+
437
+ return false;
438
+ }
439
+ });
440
+ }
441
+ if (isFunction(found)) {
442
+ response = found.apply(context, passedArguments);
443
+ } else if (found !== undefined) {
444
+ response = found;
445
+ }
446
+ if (Array.isArray(returnedValue)) {
447
+ returnedValue.push(response);
448
+ } else if (returnedValue !== undefined) {
449
+ returnedValue = [returnedValue, response];
450
+ } else if (response !== undefined) {
451
+ returnedValue = response;
452
+ }
453
+
454
+ return found;
455
+ },
456
+ };
457
+ if (methodInvoked) {
458
+ if (instance === undefined) {
459
+ module.initialize();
460
+ }
461
+ module.invoke(query);
462
+ } else {
463
+ if (instance !== undefined) {
464
+ instance.invoke('destroy');
465
+ }
466
+ module.initialize();
161
467
  }
162
- }
163
- },
468
+ });
164
469
 
165
- clearRating: function() {
166
- module.debug('Clearing current rating');
167
- module.set.rating(0);
168
- },
470
+ return returnedValue !== undefined
471
+ ? returnedValue
472
+ : this;
473
+ };
169
474
 
170
- bind: {
171
- events: function() {
172
- module.verbose('Binding events');
173
- $module
174
- .on('mouseenter' + eventNamespace, selector.icon, module.event.mouseenter)
175
- .on('mouseleave' + eventNamespace, selector.icon, module.event.mouseleave)
176
- .on('click' + eventNamespace, selector.icon, module.event.click)
177
- ;
178
- }
179
- },
475
+ $.fn.rating.settings = {
180
476
 
181
- remove: {
182
- events: function() {
183
- module.verbose('Removing events');
184
- $module
185
- .off(eventNamespace)
186
- ;
187
- },
188
- initialLoad: function() {
189
- initialLoad = false;
190
- }
477
+ name: 'Rating',
478
+ namespace: 'rating',
479
+
480
+ icon: 'star',
481
+
482
+ silent: false,
483
+ debug: false,
484
+ verbose: false,
485
+ performance: true,
486
+
487
+ initialRating: 0,
488
+ interactive: true,
489
+ maxRating: 4,
490
+ clearable: 'auto',
491
+
492
+ fireOnInit: false,
493
+
494
+ onRate: function (rating) {},
495
+
496
+ error: {
497
+ method: 'The method you called is not defined',
191
498
  },
192
499
 
193
- enable: function() {
194
- module.debug('Setting rating to interactive mode');
195
- module.bind.events();
196
- $module
197
- .removeClass(className.disabled)
198
- ;
500
+ metadata: {
501
+ rating: 'rating',
502
+ maxRating: 'maxRating',
503
+ icon: 'icon',
199
504
  },
200
505
 
201
- disable: function() {
202
- module.debug('Setting rating to read-only mode');
203
- module.remove.events();
204
- $module
205
- .addClass(className.disabled)
206
- ;
506
+ className: {
507
+ active: 'active',
508
+ disabled: 'disabled',
509
+ selected: 'selected',
510
+ loading: 'loading',
511
+ partiallyActive: 'partial',
207
512
  },
208
513
 
209
- is: {
210
- initialLoad: function() {
211
- return initialLoad;
212
- },
213
- disabled: function() {
214
- return $module.hasClass(className.disabled);
215
- }
514
+ cssVars: {
515
+ filledCustomPropName: '--full',
216
516
  },
217
517
 
218
- get: {
219
- icon: function(){
220
- var icon = $module.data(metadata.icon);
221
- if (icon) {
222
- $module.removeData(metadata.icon);
223
- }
224
- return icon || settings.icon;
225
- },
226
- initialRating: function() {
227
- if($module.data(metadata.rating) !== undefined) {
228
- $module.removeData(metadata.rating);
229
- return $module.data(metadata.rating);
230
- }
231
- return settings.initialRating;
232
- },
233
- maxRating: function() {
234
- if($module.data(metadata.maxRating) !== undefined) {
235
- $module.removeData(metadata.maxRating);
236
- return $module.data(metadata.maxRating);
237
- }
238
- return settings.maxRating;
239
- },
240
- rating: function() {
241
- var
242
- currentRating = $icon.filter('.' + className.active).length
243
- ;
244
- module.verbose('Current rating retrieved', currentRating);
245
- return currentRating;
246
- }
518
+ selector: {
519
+ icon: '.icon',
247
520
  },
248
521
 
249
- set: {
250
- rating: function(rating) {
251
- var
252
- ratingIndex = Math.floor(
253
- (rating - 1 >= 0)
254
- ? (rating - 1)
255
- : 0
256
- ),
257
- $activeIcon = $icon.eq(ratingIndex),
258
- $partialActiveIcon = rating <= 1
259
- ? $activeIcon
260
- : $activeIcon.next()
261
- ,
262
- filledPercentage = (rating % 1) * 100
263
- ;
264
- $module
265
- .removeClass(className.selected)
266
- ;
267
- $icon
268
- .removeClass(className.selected)
269
- .removeClass(className.active)
270
- .removeClass(className.partiallyActive)
271
- ;
272
- if(rating > 0) {
273
- module.verbose('Setting current rating to', rating);
274
- $activeIcon
275
- .prevAll()
276
- .addBack()
277
- .addClass(className.active)
278
- ;
279
- if($activeIcon.next() && rating % 1 !== 0) {
280
- $partialActiveIcon
281
- .addClass(className.partiallyActive)
282
- .addClass(className.active)
283
- ;
284
- $partialActiveIcon
285
- .css(cssVars.filledCustomPropName, filledPercentage + '%')
522
+ templates: {
523
+ deQuote: function (string, encode) {
524
+ return String(string).replace(/"/g, encode ? '&quot;' : '');
525
+ },
526
+ icon: function (maxRating, iconClass) {
527
+ var
528
+ icon = 1,
529
+ html = '',
530
+ deQuote = $.fn.rating.settings.templates.deQuote
286
531
  ;
287
- if($partialActiveIcon.css('backgroundColor') === 'transparent') {
288
- $partialActiveIcon
289
- .removeClass(className.partiallyActive)
290
- .removeClass(className.active)
291
- ;
532
+ while (icon <= maxRating) {
533
+ html += '<i class="' + deQuote(iconClass) + ' icon"></i>';
534
+ icon++;
292
535
  }
293
- }
294
- }
295
- if(!module.is.initialLoad()) {
296
- settings.onRate.call(element, rating);
297
- }
298
- },
299
- initialLoad: function() {
300
- initialLoad = true;
301
- }
302
- },
303
536
 
304
- setting: function(name, value) {
305
- module.debug('Changing setting', name, value);
306
- if( $.isPlainObject(name) ) {
307
- $.extend(true, settings, name);
308
- }
309
- else if(value !== undefined) {
310
- if($.isPlainObject(settings[name])) {
311
- $.extend(true, settings[name], value);
312
- }
313
- else {
314
- settings[name] = value;
315
- }
316
- }
317
- else {
318
- return settings[name];
319
- }
537
+ return html;
538
+ },
320
539
  },
321
- internal: function(name, value) {
322
- if( $.isPlainObject(name) ) {
323
- $.extend(true, module, name);
324
- }
325
- else if(value !== undefined) {
326
- module[name] = value;
327
- }
328
- else {
329
- return module[name];
330
- }
331
- },
332
- debug: function() {
333
- if(!settings.silent && settings.debug) {
334
- if(settings.performance) {
335
- module.performance.log(arguments);
336
- }
337
- else {
338
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
339
- module.debug.apply(console, arguments);
340
- }
341
- }
342
- },
343
- verbose: function() {
344
- if(!settings.silent && settings.verbose && settings.debug) {
345
- if(settings.performance) {
346
- module.performance.log(arguments);
347
- }
348
- else {
349
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
350
- module.verbose.apply(console, arguments);
351
- }
352
- }
353
- },
354
- error: function() {
355
- if(!settings.silent) {
356
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
357
- module.error.apply(console, arguments);
358
- }
359
- },
360
- performance: {
361
- log: function(message) {
362
- var
363
- currentTime,
364
- executionTime,
365
- previousTime
366
- ;
367
- if(settings.performance) {
368
- currentTime = new Date().getTime();
369
- previousTime = time || currentTime;
370
- executionTime = currentTime - previousTime;
371
- time = currentTime;
372
- performance.push({
373
- 'Name' : message[0],
374
- 'Arguments' : [].slice.call(message, 1) || '',
375
- 'Element' : element,
376
- 'Execution Time' : executionTime
377
- });
378
- }
379
- clearTimeout(module.performance.timer);
380
- module.performance.timer = setTimeout(module.performance.display, 500);
381
- },
382
- display: function() {
383
- var
384
- title = settings.name + ':',
385
- totalTime = 0
386
- ;
387
- time = false;
388
- clearTimeout(module.performance.timer);
389
- $.each(performance, function(index, data) {
390
- totalTime += data['Execution Time'];
391
- });
392
- title += ' ' + totalTime + 'ms';
393
- if(moduleSelector) {
394
- title += ' \'' + moduleSelector + '\'';
395
- }
396
- if($allModules.length > 1) {
397
- title += ' ' + '(' + $allModules.length + ')';
398
- }
399
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
400
- console.groupCollapsed(title);
401
- if(console.table) {
402
- console.table(performance);
403
- }
404
- else {
405
- $.each(performance, function(index, data) {
406
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
407
- });
408
- }
409
- console.groupEnd();
410
- }
411
- performance = [];
412
- }
413
- },
414
- invoke: function(query, passedArguments, context) {
415
- var
416
- object = instance,
417
- maxDepth,
418
- found,
419
- response
420
- ;
421
- passedArguments = passedArguments || queryArguments;
422
- context = element || context;
423
- if(typeof query == 'string' && object !== undefined) {
424
- query = query.split(/[\. ]/);
425
- maxDepth = query.length - 1;
426
- $.each(query, function(depth, value) {
427
- var camelCaseValue = (depth != maxDepth)
428
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
429
- : query
430
- ;
431
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
432
- object = object[camelCaseValue];
433
- }
434
- else if( object[camelCaseValue] !== undefined ) {
435
- found = object[camelCaseValue];
436
- return false;
437
- }
438
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
439
- object = object[value];
440
- }
441
- else if( object[value] !== undefined ) {
442
- found = object[value];
443
- return false;
444
- }
445
- else {
446
- return false;
447
- }
448
- });
449
- }
450
- if ( $.isFunction( found ) ) {
451
- response = found.apply(context, passedArguments);
452
- }
453
- else if(found !== undefined) {
454
- response = found;
455
- }
456
- if(Array.isArray(returnedValue)) {
457
- returnedValue.push(response);
458
- }
459
- else if(returnedValue !== undefined) {
460
- returnedValue = [returnedValue, response];
461
- }
462
- else if(response !== undefined) {
463
- returnedValue = response;
464
- }
465
- return found;
466
- }
467
- };
468
- if(methodInvoked) {
469
- if(instance === undefined) {
470
- module.initialize();
471
- }
472
- module.invoke(query);
473
- }
474
- else {
475
- if(instance !== undefined) {
476
- instance.invoke('destroy');
477
- }
478
- module.initialize();
479
- }
480
- })
481
- ;
482
-
483
- return (returnedValue !== undefined)
484
- ? returnedValue
485
- : this
486
- ;
487
- };
488
-
489
- $.fn.rating.settings = {
490
-
491
- name : 'Rating',
492
- namespace : 'rating',
493
-
494
- icon : 'star',
495
-
496
- silent : false,
497
- debug : false,
498
- verbose : false,
499
- performance : true,
500
-
501
- initialRating : 0,
502
- interactive : true,
503
- maxRating : 4,
504
- clearable : 'auto',
505
-
506
- fireOnInit : false,
507
-
508
- onRate : function(rating){},
509
-
510
- error : {
511
- method : 'The method you called is not defined',
512
- noMaximum : 'No maximum rating specified. Cannot generate HTML automatically'
513
- },
514
-
515
-
516
- metadata: {
517
- rating : 'rating',
518
- maxRating : 'maxRating',
519
- icon : 'icon'
520
- },
521
-
522
- className : {
523
- active : 'active',
524
- disabled : 'disabled',
525
- selected : 'selected',
526
- loading : 'loading',
527
- partiallyActive : 'partial'
528
- },
529
-
530
- cssVars : {
531
- filledCustomPropName : '--full'
532
- },
533
-
534
- selector : {
535
- icon : '.icon'
536
- },
537
-
538
- templates: {
539
- icon: function(maxRating, iconClass) {
540
- var
541
- icon = 1,
542
- html = ''
543
- ;
544
- while(icon <= maxRating) {
545
- html += '<i class="'+iconClass+' icon"></i>';
546
- icon++;
547
- }
548
- return html;
549
- }
550
- }
551
-
552
- };
553
540
 
554
- })( jQuery, window, document );
541
+ };
542
+ })(jQuery, window, document);