semantic-ui-sass 1.12.3.0 → 2.0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/assets/javascripts/semantic-ui.js +1 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +67 -53
- data/app/assets/javascripts/semantic-ui/api.js +395 -189
- data/app/assets/javascripts/semantic-ui/checkbox.js +322 -114
- data/app/assets/javascripts/semantic-ui/colorize.js +4 -2
- data/app/assets/javascripts/semantic-ui/dimmer.js +74 -50
- data/app/assets/javascripts/semantic-ui/dropdown.js +2046 -584
- data/app/assets/javascripts/semantic-ui/embed.js +662 -0
- data/app/assets/javascripts/semantic-ui/form.js +345 -163
- data/app/assets/javascripts/semantic-ui/modal.js +119 -90
- data/app/assets/javascripts/semantic-ui/nag.js +8 -9
- data/app/assets/javascripts/semantic-ui/popup.js +390 -228
- data/app/assets/javascripts/semantic-ui/progress.js +112 -103
- data/app/assets/javascripts/semantic-ui/rating.js +79 -55
- data/app/assets/javascripts/semantic-ui/search.js +305 -123
- data/app/assets/javascripts/semantic-ui/shape.js +94 -48
- data/app/assets/javascripts/semantic-ui/sidebar.js +84 -151
- data/app/assets/javascripts/semantic-ui/site.js +5 -5
- data/app/assets/javascripts/semantic-ui/state.js +4 -4
- data/app/assets/javascripts/semantic-ui/sticky.js +108 -35
- data/app/assets/javascripts/semantic-ui/tab.js +220 -125
- data/app/assets/javascripts/semantic-ui/transition.js +205 -171
- data/app/assets/javascripts/semantic-ui/visibility.js +220 -100
- data/app/assets/javascripts/semantic-ui/visit.js +6 -4
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +17 -16
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +223 -121
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +462 -448
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +949 -665
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +134 -92
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +270 -208
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1357 -521
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +125 -0
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +51 -31
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +270 -144
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +241 -110
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +30 -16
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +88 -53
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +432 -281
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +172 -128
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +16 -14
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +15 -7
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +32 -13
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +329 -212
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +291 -99
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +19 -18
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +17 -18
- data/app/assets/stylesheets/semantic-ui/modules/_all.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +265 -161
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +29 -15
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +441 -156
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +168 -0
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +163 -85
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +8 -8
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +88 -23
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +185 -129
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +75 -60
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +99 -52
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +11 -11
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +16 -12
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +4 -4
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +31 -39
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/views/_all.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +204 -162
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +6 -6
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +51 -26
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +62 -36
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +265 -90
- data/lib/semantic/ui/sass/version.rb +2 -2
- data/semantic-ui-sass.gemspec +2 -2
- metadata +9 -6
@@ -1,9 +1,9 @@
|
|
1
1
|
/*!
|
2
|
-
* # Semantic UI
|
2
|
+
* # Semantic UI - Progress
|
3
3
|
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright
|
6
|
+
* Copyright 2015 Contributors
|
7
7
|
* Released under the MIT license
|
8
8
|
* http://opensource.org/licenses/MIT
|
9
9
|
*
|
@@ -63,11 +63,12 @@ $.fn.progress = function(parameters) {
|
|
63
63
|
initialize: function() {
|
64
64
|
module.debug('Initializing progress bar', settings);
|
65
65
|
|
66
|
-
|
66
|
+
module.set.duration();
|
67
|
+
module.set.transitionEvent();
|
67
68
|
|
68
69
|
module.read.metadata();
|
69
|
-
module.
|
70
|
-
|
70
|
+
module.read.settings();
|
71
|
+
|
71
72
|
module.instantiate();
|
72
73
|
},
|
73
74
|
|
@@ -98,92 +99,116 @@ $.fn.progress = function(parameters) {
|
|
98
99
|
|
99
100
|
read: {
|
100
101
|
metadata: function() {
|
101
|
-
|
102
|
-
|
103
|
-
|
102
|
+
var
|
103
|
+
data = {
|
104
|
+
percent : $module.data(metadata.percent),
|
105
|
+
total : $module.data(metadata.total),
|
106
|
+
value : $module.data(metadata.value)
|
107
|
+
}
|
108
|
+
;
|
109
|
+
if(data.percent) {
|
110
|
+
module.debug('Current percent value set from metadata', data.percent);
|
111
|
+
module.set.percent(data.percent);
|
104
112
|
}
|
105
|
-
if(
|
106
|
-
module.
|
107
|
-
module.total
|
113
|
+
if(data.total) {
|
114
|
+
module.debug('Total value set from metadata', data.total);
|
115
|
+
module.set.total(data.total);
|
108
116
|
}
|
109
|
-
if(
|
110
|
-
module.
|
111
|
-
module.value
|
117
|
+
if(data.value) {
|
118
|
+
module.debug('Current value set from metadata', data.value);
|
119
|
+
module.set.value(data.value);
|
120
|
+
module.set.progress(data.value);
|
112
121
|
}
|
113
122
|
},
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
123
|
+
settings: function() {
|
124
|
+
if(settings.total !== false) {
|
125
|
+
module.debug('Current total set in settings', settings.total);
|
126
|
+
module.set.total(settings.total);
|
127
|
+
}
|
128
|
+
if(settings.value !== false) {
|
129
|
+
module.debug('Current value set in settings', settings.value);
|
130
|
+
module.set.value(settings.value);
|
131
|
+
module.set.progress(module.value);
|
132
|
+
}
|
133
|
+
if(settings.percent !== false) {
|
134
|
+
module.debug('Current percent set in settings', settings.percent);
|
135
|
+
module.set.percent(settings.percent);
|
136
|
+
}
|
119
137
|
}
|
120
138
|
},
|
121
139
|
|
122
140
|
increment: function(incrementValue) {
|
123
141
|
var
|
124
|
-
|
125
|
-
edgeValue,
|
142
|
+
maxValue,
|
126
143
|
startValue,
|
127
144
|
newValue
|
128
145
|
;
|
129
|
-
if(total) {
|
130
|
-
startValue = module.value
|
146
|
+
if( module.has.total() ) {
|
147
|
+
startValue = module.get.value();
|
131
148
|
incrementValue = incrementValue || 1;
|
149
|
+
|
132
150
|
newValue = startValue + incrementValue;
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
151
|
+
maxValue = module.get.total();
|
152
|
+
|
153
|
+
module.debug('Incrementing value', startValue, newValue, maxValue);
|
154
|
+
if(newValue > maxValue ) {
|
155
|
+
module.debug('Value cannot increment above total', maxValue);
|
156
|
+
newValue = maxValue;
|
138
157
|
}
|
139
|
-
module.set.progress(newValue);
|
140
158
|
}
|
141
159
|
else {
|
142
|
-
startValue = module.percent
|
160
|
+
startValue = module.get.percent();
|
143
161
|
incrementValue = incrementValue || module.get.randomValue();
|
162
|
+
|
144
163
|
newValue = startValue + incrementValue;
|
145
|
-
|
146
|
-
|
147
|
-
|
164
|
+
maxValue = 100;
|
165
|
+
|
166
|
+
module.debug('Incrementing percentage by', startValue, newValue);
|
167
|
+
if(newValue > maxValue ) {
|
148
168
|
module.debug('Value cannot increment above 100 percent');
|
149
|
-
newValue =
|
169
|
+
newValue = maxValue;
|
150
170
|
}
|
151
|
-
module.set.progress(newValue);
|
152
171
|
}
|
172
|
+
module.set.progress(newValue);
|
153
173
|
},
|
154
174
|
decrement: function(decrementValue) {
|
155
175
|
var
|
156
|
-
total = module.total
|
157
|
-
edgeValue = 0,
|
176
|
+
total = module.get.total(),
|
158
177
|
startValue,
|
159
178
|
newValue
|
160
179
|
;
|
161
180
|
if(total) {
|
162
|
-
startValue = module.value
|
181
|
+
startValue = module.get.value();
|
163
182
|
decrementValue = decrementValue || 1;
|
164
183
|
newValue = startValue - decrementValue;
|
165
184
|
module.debug('Decrementing value by', decrementValue, startValue);
|
166
185
|
}
|
167
186
|
else {
|
168
|
-
startValue = module.percent
|
187
|
+
startValue = module.get.percent();
|
169
188
|
decrementValue = decrementValue || module.get.randomValue();
|
170
189
|
newValue = startValue - decrementValue;
|
171
190
|
module.debug('Decrementing percentage by', decrementValue, startValue);
|
172
191
|
}
|
173
192
|
|
174
|
-
if(newValue <
|
193
|
+
if(newValue < 0) {
|
175
194
|
module.debug('Value cannot decrement below 0');
|
176
195
|
newValue = 0;
|
177
196
|
}
|
178
197
|
module.set.progress(newValue);
|
179
198
|
},
|
180
199
|
|
200
|
+
has: {
|
201
|
+
total: function() {
|
202
|
+
return (module.get.total() !== false);
|
203
|
+
}
|
204
|
+
},
|
205
|
+
|
181
206
|
get: {
|
182
207
|
text: function(templateText) {
|
183
208
|
var
|
184
209
|
value = module.value || 0,
|
185
210
|
total = module.total || 0,
|
186
|
-
percent = (
|
211
|
+
percent = (animating)
|
187
212
|
? module.get.displayPercent()
|
188
213
|
: module.percent || 0,
|
189
214
|
left = (module.total > 0)
|
@@ -200,11 +225,22 @@ $.fn.progress = function(parameters) {
|
|
200
225
|
module.debug('Adding variables to progress bar text', templateText);
|
201
226
|
return templateText;
|
202
227
|
},
|
228
|
+
|
229
|
+
|
203
230
|
randomValue: function() {
|
204
231
|
module.debug('Generating random increment percentage');
|
205
232
|
return Math.floor((Math.random() * settings.random.max) + settings.random.min);
|
206
233
|
},
|
207
234
|
|
235
|
+
numericValue: function(value) {
|
236
|
+
return (typeof value === 'string')
|
237
|
+
? (value.replace(/[^\d.]/g, '') !== '')
|
238
|
+
? +(value.replace(/[^\d.]/g, ''))
|
239
|
+
: false
|
240
|
+
: value
|
241
|
+
;
|
242
|
+
},
|
243
|
+
|
208
244
|
transitionEnd: function() {
|
209
245
|
var
|
210
246
|
element = document.createElement('element'),
|
@@ -233,17 +269,17 @@ $.fn.progress = function(parameters) {
|
|
233
269
|
? (barWidth / totalWidth * 100)
|
234
270
|
: module.percent
|
235
271
|
;
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
272
|
+
return (settings.precision > 0)
|
273
|
+
? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
|
274
|
+
: Math.round(displayPercent)
|
275
|
+
;
|
240
276
|
},
|
241
277
|
|
242
278
|
percent: function() {
|
243
279
|
return module.percent || 0;
|
244
280
|
},
|
245
281
|
value: function() {
|
246
|
-
return module.value ||
|
282
|
+
return module.value || 0;
|
247
283
|
},
|
248
284
|
total: function() {
|
249
285
|
return module.total || false;
|
@@ -319,66 +355,37 @@ $.fn.progress = function(parameters) {
|
|
319
355
|
module.verbose('Setting progress bar transition duration', duration);
|
320
356
|
$bar
|
321
357
|
.css({
|
322
|
-
'-webkit-transition-duration': duration,
|
323
|
-
'-moz-transition-duration': duration,
|
324
|
-
'-ms-transition-duration': duration,
|
325
|
-
'-o-transition-duration': duration,
|
326
358
|
'transition-duration': duration
|
327
359
|
})
|
328
360
|
;
|
329
361
|
},
|
330
|
-
initials: function() {
|
331
|
-
if(settings.total !== false) {
|
332
|
-
module.verbose('Current total set in settings', settings.total);
|
333
|
-
module.total = settings.total;
|
334
|
-
}
|
335
|
-
if(settings.value !== false) {
|
336
|
-
module.verbose('Current value set in settings', settings.value);
|
337
|
-
module.value = settings.value;
|
338
|
-
}
|
339
|
-
if(settings.percent !== false) {
|
340
|
-
module.verbose('Current percent set in settings', settings.percent);
|
341
|
-
module.percent = settings.percent;
|
342
|
-
}
|
343
|
-
if(module.percent !== undefined) {
|
344
|
-
module.set.percent(module.percent);
|
345
|
-
}
|
346
|
-
else if(module.value !== undefined) {
|
347
|
-
module.set.progress(module.value);
|
348
|
-
}
|
349
|
-
},
|
350
362
|
percent: function(percent) {
|
351
363
|
percent = (typeof percent == 'string')
|
352
364
|
? +(percent.replace('%', ''))
|
353
365
|
: percent
|
354
366
|
;
|
355
|
-
|
356
|
-
|
357
|
-
percent
|
358
|
-
|
359
|
-
|
360
|
-
if(settings.precision === 0) {
|
361
|
-
percent = Math.round(percent);
|
362
|
-
}
|
363
|
-
else {
|
364
|
-
percent = Math.round(percent * (10 * settings.precision)) / (10 * settings.precision);
|
365
|
-
}
|
367
|
+
// round display percentage
|
368
|
+
percent = (settings.precision > 0)
|
369
|
+
? Math.round(percent * (10 * settings.precision)) / (10 * settings.precision)
|
370
|
+
: Math.round(percent)
|
371
|
+
;
|
366
372
|
module.percent = percent;
|
367
|
-
if(module.total) {
|
368
|
-
module.value =
|
369
|
-
|
370
|
-
|
371
|
-
module.value = (module.value > 100)
|
372
|
-
? 100
|
373
|
-
: (module.value < 0)
|
374
|
-
? 0
|
375
|
-
: module.value
|
373
|
+
if( !module.has.total() ) {
|
374
|
+
module.value = (settings.precision > 0)
|
375
|
+
? Math.round( (percent / 100) * module.total * (10 * settings.precision)) / (10 * settings.precision)
|
376
|
+
: Math.round( (percent / 100) * module.total * 10) / 10
|
376
377
|
;
|
378
|
+
if(settings.limitValues) {
|
379
|
+
module.value = (module.value > 100)
|
380
|
+
? 100
|
381
|
+
: (module.value < 0)
|
382
|
+
? 0
|
383
|
+
: module.value
|
384
|
+
;
|
385
|
+
}
|
377
386
|
}
|
378
387
|
module.set.barWidth(percent);
|
379
|
-
|
380
|
-
module.set.labelInterval();
|
381
|
-
}
|
388
|
+
module.set.labelInterval();
|
382
389
|
module.set.labels();
|
383
390
|
settings.onChange.call(element, percent, module.value, module.total);
|
384
391
|
},
|
@@ -500,23 +507,25 @@ $.fn.progress = function(parameters) {
|
|
500
507
|
}
|
501
508
|
settings.onError.call(element, module.value, module.total);
|
502
509
|
},
|
510
|
+
transitionEvent: function() {
|
511
|
+
transitionEnd = module.get.transitionEnd();
|
512
|
+
},
|
503
513
|
total: function(totalValue) {
|
504
514
|
module.total = totalValue;
|
505
515
|
},
|
516
|
+
value: function(value) {
|
517
|
+
module.value = value;
|
518
|
+
},
|
506
519
|
progress: function(value) {
|
507
520
|
var
|
508
|
-
numericValue = (
|
509
|
-
? (value.replace(/[^\d.]/g, '') !== '')
|
510
|
-
? +(value.replace(/[^\d.]/g, ''))
|
511
|
-
: false
|
512
|
-
: value,
|
521
|
+
numericValue = module.get.numericValue(value),
|
513
522
|
percentComplete
|
514
523
|
;
|
515
524
|
if(numericValue === false) {
|
516
525
|
module.error(error.nonNumeric, value);
|
517
526
|
}
|
518
|
-
if(module.total) {
|
519
|
-
module.value
|
527
|
+
if( module.has.total() ) {
|
528
|
+
module.set.value(numericValue);
|
520
529
|
percentComplete = (numericValue / module.total) * 100;
|
521
530
|
module.debug('Calculating percent complete from total', percentComplete);
|
522
531
|
module.set.percent( percentComplete );
|
@@ -598,7 +607,7 @@ $.fn.progress = function(parameters) {
|
|
598
607
|
});
|
599
608
|
}
|
600
609
|
clearTimeout(module.performance.timer);
|
601
|
-
module.performance.timer = setTimeout(module.performance.display,
|
610
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
602
611
|
},
|
603
612
|
display: function() {
|
604
613
|
var
|
@@ -712,7 +721,7 @@ $.fn.progress.settings = {
|
|
712
721
|
namespace : 'progress',
|
713
722
|
|
714
723
|
debug : false,
|
715
|
-
verbose :
|
724
|
+
verbose : false,
|
716
725
|
performance : true,
|
717
726
|
|
718
727
|
random : {
|
@@ -727,7 +736,7 @@ $.fn.progress.settings = {
|
|
727
736
|
limitValues : true,
|
728
737
|
|
729
738
|
label : 'percent',
|
730
|
-
precision :
|
739
|
+
precision : 0,
|
731
740
|
framerate : (1000 / 30), /// 30 fps
|
732
741
|
|
733
742
|
percent : false,
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/*!
|
2
|
-
* # Semantic UI
|
2
|
+
* # Semantic UI - Rating
|
3
3
|
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright
|
6
|
+
* Copyright 2015 Contributors
|
7
7
|
* Released under the MIT license
|
8
8
|
* http://opensource.org/licenses/MIT
|
9
9
|
*
|
@@ -66,14 +66,7 @@ $.fn.rating = function(parameters) {
|
|
66
66
|
else {
|
67
67
|
module.disable();
|
68
68
|
}
|
69
|
-
|
70
|
-
module.debug('Setting initial rating');
|
71
|
-
module.setRating(settings.initialRating);
|
72
|
-
}
|
73
|
-
if( $module.data(metadata.rating) ) {
|
74
|
-
module.debug('Rating found in metadata');
|
75
|
-
module.setRating( $module.data(metadata.rating) );
|
76
|
-
}
|
69
|
+
module.set.rating( module.get.initialRating() );
|
77
70
|
module.instantiate();
|
78
71
|
},
|
79
72
|
|
@@ -87,12 +80,10 @@ $.fn.rating = function(parameters) {
|
|
87
80
|
|
88
81
|
destroy: function() {
|
89
82
|
module.verbose('Destroying previous instance', instance);
|
83
|
+
module.remove.events();
|
90
84
|
$module
|
91
85
|
.removeData(moduleNamespace)
|
92
86
|
;
|
93
|
-
$icon
|
94
|
-
.off(eventNamespace)
|
95
|
-
;
|
96
87
|
},
|
97
88
|
|
98
89
|
refresh: function() {
|
@@ -102,11 +93,12 @@ $.fn.rating = function(parameters) {
|
|
102
93
|
setup: {
|
103
94
|
layout: function() {
|
104
95
|
var
|
105
|
-
maxRating =
|
96
|
+
maxRating = module.get.maxRating(),
|
97
|
+
html = $.fn.rating.settings.templates.icon(maxRating)
|
106
98
|
;
|
107
99
|
module.debug('Generating icon html dynamically');
|
108
100
|
$module
|
109
|
-
.html(
|
101
|
+
.html(html)
|
110
102
|
;
|
111
103
|
module.refresh();
|
112
104
|
}
|
@@ -141,7 +133,7 @@ $.fn.rating = function(parameters) {
|
|
141
133
|
click: function() {
|
142
134
|
var
|
143
135
|
$activeIcon = $(this),
|
144
|
-
currentRating = module.
|
136
|
+
currentRating = module.get.rating(),
|
145
137
|
rating = $icon.index($activeIcon) + 1,
|
146
138
|
canClear = (settings.clearable == 'auto')
|
147
139
|
? ($icon.length === 1)
|
@@ -151,31 +143,39 @@ $.fn.rating = function(parameters) {
|
|
151
143
|
module.clearRating();
|
152
144
|
}
|
153
145
|
else {
|
154
|
-
module.
|
146
|
+
module.set.rating( rating );
|
155
147
|
}
|
156
148
|
}
|
157
149
|
},
|
158
150
|
|
159
151
|
clearRating: function() {
|
160
152
|
module.debug('Clearing current rating');
|
161
|
-
module.
|
153
|
+
module.set.rating(0);
|
162
154
|
},
|
163
155
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
156
|
+
bind: {
|
157
|
+
events: function() {
|
158
|
+
module.verbose('Binding events');
|
159
|
+
$module
|
160
|
+
.on('mouseenter' + eventNamespace, selector.icon, module.event.mouseenter)
|
161
|
+
.on('mouseleave' + eventNamespace, selector.icon, module.event.mouseleave)
|
162
|
+
.on('click' + eventNamespace, selector.icon, module.event.click)
|
163
|
+
;
|
164
|
+
}
|
165
|
+
},
|
166
|
+
|
167
|
+
remove: {
|
168
|
+
events: function() {
|
169
|
+
module.verbose('Removing events');
|
170
|
+
$module
|
171
|
+
.off(eventNamespace)
|
172
|
+
;
|
173
|
+
}
|
170
174
|
},
|
171
175
|
|
172
176
|
enable: function() {
|
173
177
|
module.debug('Setting rating to interactive mode');
|
174
|
-
|
175
|
-
.on('mouseenter' + eventNamespace, module.event.mouseenter)
|
176
|
-
.on('mouseleave' + eventNamespace, module.event.mouseleave)
|
177
|
-
.on('click' + eventNamespace, module.event.click)
|
178
|
-
;
|
178
|
+
module.bind.events();
|
179
179
|
$module
|
180
180
|
.removeClass(className.disabled)
|
181
181
|
;
|
@@ -183,37 +183,61 @@ $.fn.rating = function(parameters) {
|
|
183
183
|
|
184
184
|
disable: function() {
|
185
185
|
module.debug('Setting rating to read-only mode');
|
186
|
-
|
187
|
-
.off(eventNamespace)
|
188
|
-
;
|
186
|
+
module.remove.events();
|
189
187
|
$module
|
190
188
|
.addClass(className.disabled)
|
191
189
|
;
|
192
190
|
},
|
193
191
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
.
|
212
|
-
|
213
|
-
|
192
|
+
get: {
|
193
|
+
initialRating: function() {
|
194
|
+
if($module.data(metadata.rating) !== undefined) {
|
195
|
+
$module.removeData(metadata.rating);
|
196
|
+
return $module.data(metadata.rating);
|
197
|
+
}
|
198
|
+
return settings.initialRating;
|
199
|
+
},
|
200
|
+
maxRating: function() {
|
201
|
+
if($module.data(metadata.maxRating) !== undefined) {
|
202
|
+
$module.removeData(metadata.maxRating);
|
203
|
+
return $module.data(metadata.maxRating);
|
204
|
+
}
|
205
|
+
return settings.maxRating;
|
206
|
+
},
|
207
|
+
rating: function() {
|
208
|
+
var
|
209
|
+
currentRating = $icon.filter('.' + className.active).length
|
210
|
+
;
|
211
|
+
module.verbose('Current rating retrieved', currentRating);
|
212
|
+
return currentRating;
|
213
|
+
}
|
214
|
+
},
|
215
|
+
|
216
|
+
set: {
|
217
|
+
rating: function(rating) {
|
218
|
+
var
|
219
|
+
ratingIndex = (rating - 1 >= 0)
|
220
|
+
? (rating - 1)
|
221
|
+
: 0,
|
222
|
+
$activeIcon = $icon.eq(ratingIndex)
|
223
|
+
;
|
224
|
+
$module
|
225
|
+
.removeClass(className.selected)
|
226
|
+
;
|
227
|
+
$icon
|
228
|
+
.removeClass(className.selected)
|
229
|
+
.removeClass(className.active)
|
214
230
|
;
|
231
|
+
if(rating > 0) {
|
232
|
+
module.verbose('Setting current rating to', rating);
|
233
|
+
$activeIcon
|
234
|
+
.prevAll()
|
235
|
+
.andSelf()
|
236
|
+
.addClass(className.active)
|
237
|
+
;
|
238
|
+
}
|
239
|
+
settings.onRate.call(element, rating);
|
215
240
|
}
|
216
|
-
settings.onRate.call(element, rating);
|
217
241
|
},
|
218
242
|
|
219
243
|
setting: function(name, value) {
|
@@ -285,7 +309,7 @@ $.fn.rating = function(parameters) {
|
|
285
309
|
});
|
286
310
|
}
|
287
311
|
clearTimeout(module.performance.timer);
|
288
|
-
module.performance.timer = setTimeout(module.performance.display,
|
312
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
289
313
|
},
|
290
314
|
display: function() {
|
291
315
|
var
|
@@ -400,7 +424,7 @@ $.fn.rating.settings = {
|
|
400
424
|
namespace : 'rating',
|
401
425
|
|
402
426
|
debug : false,
|
403
|
-
verbose :
|
427
|
+
verbose : false,
|
404
428
|
performance : true,
|
405
429
|
|
406
430
|
initialRating : 0,
|