liqueur 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile.lock +2 -2
  3. data/app/assets/javascripts/liqueur.coffee +3 -0
  4. data/app/assets/javascripts/liqueur/datamask-applier.coffee +8 -0
  5. data/app/assets/javascripts/liqueur/footer-float-height.coffee +6 -0
  6. data/app/assets/javascripts/liqueur/lib/jquery.maskedinput.js +338 -0
  7. data/app/assets/javascripts/liqueur/lib/nprogress.js +279 -0
  8. data/app/assets/javascripts/liqueur/onload.coffee +6 -0
  9. data/app/assets/javascripts/liqueur/spinner.coffee +10 -0
  10. data/app/assets/stylesheets/_liqueur.scss +6 -1
  11. data/app/assets/stylesheets/liqueur/_form.scss +5 -0
  12. data/app/assets/stylesheets/liqueur/_grid.scss +37 -0
  13. data/app/assets/stylesheets/liqueur/_helpers.scss +9 -0
  14. data/app/assets/stylesheets/liqueur/_medias.scss +2 -0
  15. data/app/assets/stylesheets/liqueur/_snippets.scss +5 -0
  16. data/app/assets/stylesheets/liqueur/_spinner.scss +79 -0
  17. data/app/assets/stylesheets/liqueur/_tiles.scss +104 -0
  18. data/app/assets/stylesheets/liqueur/form/_input.scss +0 -0
  19. data/app/assets/stylesheets/liqueur/helpers/_block.scss +8 -0
  20. data/app/assets/stylesheets/liqueur/helpers/_border.scss +24 -0
  21. data/app/assets/stylesheets/liqueur/helpers/_description.scss +5 -0
  22. data/app/assets/stylesheets/liqueur/helpers/_float.scss +29 -0
  23. data/app/assets/stylesheets/liqueur/helpers/_li.scss +12 -0
  24. data/app/assets/stylesheets/liqueur/helpers/_padding.scss +6 -0
  25. data/app/assets/stylesheets/liqueur/helpers/_size.scss +29 -0
  26. data/app/assets/stylesheets/liqueur/helpers/_text_align.scss +15 -0
  27. data/app/assets/stylesheets/liqueur/helpers/_text_size.scss +15 -0
  28. data/app/assets/stylesheets/liqueur/medias/_display.scss +7 -0
  29. data/app/assets/stylesheets/liqueur/medias/_print.scss +17 -0
  30. data/app/assets/stylesheets/liqueur/reset/{_body_margin.css.scss → _body_margin.scss} +0 -0
  31. data/app/assets/stylesheets/liqueur/reset/{_disabling_user_zoom.css.scss → _disabling_user_zoom.scss} +0 -0
  32. data/app/assets/stylesheets/liqueur/reset/{_font_family.css.scss → _font_family.scss} +0 -0
  33. data/app/assets/stylesheets/liqueur/reset/{_fontsize_body_ie.css.scss → _fontsize_body_ie.scss} +0 -0
  34. data/app/assets/stylesheets/liqueur/reset/{_form.css.scss → _form.scss} +0 -0
  35. data/app/assets/stylesheets/liqueur/reset/{_html5.css.scss → _html5.scss} +2 -0
  36. data/app/assets/stylesheets/liqueur/reset/{_images.css.scss → _images.scss} +1 -0
  37. data/app/assets/stylesheets/liqueur/reset/{_links.css.scss → _links.scss} +5 -1
  38. data/app/assets/stylesheets/liqueur/reset/{_lists.css.scss → _lists.scss} +8 -0
  39. data/app/assets/stylesheets/liqueur/reset/{_print.css.scss → _print.scss} +0 -0
  40. data/app/assets/stylesheets/liqueur/reset/{_selection.css.scss → _selection.scss} +0 -0
  41. data/app/assets/stylesheets/liqueur/reset/{_table.css.scss → _table.scss} +0 -0
  42. data/app/assets/stylesheets/liqueur/reset/{_tap_color.css.scss → _tap_color.scss} +0 -0
  43. data/app/assets/stylesheets/liqueur/reset/{_typografy.css.scss → _typografy.scss} +0 -0
  44. data/app/assets/stylesheets/liqueur/snippets/_container.scss +28 -0
  45. data/app/assets/stylesheets/liqueur/snippets/_footer.scss +25 -0
  46. data/app/assets/stylesheets/liqueur/snippets/_link_overflow.scss +11 -0
  47. data/app/assets/stylesheets/liqueur/snippets/_menu.scss +30 -0
  48. data/app/assets/stylesheets/liqueur/snippets/_toggler.scss +3 -0
  49. data/lib/liqueur/version.rb +1 -1
  50. data/liqueur.gemspec +2 -2
  51. metadata +94 -85
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c442c9276f17d8b2e17f0bad7883ce4ca4248b0f
4
+ data.tar.gz: ecf0d7e0754622d01d36c9362d449483b83106cf
5
+ SHA512:
6
+ metadata.gz: d4d5bdf62a9abe601671462dfdff2b56d6e6f9fd1173f4e2a32f929f074e676e992b5498c7f851d48d8358c467a7fa85ebb9e41442643e779e59cc9ed418b50e
7
+ data.tar.gz: 20abfddea42149c1304952e5460f45f1ede3558f3eda0e54d750fecb36553e4bfbf927e6223179d7edf5ad8a3668c229dd1078a7c7ff644a865bdf1be085377c
@@ -3,12 +3,12 @@ PATH
3
3
  specs:
4
4
  liqueur (0.0.5)
5
5
  sass (>= 3.1)
6
- wiskey (= 0.0.5)
6
+ wiskey
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- sass (3.1.12)
11
+ sass (3.1.15)
12
12
  wiskey (0.0.5)
13
13
  sass (>= 3.1)
14
14
 
@@ -0,0 +1,3 @@
1
+ #= require liqueur/datamask-applier
2
+ #= require liqueur/spinner
3
+ #= require liqueur/footer-float-height
@@ -0,0 +1,8 @@
1
+ #= require jquery
2
+ #= require ./lib/jquery.maskedinput
3
+ #= require ./onload
4
+
5
+ $.onload ->
6
+ $('[data-mask]').each ->
7
+ $(@).mask $(@).data('mask')
8
+
@@ -0,0 +1,6 @@
1
+ #= require jquery
2
+ #= require ./onload
3
+
4
+
5
+ $.onload ->
6
+ $('#pseudo-footer').css height: $('footer').height()
@@ -0,0 +1,338 @@
1
+ /*
2
+ Masked Input plugin for jQuery
3
+ Copyright (c) 2007-2013 Josh Bush (digitalbush.com)
4
+ Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
5
+ Version: 1.3.1
6
+ */
7
+ (function($) {
8
+ function getPasteEvent() {
9
+ var el = document.createElement('input'),
10
+ name = 'onpaste';
11
+ el.setAttribute(name, '');
12
+ return (typeof el[name] === 'function')?'paste':'input';
13
+ }
14
+
15
+ var pasteEventName = getPasteEvent() + ".mask",
16
+ ua = navigator.userAgent,
17
+ iPhone = /iphone/i.test(ua),
18
+ android=/android/i.test(ua),
19
+ caretTimeoutId;
20
+
21
+ $.mask = {
22
+ //Predefined character definitions
23
+ definitions: {
24
+ '9': "[0-9]",
25
+ 'a': "[A-Za-z]",
26
+ '*': "[A-Za-z0-9]"
27
+ },
28
+ dataName: "rawMaskFn",
29
+ placeholder: '_',
30
+ };
31
+
32
+ $.fn.extend({
33
+ //Helper Function for Caret positioning
34
+ caret: function(begin, end) {
35
+ var range;
36
+
37
+ if (this.length === 0 || this.is(":hidden")) {
38
+ return;
39
+ }
40
+
41
+ if (typeof begin == 'number') {
42
+ end = (typeof end === 'number') ? end : begin;
43
+ return this.each(function() {
44
+ if (this.setSelectionRange) {
45
+ this.setSelectionRange(begin, end);
46
+ } else if (this.createTextRange) {
47
+ range = this.createTextRange();
48
+ range.collapse(true);
49
+ range.moveEnd('character', end);
50
+ range.moveStart('character', begin);
51
+ range.select();
52
+ }
53
+ });
54
+ } else {
55
+ if (this[0].setSelectionRange) {
56
+ begin = this[0].selectionStart;
57
+ end = this[0].selectionEnd;
58
+ } else if (document.selection && document.selection.createRange) {
59
+ range = document.selection.createRange();
60
+ begin = 0 - range.duplicate().moveStart('character', -100000);
61
+ end = begin + range.text.length;
62
+ }
63
+ return { begin: begin, end: end };
64
+ }
65
+ },
66
+ unmask: function() {
67
+ return this.trigger("unmask");
68
+ },
69
+ mask: function(mask, settings) {
70
+ var input,
71
+ defs,
72
+ tests,
73
+ partialPosition,
74
+ firstNonMaskPos,
75
+ len;
76
+
77
+ if (!mask && this.length > 0) {
78
+ input = $(this[0]);
79
+ return input.data($.mask.dataName)();
80
+ }
81
+ settings = $.extend({
82
+ placeholder: $.mask.placeholder, // Load default placeholder
83
+ completed: null
84
+ }, settings);
85
+
86
+
87
+ defs = $.mask.definitions;
88
+ tests = [];
89
+ partialPosition = len = mask.length;
90
+ firstNonMaskPos = null;
91
+
92
+ $.each(mask.split(""), function(i, c) {
93
+ if (c == '?') {
94
+ len--;
95
+ partialPosition = i;
96
+ } else if (defs[c]) {
97
+ tests.push(new RegExp(defs[c]));
98
+ if (firstNonMaskPos === null) {
99
+ firstNonMaskPos = tests.length - 1;
100
+ }
101
+ } else {
102
+ tests.push(null);
103
+ }
104
+ });
105
+
106
+ return this.trigger("unmask").each(function() {
107
+ var input = $(this),
108
+ buffer = $.map(
109
+ mask.split(""),
110
+ function(c, i) {
111
+ if (c != '?') {
112
+ return defs[c] ? settings.placeholder : c;
113
+ }
114
+ }),
115
+ focusText = input.val();
116
+
117
+ function seekNext(pos) {
118
+ while (++pos < len && !tests[pos]);
119
+ return pos;
120
+ }
121
+
122
+ function seekPrev(pos) {
123
+ while (--pos >= 0 && !tests[pos]);
124
+ return pos;
125
+ }
126
+
127
+ function shiftL(begin,end) {
128
+ var i,
129
+ j;
130
+
131
+ if (begin<0) {
132
+ return;
133
+ }
134
+
135
+ for (i = begin, j = seekNext(end); i < len; i++) {
136
+ if (tests[i]) {
137
+ if (j < len && tests[i].test(buffer[j])) {
138
+ buffer[i] = buffer[j];
139
+ buffer[j] = settings.placeholder;
140
+ } else {
141
+ break;
142
+ }
143
+
144
+ j = seekNext(j);
145
+ }
146
+ }
147
+ writeBuffer();
148
+ input.caret(Math.max(firstNonMaskPos, begin));
149
+ }
150
+
151
+ function shiftR(pos) {
152
+ var i,
153
+ c,
154
+ j,
155
+ t;
156
+
157
+ for (i = pos, c = settings.placeholder; i < len; i++) {
158
+ if (tests[i]) {
159
+ j = seekNext(i);
160
+ t = buffer[i];
161
+ buffer[i] = c;
162
+ if (j < len && tests[j].test(t)) {
163
+ c = t;
164
+ } else {
165
+ break;
166
+ }
167
+ }
168
+ }
169
+ }
170
+
171
+ function keydownEvent(e) {
172
+ var k = e.which,
173
+ pos,
174
+ begin,
175
+ end;
176
+
177
+ //backspace, delete, and escape get special treatment
178
+ if (k === 8 || k === 46 || (iPhone && k === 127)) {
179
+ pos = input.caret();
180
+ begin = pos.begin;
181
+ end = pos.end;
182
+
183
+ if (end - begin === 0) {
184
+ begin=k!==46?seekPrev(begin):(end=seekNext(begin-1));
185
+ end=k===46?seekNext(end):end;
186
+ }
187
+ clearBuffer(begin, end);
188
+ shiftL(begin, end - 1);
189
+
190
+ e.preventDefault();
191
+ } else if (k == 27) {//escape
192
+ input.val(focusText);
193
+ input.caret(0, checkVal());
194
+ e.preventDefault();
195
+ }
196
+ }
197
+
198
+ function keypressEvent(e) {
199
+ var k = e.which,
200
+ pos = input.caret(),
201
+ p,
202
+ c,
203
+ next;
204
+
205
+ if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {//Ignore
206
+ return;
207
+ } else if (k) {
208
+ if (pos.end - pos.begin !== 0){
209
+ clearBuffer(pos.begin, pos.end);
210
+ shiftL(pos.begin, pos.end-1);
211
+ }
212
+
213
+ p = seekNext(pos.begin - 1);
214
+ if (p < len) {
215
+ c = String.fromCharCode(k);
216
+ if (tests[p].test(c)) {
217
+ shiftR(p);
218
+
219
+ buffer[p] = c;
220
+ writeBuffer();
221
+ next = seekNext(p);
222
+
223
+ if(android){
224
+ setTimeout($.proxy($.fn.caret,input,next),0);
225
+ }else{
226
+ input.caret(next);
227
+ }
228
+
229
+ if (settings.completed && next >= len) {
230
+ settings.completed.call(input);
231
+ }
232
+ }
233
+ }
234
+ e.preventDefault();
235
+ }
236
+ }
237
+
238
+ function clearBuffer(start, end) {
239
+ var i;
240
+ for (i = start; i < end && i < len; i++) {
241
+ if (tests[i]) {
242
+ buffer[i] = settings.placeholder;
243
+ }
244
+ }
245
+ }
246
+
247
+ function writeBuffer() { input.val(buffer.join('')); }
248
+
249
+ function checkVal(allow) {
250
+ //try to place characters where they belong
251
+ var test = input.val(),
252
+ lastMatch = -1,
253
+ i,
254
+ c;
255
+
256
+ for (i = 0, pos = 0; i < len; i++) {
257
+ if (tests[i]) {
258
+ buffer[i] = settings.placeholder;
259
+ while (pos++ < test.length) {
260
+ c = test.charAt(pos - 1);
261
+ if (tests[i].test(c)) {
262
+ buffer[i] = c;
263
+ lastMatch = i;
264
+ break;
265
+ }
266
+ }
267
+ if (pos > test.length) {
268
+ break;
269
+ }
270
+ } else if (buffer[i] === test.charAt(pos) && i !== partialPosition) {
271
+ pos++;
272
+ lastMatch = i;
273
+ }
274
+ }
275
+ if (allow) {
276
+ writeBuffer();
277
+ } else if (lastMatch + 1 < partialPosition) {
278
+ input.val("");
279
+ clearBuffer(0, len);
280
+ } else {
281
+ writeBuffer();
282
+ input.val(input.val().substring(0, lastMatch + 1));
283
+ }
284
+ return (partialPosition ? i : firstNonMaskPos);
285
+ }
286
+
287
+ input.data($.mask.dataName,function(){
288
+ return $.map(buffer, function(c, i) {
289
+ return tests[i]&&c!=settings.placeholder ? c : null;
290
+ }).join('');
291
+ });
292
+
293
+ if (!input.attr("readonly"))
294
+ input
295
+ .one("unmask", function() {
296
+ input
297
+ .unbind(".mask")
298
+ .removeData($.mask.dataName);
299
+ })
300
+ .bind("focus.mask", function() {
301
+ clearTimeout(caretTimeoutId);
302
+ var pos,
303
+ moveCaret;
304
+
305
+ focusText = input.val();
306
+ pos = checkVal();
307
+
308
+ caretTimeoutId = setTimeout(function(){
309
+ writeBuffer();
310
+ if (pos == mask.length) {
311
+ input.caret(0, pos);
312
+ } else {
313
+ input.caret(pos);
314
+ }
315
+ }, 10);
316
+ })
317
+ .bind("blur.mask", function() {
318
+ checkVal();
319
+ if (input.val() != focusText)
320
+ input.change();
321
+ })
322
+ .bind("keydown.mask", keydownEvent)
323
+ .bind("keypress.mask", keypressEvent)
324
+ .bind(pasteEventName, function() {
325
+ setTimeout(function() {
326
+ var pos=checkVal(true);
327
+ input.caret(pos);
328
+ if (settings.completed && pos == input.val().length)
329
+ settings.completed.call(input);
330
+ }, 0);
331
+ });
332
+ checkVal(); //Perform initial check for existing values
333
+ });
334
+ }
335
+ });
336
+
337
+
338
+ })(jQuery);
@@ -0,0 +1,279 @@
1
+ /*! NProgress (c) 2013, Rico Sta. Cruz
2
+ * http://ricostacruz.com/nprogress */
3
+
4
+ ;(function(factory) {
5
+
6
+ if (typeof module === 'function') {
7
+ module.exports = factory(this.jQuery || require('jquery'));
8
+ } else if (typeof define === 'function' && define.amd) {
9
+ define(['jquery'], function($) {
10
+ return factory($);
11
+ });
12
+ } else {
13
+ this.NProgress = factory(this.jQuery);
14
+ }
15
+
16
+ })(function($) {
17
+ var NProgress = {};
18
+
19
+ NProgress.version = '0.1.2';
20
+
21
+ var Settings = NProgress.settings = {
22
+ minimum: 0.08,
23
+ easing: 'ease',
24
+ positionUsing: '',
25
+ speed: 200,
26
+ trickle: true,
27
+ trickleRate: 0.02,
28
+ trickleSpeed: 800,
29
+ showSpinner: true,
30
+ template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
31
+ };
32
+
33
+ /**
34
+ * Updates configuration.
35
+ *
36
+ * NProgress.configure({
37
+ * minimum: 0.1
38
+ * });
39
+ */
40
+ NProgress.configure = function(options) {
41
+ $.extend(Settings, options);
42
+ return this;
43
+ };
44
+
45
+ /**
46
+ * Last number.
47
+ */
48
+
49
+ NProgress.status = null;
50
+
51
+ /**
52
+ * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
53
+ *
54
+ * NProgress.set(0.4);
55
+ * NProgress.set(1.0);
56
+ */
57
+
58
+ NProgress.set = function(n) {
59
+ var started = NProgress.isStarted();
60
+
61
+ n = clamp(n, Settings.minimum, 1);
62
+ NProgress.status = (n === 1 ? null : n);
63
+
64
+ var $progress = NProgress.render(!started),
65
+ $bar = $progress.find('[role="bar"]'),
66
+ speed = Settings.speed,
67
+ ease = Settings.easing;
68
+
69
+ $progress[0].offsetWidth; /* Repaint */
70
+
71
+ $progress.queue(function(next) {
72
+ // Set positionUsing if it hasn't already been set
73
+ if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
74
+
75
+ // Add transition
76
+ $bar.css(barPositionCSS(n, speed, ease));
77
+
78
+ if (n === 1) {
79
+ // Fade out
80
+ $progress.css({ transition: 'none', opacity: 1 });
81
+ $progress[0].offsetWidth; /* Repaint */
82
+
83
+ setTimeout(function() {
84
+ $progress.css({ transition: 'all '+speed+'ms linear', opacity: 0 });
85
+ setTimeout(function() {
86
+ NProgress.remove();
87
+ next();
88
+ }, speed);
89
+ }, speed);
90
+ } else {
91
+ setTimeout(next, speed);
92
+ }
93
+ });
94
+
95
+ return this;
96
+ };
97
+
98
+ NProgress.isStarted = function() {
99
+ return typeof NProgress.status === 'number';
100
+ };
101
+
102
+ /**
103
+ * Shows the progress bar.
104
+ * This is the same as setting the status to 0%, except that it doesn't go backwards.
105
+ *
106
+ * NProgress.start();
107
+ *
108
+ */
109
+ NProgress.start = function() {
110
+ if (!NProgress.status) NProgress.set(0);
111
+
112
+ var work = function() {
113
+ setTimeout(function() {
114
+ if (!NProgress.status) return;
115
+ NProgress.trickle();
116
+ work();
117
+ }, Settings.trickleSpeed);
118
+ };
119
+
120
+ if (Settings.trickle) work();
121
+
122
+ return this;
123
+ };
124
+
125
+ /**
126
+ * Hides the progress bar.
127
+ * This is the *sort of* the same as setting the status to 100%, with the
128
+ * difference being `done()` makes some placebo effect of some realistic motion.
129
+ *
130
+ * NProgress.done();
131
+ *
132
+ * If `true` is passed, it will show the progress bar even if its hidden.
133
+ *
134
+ * NProgress.done(true);
135
+ */
136
+
137
+ NProgress.done = function(force) {
138
+ if (!force && !NProgress.status) return this;
139
+
140
+ return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
141
+ };
142
+
143
+ /**
144
+ * Increments by a random amount.
145
+ */
146
+
147
+ NProgress.inc = function(amount) {
148
+ var n = NProgress.status;
149
+
150
+ if (!n) {
151
+ return NProgress.start();
152
+ } else {
153
+ if (typeof amount !== 'number') {
154
+ amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
155
+ }
156
+
157
+ n = clamp(n + amount, 0, 0.994);
158
+ return NProgress.set(n);
159
+ }
160
+ };
161
+
162
+ NProgress.trickle = function() {
163
+ return NProgress.inc(Math.random() * Settings.trickleRate);
164
+ };
165
+
166
+ /**
167
+ * (Internal) renders the progress bar markup based on the `template`
168
+ * setting.
169
+ */
170
+
171
+ NProgress.render = function(fromStart) {
172
+ if (NProgress.isRendered()) return $("#nprogress");
173
+ $('html').addClass('nprogress-busy');
174
+
175
+ var $el = $("<div id='nprogress'>")
176
+ .html(Settings.template);
177
+
178
+ var perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0);
179
+
180
+ $el.find('[role="bar"]').css({
181
+ transition: 'all 0 linear',
182
+ transform: 'translate3d('+perc+'%,0,0)'
183
+ });
184
+
185
+ if (!Settings.showSpinner)
186
+ $el.find('[role="spinner"]').remove();
187
+
188
+ $el.appendTo(document.body);
189
+
190
+ return $el;
191
+ };
192
+
193
+ /**
194
+ * Removes the element. Opposite of render().
195
+ */
196
+
197
+ NProgress.remove = function() {
198
+ $('html').removeClass('nprogress-busy');
199
+ $('#nprogress').remove();
200
+ };
201
+
202
+ /**
203
+ * Checks if the progress bar is rendered.
204
+ */
205
+
206
+ NProgress.isRendered = function() {
207
+ return ($("#nprogress").length > 0);
208
+ };
209
+
210
+ /**
211
+ * Determine which positioning CSS rule to use.
212
+ */
213
+
214
+ NProgress.getPositioningCSS = function() {
215
+ // Sniff on document.body.style
216
+ var bodyStyle = document.body.style;
217
+
218
+ // Sniff prefixes
219
+ var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
220
+ ('MozTransform' in bodyStyle) ? 'Moz' :
221
+ ('msTransform' in bodyStyle) ? 'ms' :
222
+ ('OTransform' in bodyStyle) ? 'O' : '';
223
+
224
+ if (vendorPrefix + 'Perspective' in bodyStyle) {
225
+ // Modern browsers with 3D support, e.g. Webkit, IE10
226
+ return 'translate3d';
227
+ } else if (vendorPrefix + 'Transform' in bodyStyle) {
228
+ // Browsers without 3D support, e.g. IE9
229
+ return 'translate';
230
+ } else {
231
+ // Browsers without translate() support, e.g. IE7-8
232
+ return 'margin';
233
+ }
234
+ };
235
+
236
+ /**
237
+ * Helpers
238
+ */
239
+
240
+ function clamp(n, min, max) {
241
+ if (n < min) return min;
242
+ if (n > max) return max;
243
+ return n;
244
+ }
245
+
246
+ /**
247
+ * (Internal) converts a percentage (`0..1`) to a bar translateX
248
+ * percentage (`-100%..0%`).
249
+ */
250
+
251
+ function toBarPerc(n) {
252
+ return (-1 + n) * 100;
253
+ }
254
+
255
+
256
+ /**
257
+ * (Internal) returns the correct CSS for changing the bar's
258
+ * position given an n percentage, and speed and ease from Settings
259
+ */
260
+
261
+ function barPositionCSS(n, speed, ease) {
262
+ var barCSS;
263
+
264
+ if (Settings.positionUsing === 'translate3d') {
265
+ barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
266
+ } else if (Settings.positionUsing === 'translate') {
267
+ barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
268
+ } else {
269
+ barCSS = { 'margin-left': toBarPerc(n)+'%' };
270
+ }
271
+
272
+ barCSS.transition = 'all '+speed+'ms '+ease;
273
+
274
+ return barCSS;
275
+ }
276
+
277
+ return NProgress;
278
+ });
279
+