fomantic-ui-sass 2.8.6 → 2.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +6 -0
- data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.svg +6 -41
- 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.svg +7 -245
- 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 +2 -2
- 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/javascripts/semantic-ui/calendar.js +153 -29
- data/app/assets/javascripts/semantic-ui/checkbox.js +1 -1
- data/app/assets/javascripts/semantic-ui/dimmer.js +11 -14
- data/app/assets/javascripts/semantic-ui/dropdown.js +240 -112
- data/app/assets/javascripts/semantic-ui/form.js +131 -67
- data/app/assets/javascripts/semantic-ui/modal.js +259 -16
- data/app/assets/javascripts/semantic-ui/nag.js +130 -64
- data/app/assets/javascripts/semantic-ui/popup.js +4 -4
- data/app/assets/javascripts/semantic-ui/progress.js +25 -31
- data/app/assets/javascripts/semantic-ui/search.js +15 -12
- data/app/assets/javascripts/semantic-ui/slider.js +57 -33
- data/app/assets/javascripts/semantic-ui/toast.js +26 -6
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +69 -74
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +14 -7
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +14 -11
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +52 -5
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +9 -5
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +29 -2
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +3 -4
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +14 -9
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +244 -66
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +34 -5
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +34 -33
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +13 -13
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +41 -37
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +40 -2
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +10 -10
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +13 -1
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +2 -3
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +18 -11
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +46 -4
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +15 -15
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +180 -28
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +22 -11
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +168 -16
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +6 -2
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +18 -10
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +18 -33
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +3 -2
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +11 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -2
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +103 -16
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +75 -3
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +6 -6
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +5 -5
- data/lib/fomantic/ui/sass/version.rb +2 -2
- metadata +3 -3
|
@@ -58,14 +58,14 @@ $.fn.nag = function(parameters) {
|
|
|
58
58
|
|
|
59
59
|
element = this,
|
|
60
60
|
instance = $module.data(moduleNamespace),
|
|
61
|
-
|
|
61
|
+
storage,
|
|
62
62
|
module
|
|
63
63
|
;
|
|
64
64
|
module = {
|
|
65
65
|
|
|
66
66
|
initialize: function() {
|
|
67
67
|
module.verbose('Initializing element');
|
|
68
|
-
|
|
68
|
+
storage = module.get.storage();
|
|
69
69
|
$module
|
|
70
70
|
.on('click' + eventNamespace, selector.close, module.dismiss)
|
|
71
71
|
.data(moduleNamespace, module)
|
|
@@ -94,47 +94,47 @@ $.fn.nag = function(parameters) {
|
|
|
94
94
|
|
|
95
95
|
show: function() {
|
|
96
96
|
if( module.should.show() && !$module.is(':visible') ) {
|
|
97
|
+
if(settings.onShow.call(element) === false) {
|
|
98
|
+
module.debug('onShow callback returned false, cancelling nag animation');
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
97
101
|
module.debug('Showing nag', settings.animation.show);
|
|
98
|
-
if(settings.animation.show
|
|
102
|
+
if(settings.animation.show === 'fade') {
|
|
99
103
|
$module
|
|
100
|
-
.fadeIn(settings.duration, settings.easing)
|
|
104
|
+
.fadeIn(settings.duration, settings.easing, settings.onVisible)
|
|
101
105
|
;
|
|
102
106
|
}
|
|
103
107
|
else {
|
|
104
108
|
$module
|
|
105
|
-
.slideDown(settings.duration, settings.easing)
|
|
109
|
+
.slideDown(settings.duration, settings.easing, settings.onVisible)
|
|
106
110
|
;
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
},
|
|
110
114
|
|
|
111
115
|
hide: function() {
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
if(settings.onHide.call(element) === false) {
|
|
117
|
+
module.debug('onHide callback returned false, cancelling nag animation');
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
module.debug('Hiding nag', settings.animation.hide);
|
|
121
|
+
if(settings.animation.hide === 'fade') {
|
|
114
122
|
$module
|
|
115
|
-
.
|
|
123
|
+
.fadeOut(settings.duration, settings.easing, settings.onHidden)
|
|
116
124
|
;
|
|
117
125
|
}
|
|
118
126
|
else {
|
|
119
127
|
$module
|
|
120
|
-
.slideUp(settings.duration, settings.easing)
|
|
128
|
+
.slideUp(settings.duration, settings.easing, settings.onHidden)
|
|
121
129
|
;
|
|
122
130
|
}
|
|
123
131
|
},
|
|
124
132
|
|
|
125
|
-
onHide: function() {
|
|
126
|
-
module.debug('Removing nag', settings.animation.hide);
|
|
127
|
-
$module.remove();
|
|
128
|
-
if (settings.onHide) {
|
|
129
|
-
settings.onHide();
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
|
|
133
133
|
dismiss: function(event) {
|
|
134
|
-
if(settings.storageMethod) {
|
|
134
|
+
if(module.hide() !== false && settings.storageMethod) {
|
|
135
|
+
module.debug('Dismissing nag', settings.storageMethod, settings.key, settings.value, settings.expires);
|
|
135
136
|
module.storage.set(settings.key, settings.value);
|
|
136
137
|
}
|
|
137
|
-
module.hide();
|
|
138
138
|
event.stopImmediatePropagation();
|
|
139
139
|
event.preventDefault();
|
|
140
140
|
},
|
|
@@ -155,12 +155,71 @@ $.fn.nag = function(parameters) {
|
|
|
155
155
|
},
|
|
156
156
|
|
|
157
157
|
get: {
|
|
158
|
+
expirationDate: function(expires) {
|
|
159
|
+
if (typeof expires === 'number') {
|
|
160
|
+
expires = new Date(Date.now() + expires * 864e5);
|
|
161
|
+
}
|
|
162
|
+
if(expires instanceof Date && expires.getTime() ){
|
|
163
|
+
return expires.toUTCString();
|
|
164
|
+
} else {
|
|
165
|
+
module.error(error.expiresFormat);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
storage: function(){
|
|
169
|
+
if(settings.storageMethod === 'localstorage' && window.localStorage !== undefined) {
|
|
170
|
+
module.debug('Using local storage');
|
|
171
|
+
return window.localStorage;
|
|
172
|
+
}
|
|
173
|
+
else if(settings.storageMethod === 'sessionstorage' && window.sessionStorage !== undefined) {
|
|
174
|
+
module.debug('Using session storage');
|
|
175
|
+
return window.sessionStorage;
|
|
176
|
+
}
|
|
177
|
+
else if("cookie" in document) {
|
|
178
|
+
module.debug('Using cookie');
|
|
179
|
+
return {
|
|
180
|
+
setItem: function(key, value, options) {
|
|
181
|
+
// RFC6265 compliant encoding
|
|
182
|
+
key = encodeURIComponent(key)
|
|
183
|
+
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
|
184
|
+
.replace(/[()]/g, escape);
|
|
185
|
+
value = encodeURIComponent(value)
|
|
186
|
+
.replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
187
|
+
|
|
188
|
+
var cookieOptions = '';
|
|
189
|
+
for (var option in options) {
|
|
190
|
+
if (options.hasOwnProperty(option)) {
|
|
191
|
+
cookieOptions += '; ' + option;
|
|
192
|
+
if (typeof options[option] === 'string') {
|
|
193
|
+
cookieOptions += '=' + options[option].split(';')[0];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
document.cookie = key + '=' + value + cookieOptions;
|
|
198
|
+
},
|
|
199
|
+
getItem: function(key) {
|
|
200
|
+
var cookies = document.cookie.split('; ');
|
|
201
|
+
for (var i = 0, il = cookies.length; i < il; i++) {
|
|
202
|
+
var parts = cookies[i].split('='),
|
|
203
|
+
foundKey = parts[0].replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
204
|
+
if (key === foundKey) {
|
|
205
|
+
return parts[1] || '';
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
removeItem: function(key, options) {
|
|
210
|
+
storage.setItem(key,'',options);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
} else {
|
|
214
|
+
module.error(error.noStorage);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
158
217
|
storageOptions: function() {
|
|
159
218
|
var
|
|
160
219
|
options = {}
|
|
161
220
|
;
|
|
162
221
|
if(settings.expires) {
|
|
163
|
-
options.expires = settings.expires;
|
|
222
|
+
options.expires = module.get.expirationDate(settings.expires);
|
|
164
223
|
}
|
|
165
224
|
if(settings.domain) {
|
|
166
225
|
options.domain = settings.domain;
|
|
@@ -168,6 +227,12 @@ $.fn.nag = function(parameters) {
|
|
|
168
227
|
if(settings.path) {
|
|
169
228
|
options.path = settings.path;
|
|
170
229
|
}
|
|
230
|
+
if(settings.secure) {
|
|
231
|
+
options.secure = settings.secure;
|
|
232
|
+
}
|
|
233
|
+
if(settings.samesite) {
|
|
234
|
+
options.samesite = settings.samesite;
|
|
235
|
+
}
|
|
171
236
|
return options;
|
|
172
237
|
}
|
|
173
238
|
},
|
|
@@ -181,39 +246,30 @@ $.fn.nag = function(parameters) {
|
|
|
181
246
|
var
|
|
182
247
|
options = module.get.storageOptions()
|
|
183
248
|
;
|
|
184
|
-
if(
|
|
185
|
-
|
|
186
|
-
|
|
249
|
+
if(storage === window.localStorage && options.expires) {
|
|
250
|
+
module.debug('Storing expiration value in localStorage', key, options.expires);
|
|
251
|
+
storage.setItem(key + settings.expirationKey, options.expires );
|
|
187
252
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
253
|
+
module.debug('Value stored', key, value);
|
|
254
|
+
try {
|
|
255
|
+
storage.setItem(key, value, options);
|
|
191
256
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
module.debug('Value stored using cookie', key, value, options);
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
module.error(error.noCookieStorage);
|
|
198
|
-
return;
|
|
257
|
+
catch(e) {
|
|
258
|
+
module.error(error.setItem, e);
|
|
199
259
|
}
|
|
200
260
|
},
|
|
201
|
-
get: function(key
|
|
261
|
+
get: function(key) {
|
|
202
262
|
var
|
|
203
263
|
storedValue
|
|
204
264
|
;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
storedValue = $.cookie(key);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
module.error(error.noCookieStorage);
|
|
265
|
+
storedValue = storage.getItem(key);
|
|
266
|
+
if(storage === window.localStorage) {
|
|
267
|
+
var expiration = storage.getItem(key + settings.expirationKey);
|
|
268
|
+
if(expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
|
|
269
|
+
module.debug('Value in localStorage has expired. Deleting key', key);
|
|
270
|
+
module.storage.remove(key);
|
|
271
|
+
storedValue = null;
|
|
272
|
+
}
|
|
217
273
|
}
|
|
218
274
|
if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
|
|
219
275
|
storedValue = undefined;
|
|
@@ -224,19 +280,11 @@ $.fn.nag = function(parameters) {
|
|
|
224
280
|
var
|
|
225
281
|
options = module.get.storageOptions()
|
|
226
282
|
;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
|
|
231
|
-
window.sessionStorage.removeItem(key);
|
|
232
|
-
}
|
|
233
|
-
// store by cookie
|
|
234
|
-
else if($.cookie !== undefined) {
|
|
235
|
-
$.removeCookie(key, options);
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
module.error(error.noStorage);
|
|
283
|
+
options.expires = module.get.expirationDate(-1);
|
|
284
|
+
if(storage === window.localStorage) {
|
|
285
|
+
storage.removeItem(key + settings.expirationKey);
|
|
239
286
|
}
|
|
287
|
+
storage.removeItem(key, options);
|
|
240
288
|
}
|
|
241
289
|
},
|
|
242
290
|
|
|
@@ -450,8 +498,12 @@ $.fn.nag.settings = {
|
|
|
450
498
|
detachable : false,
|
|
451
499
|
|
|
452
500
|
expires : 30,
|
|
501
|
+
|
|
502
|
+
// cookie storage only options
|
|
453
503
|
domain : false,
|
|
454
504
|
path : '/',
|
|
505
|
+
secure : false,
|
|
506
|
+
samesite : false,
|
|
455
507
|
|
|
456
508
|
// type of storage to use
|
|
457
509
|
storageMethod : 'cookie',
|
|
@@ -460,10 +512,14 @@ $.fn.nag.settings = {
|
|
|
460
512
|
key : 'nag',
|
|
461
513
|
value : 'dismiss',
|
|
462
514
|
|
|
515
|
+
// Key suffix to support expiration in localstorage
|
|
516
|
+
expirationKey : 'ExpirationDate',
|
|
517
|
+
|
|
463
518
|
error: {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
519
|
+
noStorage : 'Unsupported storage method',
|
|
520
|
+
method : 'The method you called is not defined.',
|
|
521
|
+
setItem : 'Unexpected error while setting value',
|
|
522
|
+
expiresFormat : '"expires" must be a number of days or a Date Object'
|
|
467
523
|
},
|
|
468
524
|
|
|
469
525
|
className : {
|
|
@@ -472,13 +528,23 @@ $.fn.nag.settings = {
|
|
|
472
528
|
},
|
|
473
529
|
|
|
474
530
|
selector : {
|
|
475
|
-
close : '.close.icon'
|
|
531
|
+
close : '> .close.icon'
|
|
476
532
|
},
|
|
477
533
|
|
|
478
|
-
|
|
534
|
+
duration : 500,
|
|
479
535
|
easing : 'easeOutQuad',
|
|
480
536
|
|
|
481
|
-
|
|
537
|
+
// callback before show animation, return false to prevent show
|
|
538
|
+
onShow : function() {},
|
|
539
|
+
|
|
540
|
+
// called after show animation
|
|
541
|
+
onVisible : function() {},
|
|
542
|
+
|
|
543
|
+
// callback before hide animation, return false to prevent hide
|
|
544
|
+
onHide : function() {},
|
|
545
|
+
|
|
546
|
+
// callback after hide animation
|
|
547
|
+
onHidden : function() {}
|
|
482
548
|
|
|
483
549
|
};
|
|
484
550
|
|
|
@@ -434,11 +434,11 @@ $.fn.popup = function(parameters) {
|
|
|
434
434
|
module.set.visible();
|
|
435
435
|
$popup
|
|
436
436
|
.transition({
|
|
437
|
-
animation : settings.transition + ' in',
|
|
437
|
+
animation : (settings.transition.showMethod || settings.transition) + ' in',
|
|
438
438
|
queue : false,
|
|
439
439
|
debug : settings.debug,
|
|
440
440
|
verbose : settings.verbose,
|
|
441
|
-
duration : settings.duration,
|
|
441
|
+
duration : settings.transition.showDuration || settings.duration,
|
|
442
442
|
onComplete : function() {
|
|
443
443
|
module.bind.close();
|
|
444
444
|
callback.call($popup, element);
|
|
@@ -457,9 +457,9 @@ $.fn.popup = function(parameters) {
|
|
|
457
457
|
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
|
458
458
|
$popup
|
|
459
459
|
.transition({
|
|
460
|
-
animation : settings.transition + ' out',
|
|
460
|
+
animation : (settings.transition.hideMethod || settings.transition) + ' out',
|
|
461
461
|
queue : false,
|
|
462
|
-
duration : settings.duration,
|
|
462
|
+
duration : settings.transition.hideDuration || settings.duration,
|
|
463
463
|
debug : settings.debug,
|
|
464
464
|
verbose : settings.verbose,
|
|
465
465
|
onComplete : function() {
|
|
@@ -169,7 +169,7 @@ $.fn.progress = function(parameters) {
|
|
|
169
169
|
value : module.helper.forceArray($module.data(metadata.value))
|
|
170
170
|
}
|
|
171
171
|
;
|
|
172
|
-
if(data.total) {
|
|
172
|
+
if(data.total !== undefined) {
|
|
173
173
|
module.debug('Total value set from metadata', data.total);
|
|
174
174
|
module.set.total(data.total);
|
|
175
175
|
}
|
|
@@ -272,18 +272,18 @@ $.fn.progress = function(parameters) {
|
|
|
272
272
|
var
|
|
273
273
|
index_ = index || 0,
|
|
274
274
|
value = module.get.value(index_),
|
|
275
|
-
total = module.total
|
|
275
|
+
total = module.get.total(),
|
|
276
276
|
percent = (animating)
|
|
277
277
|
? module.get.displayPercent(index_)
|
|
278
278
|
: module.get.percent(index_),
|
|
279
|
-
left = (
|
|
280
|
-
? (total - value)
|
|
279
|
+
left = (total !== false)
|
|
280
|
+
? Math.max(0,total - value)
|
|
281
281
|
: (100 - percent)
|
|
282
282
|
;
|
|
283
283
|
templateText = templateText || '';
|
|
284
284
|
templateText = templateText
|
|
285
285
|
.replace('{value}', value)
|
|
286
|
-
.replace('{total}', total)
|
|
286
|
+
.replace('{total}', total || 0)
|
|
287
287
|
.replace('{left}', left)
|
|
288
288
|
.replace('{percent}', percent)
|
|
289
289
|
.replace('{bar}', settings.text.bars[index_] || '')
|
|
@@ -373,7 +373,7 @@ $.fn.progress = function(parameters) {
|
|
|
373
373
|
return module.nextValue || module.value && module.value[index || 0] || 0;
|
|
374
374
|
},
|
|
375
375
|
total: function() {
|
|
376
|
-
return module.total
|
|
376
|
+
return module.total !== undefined ? module.total : false;
|
|
377
377
|
}
|
|
378
378
|
},
|
|
379
379
|
|
|
@@ -500,29 +500,33 @@ $.fn.progress = function(parameters) {
|
|
|
500
500
|
},
|
|
501
501
|
percent: function(percents) {
|
|
502
502
|
percents = module.helper.forceArray(percents).map(function(percent) {
|
|
503
|
-
|
|
503
|
+
percent = (typeof percent == 'string')
|
|
504
504
|
? +(percent.replace('%', ''))
|
|
505
505
|
: percent
|
|
506
506
|
;
|
|
507
|
+
return (settings.limitValues)
|
|
508
|
+
? Math.max(0, Math.min(100, percent))
|
|
509
|
+
: percent
|
|
510
|
+
;
|
|
507
511
|
});
|
|
508
512
|
var hasTotal = module.has.total();
|
|
509
|
-
var
|
|
510
|
-
var
|
|
513
|
+
var totalPercent = module.helper.sum(percents);
|
|
514
|
+
var isMultipleValues = percents.length > 1 && hasTotal;
|
|
511
515
|
var sumTotal = module.helper.sum(module.helper.forceArray(module.value));
|
|
512
|
-
if (
|
|
516
|
+
if (isMultipleValues && sumTotal > module.total) {
|
|
513
517
|
// Sum values instead of pecents to avoid precision issues when summing floats
|
|
514
518
|
module.error(error.sumExceedsTotal, sumTotal, module.total);
|
|
515
|
-
} else if (!
|
|
516
|
-
// Sum before
|
|
517
|
-
module.error(error.tooHigh,
|
|
518
|
-
} else if (
|
|
519
|
-
module.error(error.tooLow,
|
|
519
|
+
} else if (!isMultipleValues && totalPercent > 100) {
|
|
520
|
+
// Sum before rounding since sum of rounded may have error though sum of actual is fine
|
|
521
|
+
module.error(error.tooHigh, totalPercent);
|
|
522
|
+
} else if (totalPercent < 0) {
|
|
523
|
+
module.error(error.tooLow, totalPercent);
|
|
520
524
|
} else {
|
|
521
525
|
var autoPrecision = settings.precision > 0
|
|
522
526
|
? settings.precision
|
|
523
|
-
:
|
|
527
|
+
: isMultipleValues
|
|
524
528
|
? module.helper.derivePrecision(Math.min.apply(null, module.value), module.total)
|
|
525
|
-
:
|
|
529
|
+
: 0;
|
|
526
530
|
|
|
527
531
|
// round display percentage
|
|
528
532
|
var roundedPercents = percents.map(function (percent) {
|
|
@@ -532,26 +536,16 @@ $.fn.progress = function(parameters) {
|
|
|
532
536
|
;
|
|
533
537
|
});
|
|
534
538
|
module.percent = roundedPercents;
|
|
535
|
-
if (
|
|
536
|
-
module.value =
|
|
539
|
+
if (hasTotal) {
|
|
540
|
+
module.value = percents.map(function (percent) {
|
|
537
541
|
return (autoPrecision > 0)
|
|
538
542
|
? Math.round((percent / 100) * module.total * (10 * autoPrecision)) / (10 * autoPrecision)
|
|
539
543
|
: Math.round((percent / 100) * module.total * 10) / 10
|
|
540
544
|
;
|
|
541
545
|
});
|
|
542
|
-
if (settings.limitValues) {
|
|
543
|
-
module.value = module.value.map(function (value) {
|
|
544
|
-
return (value > 100)
|
|
545
|
-
? 100
|
|
546
|
-
: (module.value < 0)
|
|
547
|
-
? 0
|
|
548
|
-
: module.value;
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
546
|
}
|
|
552
547
|
module.set.barWidth(percents);
|
|
553
548
|
module.set.labelInterval();
|
|
554
|
-
module.set.labels();
|
|
555
549
|
}
|
|
556
550
|
settings.onChange.call(element, percents, module.value, module.total);
|
|
557
551
|
},
|
|
@@ -622,7 +616,7 @@ $.fn.progress = function(parameters) {
|
|
|
622
616
|
if (text !== undefined) {
|
|
623
617
|
$progress.text( module.get.text(text, index) );
|
|
624
618
|
}
|
|
625
|
-
else if (settings.label == 'ratio' && module.total) {
|
|
619
|
+
else if (settings.label == 'ratio' && module.has.total()) {
|
|
626
620
|
module.verbose('Adding ratio to bar label');
|
|
627
621
|
$progress.text( module.get.text(settings.text.ratio, index) );
|
|
628
622
|
}
|
|
@@ -752,7 +746,7 @@ $.fn.progress = function(parameters) {
|
|
|
752
746
|
}
|
|
753
747
|
value = module.get.normalizedValue(value);
|
|
754
748
|
if (hasTotal) {
|
|
755
|
-
percentComplete = (value / module.total) * 100;
|
|
749
|
+
percentComplete = module.total > 0 ? (value / module.total) * 100 : 100;
|
|
756
750
|
module.debug('Calculating percent complete from total', percentComplete);
|
|
757
751
|
}
|
|
758
752
|
else {
|
|
@@ -118,7 +118,7 @@ $.fn.search = function(parameters) {
|
|
|
118
118
|
.on(module.get.inputEvent() + eventNamespace, selector.prompt, module.event.input)
|
|
119
119
|
;
|
|
120
120
|
$prompt
|
|
121
|
-
.attr('autocomplete', 'off')
|
|
121
|
+
.attr('autocomplete', module.is.chrome() ? 'fomantic-search' : 'off')
|
|
122
122
|
;
|
|
123
123
|
}
|
|
124
124
|
$module
|
|
@@ -227,9 +227,7 @@ $.fn.search = function(parameters) {
|
|
|
227
227
|
results = module.get.results(),
|
|
228
228
|
result = $result.data(metadata.result) || module.get.result(value, results)
|
|
229
229
|
;
|
|
230
|
-
|
|
231
|
-
module.set.value(value);
|
|
232
|
-
}
|
|
230
|
+
var oldValue = module.get.value();
|
|
233
231
|
if( $.isFunction(settings.onSelect) ) {
|
|
234
232
|
if(settings.onSelect.call(element, result, results) === false) {
|
|
235
233
|
module.debug('Custom onSelect callback cancelled default select action');
|
|
@@ -238,7 +236,11 @@ $.fn.search = function(parameters) {
|
|
|
238
236
|
}
|
|
239
237
|
}
|
|
240
238
|
module.hideResults();
|
|
239
|
+
if(value && module.get.value() === oldValue) {
|
|
240
|
+
module.set.value(value);
|
|
241
|
+
}
|
|
241
242
|
if(href) {
|
|
243
|
+
event.preventDefault();
|
|
242
244
|
module.verbose('Opening search link found in result', $link);
|
|
243
245
|
if(target == '_blank' || event.ctrlKey) {
|
|
244
246
|
window.open(href);
|
|
@@ -250,16 +252,16 @@ $.fn.search = function(parameters) {
|
|
|
250
252
|
}
|
|
251
253
|
}
|
|
252
254
|
},
|
|
253
|
-
ensureVisible: function
|
|
255
|
+
ensureVisible: function($el) {
|
|
254
256
|
var elTop, elBottom, resultsScrollTop, resultsHeight;
|
|
255
|
-
|
|
257
|
+
if($el.length === 0) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
256
260
|
elTop = $el.position().top;
|
|
257
261
|
elBottom = elTop + $el.outerHeight(true);
|
|
258
262
|
|
|
259
263
|
resultsScrollTop = $results.scrollTop();
|
|
260
|
-
resultsHeight = $results.height()
|
|
261
|
-
parseInt($results.css('paddingTop'), 0) +
|
|
262
|
-
parseInt($results.css('paddingBottom'), 0);
|
|
264
|
+
resultsHeight = $results.height();
|
|
263
265
|
|
|
264
266
|
if (elTop < 0) {
|
|
265
267
|
$results.scrollTop(resultsScrollTop + elTop);
|
|
@@ -400,6 +402,9 @@ $.fn.search = function(parameters) {
|
|
|
400
402
|
animating: function() {
|
|
401
403
|
return $results.hasClass(className.animating);
|
|
402
404
|
},
|
|
405
|
+
chrome: function() {
|
|
406
|
+
return !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
|
|
407
|
+
},
|
|
403
408
|
hidden: function() {
|
|
404
409
|
return $results.hasClass(className.hidden);
|
|
405
410
|
},
|
|
@@ -975,9 +980,7 @@ $.fn.search = function(parameters) {
|
|
|
975
980
|
duration : settings.duration,
|
|
976
981
|
onShow : function() {
|
|
977
982
|
var $firstResult = $module.find(selector.result).eq(0);
|
|
978
|
-
|
|
979
|
-
module.ensureVisible($firstResult);
|
|
980
|
-
}
|
|
983
|
+
module.ensureVisible($firstResult);
|
|
981
984
|
},
|
|
982
985
|
onComplete : function() {
|
|
983
986
|
callback();
|