pace-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af0449799d02e3c0f8e8558cbefb6458e3408690
4
- data.tar.gz: 0c7f4987c68e97763c5373fb09cefee189dca33b
3
+ metadata.gz: a56d7885571555fd44d73c3fc30fe9224ef6afd1
4
+ data.tar.gz: df8a3721b837480db97fcb2b6cc10430bffc68f7
5
5
  SHA512:
6
- metadata.gz: a1c8153db753499eef4b1737d2f5a87c95e491a5de5a4d628e527a83c483f91421d50e96cb9a1a27d2d47c993f6098513f8c8ddfa2cb8d18ff49459ae7f45d12
7
- data.tar.gz: 35ca5c6b3bbfc7b1080e45811a0b974d24bc095480b62c4056798b8b8b8d876ed31b1679fb03f1f54a3cbe74a6f4dd4eb2118d168b756303dec61058f7ffbb44
6
+ metadata.gz: 6e2896e1a182d459c4f8a5c59ef02947397e136af6bd57d464dcde50cf880f3485a55e0fe46dda180f49889f4dfb7f4ee61a86aabcd33ec0dfff43e8ba1370c2
7
+ data.tar.gz: cdac175b6595ad33263822f7521c510cb4b40ad9704a040e878586b553e8b20fb63e5a734a4224d8ae077f4c4046dca53842eceaa0177e83d048b5af40e8068d
@@ -0,0 +1,618 @@
1
+ (function() {
2
+ var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Events, RequestIntercept, RequestTracker, SOURCE_KEYS, Scaler, animation, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, getFromDOM, handlePushState, init, intercept, now, options, requestAnimationFrame, result, runAnimation, scalers, sources, uniScaler, _XDomainRequest, _XMLHttpRequest, _pushState, _replaceState,
3
+ __slice = [].slice,
4
+ __hasProp = {}.hasOwnProperty,
5
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
6
+
7
+ defaultOptions = {
8
+ catchupTime: 500,
9
+ initialRate: .03,
10
+ minTime: 500,
11
+ ghostTime: 250,
12
+ maxProgressPerFrame: 10,
13
+ easeFactor: 1.25,
14
+ restartOnPushState: true,
15
+ elements: {
16
+ checkInterval: 100,
17
+ selectors: ['body']
18
+ },
19
+ eventLag: {
20
+ minSamples: 10
21
+ }
22
+ };
23
+
24
+ now = function() {
25
+ var _ref;
26
+ return (_ref = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref : +(new Date);
27
+ };
28
+
29
+ requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
30
+
31
+ cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
32
+
33
+ if (requestAnimationFrame == null) {
34
+ requestAnimationFrame = function(fn) {
35
+ return setTimeout(fn, 50);
36
+ };
37
+ cancelAnimationFrame = function(id) {
38
+ return clearTimeout(id);
39
+ };
40
+ }
41
+
42
+ runAnimation = function(fn) {
43
+ var last, tick;
44
+ last = now();
45
+ tick = function() {
46
+ var diff;
47
+ diff = now() - last;
48
+ last = now();
49
+ return fn(diff, function() {
50
+ return requestAnimationFrame(tick);
51
+ });
52
+ };
53
+ return tick();
54
+ };
55
+
56
+ result = function() {
57
+ var args, key, obj;
58
+ obj = arguments[0], key = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
59
+ if (typeof obj[key] === 'function') {
60
+ return obj[key].apply(obj, args);
61
+ } else {
62
+ return obj[key];
63
+ }
64
+ };
65
+
66
+ extend = function() {
67
+ var key, out, source, sources, val, _i, _len;
68
+ out = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
69
+ for (_i = 0, _len = sources.length; _i < _len; _i++) {
70
+ source = sources[_i];
71
+ if (source) {
72
+ for (key in source) {
73
+ if (!__hasProp.call(source, key)) continue;
74
+ val = source[key];
75
+ if ((out[key] != null) && typeof out[key] === 'object' && (val != null) && typeof val === 'object') {
76
+ extend(out[key], val);
77
+ } else {
78
+ out[key] = val;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ return out;
84
+ };
85
+
86
+ getFromDOM = function(key, json) {
87
+ var data, e, el;
88
+ if (key == null) {
89
+ key = 'options';
90
+ }
91
+ if (json == null) {
92
+ json = true;
93
+ }
94
+ el = document.querySelector("[data-pace-" + key + "]");
95
+ if (!el) {
96
+ return;
97
+ }
98
+ data = el.getAttribute("data-pace-" + key);
99
+ if (!json) {
100
+ return data;
101
+ }
102
+ try {
103
+ return JSON.parse(data);
104
+ } catch (_error) {
105
+ e = _error;
106
+ return typeof console !== "undefined" && console !== null ? console.error("Error parsing inline pace options", e) : void 0;
107
+ }
108
+ };
109
+
110
+ if (window.Pace == null) {
111
+ window.Pace = {};
112
+ }
113
+
114
+ options = Pace.options = extend(defaultOptions, window.paceOptions, getFromDOM());
115
+
116
+ Bar = (function() {
117
+ function Bar() {
118
+ this.progress = 0;
119
+ }
120
+
121
+ Bar.prototype.getElement = function() {
122
+ if (this.el == null) {
123
+ this.el = document.createElement('div');
124
+ this.el.className = "pace pace-active";
125
+ this.el.innerHTML = '<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>';
126
+ if (document.body.firstChild != null) {
127
+ document.body.insertBefore(this.el, document.body.firstChild);
128
+ } else {
129
+ document.body.appendChild(this.el);
130
+ }
131
+ }
132
+ return this.el;
133
+ };
134
+
135
+ Bar.prototype.finish = function() {
136
+ var el;
137
+ el = this.getElement();
138
+ el.className = el.className.replace('pace-active', '');
139
+ return el.className += ' pace-inactive';
140
+ };
141
+
142
+ Bar.prototype.update = function(prog) {
143
+ this.progress = prog;
144
+ return this.render();
145
+ };
146
+
147
+ Bar.prototype.destroy = function() {
148
+ this.getElement().parentNode.removeChild(this.getElement());
149
+ return this.el = void 0;
150
+ };
151
+
152
+ Bar.prototype.render = function() {
153
+ var el, progressStr;
154
+ if (document.body == null) {
155
+ return false;
156
+ }
157
+ el = this.getElement();
158
+ el.children[0].style.width = "" + this.progress + "%";
159
+ if (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) {
160
+ el.setAttribute('data-progress-text', "" + (this.progress | 0) + "%");
161
+ if (this.progress >= 100) {
162
+ progressStr = '99';
163
+ } else {
164
+ progressStr = this.progress < 10 ? "0" : "";
165
+ progressStr += this.progress | 0;
166
+ }
167
+ el.setAttribute('data-progress', "" + progressStr);
168
+ }
169
+ return this.lastRenderedProgress = this.progress;
170
+ };
171
+
172
+ Bar.prototype.done = function() {
173
+ return this.progress >= 100;
174
+ };
175
+
176
+ return Bar;
177
+
178
+ })();
179
+
180
+ Events = (function() {
181
+ function Events() {
182
+ this.bindings = {};
183
+ }
184
+
185
+ Events.prototype.trigger = function(name, val) {
186
+ var binding, _i, _len, _ref, _results;
187
+ if (this.bindings[name] != null) {
188
+ _ref = this.bindings[name];
189
+ _results = [];
190
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
191
+ binding = _ref[_i];
192
+ _results.push(binding.call(this, val));
193
+ }
194
+ return _results;
195
+ }
196
+ };
197
+
198
+ Events.prototype.on = function(name, fn) {
199
+ var _base;
200
+ if ((_base = this.bindings)[name] == null) {
201
+ _base[name] = [];
202
+ }
203
+ return this.bindings[name].push(fn);
204
+ };
205
+
206
+ return Events;
207
+
208
+ })();
209
+
210
+ _XMLHttpRequest = window.XMLHttpRequest;
211
+
212
+ _XDomainRequest = window.XDomainRequest;
213
+
214
+ RequestIntercept = (function(_super) {
215
+ __extends(RequestIntercept, _super);
216
+
217
+ function RequestIntercept() {
218
+ var monitor,
219
+ _this = this;
220
+ RequestIntercept.__super__.constructor.apply(this, arguments);
221
+ monitor = function(req) {
222
+ var _open;
223
+ _open = req.open;
224
+ return req.open = function(type, url, async) {
225
+ _this.trigger('request', {
226
+ type: type,
227
+ url: url,
228
+ request: req
229
+ });
230
+ return _open.apply(req, arguments);
231
+ };
232
+ };
233
+ window.XMLHttpRequest = function() {
234
+ var req;
235
+ req = new _XMLHttpRequest;
236
+ monitor(req);
237
+ return req;
238
+ };
239
+ if (_XDomainRequest != null) {
240
+ window.XDomainRequest = function() {
241
+ var req;
242
+ req = new _XDomainRequest;
243
+ monitor(req);
244
+ return req;
245
+ };
246
+ }
247
+ }
248
+
249
+ return RequestIntercept;
250
+
251
+ })(Events);
252
+
253
+ intercept = new RequestIntercept;
254
+
255
+ AjaxMonitor = (function() {
256
+ function AjaxMonitor() {
257
+ var _this = this;
258
+ this.elements = [];
259
+ intercept.on('request', function(_arg) {
260
+ var request;
261
+ request = _arg.request;
262
+ return _this.watch(request);
263
+ });
264
+ }
265
+
266
+ AjaxMonitor.prototype.watch = function(request) {
267
+ var tracker;
268
+ tracker = new RequestTracker(request);
269
+ return this.elements.push(tracker);
270
+ };
271
+
272
+ return AjaxMonitor;
273
+
274
+ })();
275
+
276
+ RequestTracker = (function() {
277
+ function RequestTracker(request) {
278
+ var handler, size, _fn, _i, _len, _onprogress, _onreadystatechange, _ref,
279
+ _this = this;
280
+ this.progress = 0;
281
+ if (request.onprogress !== void 0) {
282
+ size = null;
283
+ _onprogress = request.onprogress;
284
+ request.onprogress = function() {
285
+ var e, headers, name, val;
286
+ try {
287
+ headers = request.getAllResponseHeaders();
288
+ for (name in headers) {
289
+ val = headers[name];
290
+ if (name.toLowerCase() === 'content-length') {
291
+ size = +val;
292
+ break;
293
+ }
294
+ }
295
+ } catch (_error) {
296
+ e = _error;
297
+ }
298
+ if (size != null) {
299
+ try {
300
+ return _this.progress = request.responseText.length / size;
301
+ } catch (_error) {
302
+ e = _error;
303
+ }
304
+ } else {
305
+ return _this.progress = _this.progress + (100 - _this.progress) / 2;
306
+ }
307
+ };
308
+ if (typeof _onprogress === "function") {
309
+ _onprogress.apply(null, arguments);
310
+ }
311
+ _ref = ['onload', 'onabort', 'ontimeout', 'onerror'];
312
+ _fn = function() {
313
+ var fn;
314
+ fn = request[handler];
315
+ return request[handler] = function() {
316
+ _this.progress = 100;
317
+ return typeof fn === "function" ? fn.apply(null, arguments) : void 0;
318
+ };
319
+ };
320
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
321
+ handler = _ref[_i];
322
+ _fn();
323
+ }
324
+ } else {
325
+ _onreadystatechange = request.onreadystatechange;
326
+ request.onreadystatechange = function() {
327
+ var _ref1;
328
+ if ((_ref1 = request.readyState) === 0 || _ref1 === 4) {
329
+ _this.progress = 100;
330
+ } else if (request.readyState === 3) {
331
+ _this.progress = 50;
332
+ }
333
+ return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
334
+ };
335
+ }
336
+ }
337
+
338
+ return RequestTracker;
339
+
340
+ })();
341
+
342
+ ElementMonitor = (function() {
343
+ function ElementMonitor(options) {
344
+ var selector, _i, _len, _ref;
345
+ if (options == null) {
346
+ options = {};
347
+ }
348
+ this.elements = [];
349
+ if (options.selectors == null) {
350
+ options.selectors = [];
351
+ }
352
+ _ref = options.selectors;
353
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
354
+ selector = _ref[_i];
355
+ this.elements.push(new ElementTracker(selector));
356
+ }
357
+ }
358
+
359
+ return ElementMonitor;
360
+
361
+ })();
362
+
363
+ ElementTracker = (function() {
364
+ function ElementTracker(selector) {
365
+ this.selector = selector;
366
+ this.progress = 0;
367
+ this.check();
368
+ }
369
+
370
+ ElementTracker.prototype.check = function() {
371
+ var _this = this;
372
+ if (document.querySelector(this.selector)) {
373
+ return this.done();
374
+ } else {
375
+ return setTimeout((function() {
376
+ return _this.check();
377
+ }), options.elements.checkInterval);
378
+ }
379
+ };
380
+
381
+ ElementTracker.prototype.done = function() {
382
+ return this.progress = 100;
383
+ };
384
+
385
+ return ElementTracker;
386
+
387
+ })();
388
+
389
+ DocumentMonitor = (function() {
390
+ DocumentMonitor.prototype.states = {
391
+ loading: 0,
392
+ interactive: 50,
393
+ complete: 100
394
+ };
395
+
396
+ function DocumentMonitor() {
397
+ var _onreadystatechange,
398
+ _this = this;
399
+ this.progress = 0;
400
+ _onreadystatechange = document.onreadystatechange;
401
+ document.onreadystatechange = function() {
402
+ if (_this.states[document.readyState] != null) {
403
+ _this.progress = _this.states[document.readyState];
404
+ }
405
+ return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
406
+ };
407
+ }
408
+
409
+ return DocumentMonitor;
410
+
411
+ })();
412
+
413
+ EventLagMonitor = (function() {
414
+ function EventLagMonitor() {
415
+ var avg, last, points,
416
+ _this = this;
417
+ this.progress = 0;
418
+ avg = 0;
419
+ points = 0;
420
+ last = now();
421
+ setInterval(function() {
422
+ var diff;
423
+ diff = now() - last - 50;
424
+ last = now();
425
+ avg = avg + (diff - avg) / 15;
426
+ if (points++ > options.eventLag.minSamples && Math.abs(avg) < 3) {
427
+ avg = 0;
428
+ }
429
+ return _this.progress = 100 * (3 / (avg + 3));
430
+ }, 50);
431
+ }
432
+
433
+ return EventLagMonitor;
434
+
435
+ })();
436
+
437
+ Scaler = (function() {
438
+ function Scaler(source) {
439
+ this.source = source;
440
+ this.last = this.sinceLastUpdate = 0;
441
+ this.rate = options.initialRate;
442
+ this.catchup = 0;
443
+ this.progress = this.lastProgress = 0;
444
+ if (this.source != null) {
445
+ this.progress = result(this.source, 'progress');
446
+ }
447
+ }
448
+
449
+ Scaler.prototype.tick = function(frameTime, val) {
450
+ var scaling;
451
+ if (val == null) {
452
+ val = result(this.source, 'progress');
453
+ }
454
+ if (val >= 100) {
455
+ this.done = true;
456
+ }
457
+ if (val === this.last) {
458
+ this.sinceLastUpdate += frameTime;
459
+ } else {
460
+ if (this.sinceLastUpdate) {
461
+ this.rate = (val - this.last) / this.sinceLastUpdate;
462
+ }
463
+ this.catchup = (val - this.progress) / options.catchupTime;
464
+ this.sinceLastUpdate = 0;
465
+ this.last = val;
466
+ }
467
+ if (val > this.progress) {
468
+ this.progress += this.catchup * frameTime;
469
+ }
470
+ scaling = 1 - Math.pow(this.progress / 100, options.easeFactor);
471
+ this.progress += scaling * this.rate * frameTime;
472
+ this.progress = Math.min(this.lastProgress + options.maxProgressPerFrame, this.progress);
473
+ this.progress = Math.max(0, this.progress);
474
+ this.progress = Math.min(100, this.progress);
475
+ this.lastProgress = this.progress;
476
+ return this.progress;
477
+ };
478
+
479
+ return Scaler;
480
+
481
+ })();
482
+
483
+ sources = null;
484
+
485
+ scalers = null;
486
+
487
+ bar = null;
488
+
489
+ uniScaler = null;
490
+
491
+ animation = null;
492
+
493
+ cancelAnimation = null;
494
+
495
+ handlePushState = function() {
496
+ if (options.restartOnPushState) {
497
+ return Pace.restart();
498
+ }
499
+ };
500
+
501
+ if (window.history.pushState != null) {
502
+ _pushState = window.history.pushState;
503
+ window.history.pushState = function() {
504
+ handlePushState();
505
+ return _pushState.apply(window.history, arguments);
506
+ };
507
+ }
508
+
509
+ if (window.history.replaceState != null) {
510
+ _replaceState = window.history.replaceState;
511
+ window.history.replaceState = function() {
512
+ handlePushState();
513
+ return _replaceState.apply(window.history, arguments);
514
+ };
515
+ }
516
+
517
+ SOURCE_KEYS = {
518
+ ajax: AjaxMonitor,
519
+ elements: ElementMonitor,
520
+ document: DocumentMonitor,
521
+ eventLag: EventLagMonitor
522
+ };
523
+
524
+ (init = function() {
525
+ var source, type, _i, _j, _len, _len1, _ref, _ref1, _ref2;
526
+ sources = [];
527
+ _ref = ['ajax', 'elements', 'document', 'eventLag'];
528
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
529
+ type = _ref[_i];
530
+ if (options[type] !== false) {
531
+ sources.push(new SOURCE_KEYS[type](options[type]));
532
+ }
533
+ }
534
+ _ref2 = (_ref1 = options.extraSources) != null ? _ref1 : [];
535
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
536
+ source = _ref2[_j];
537
+ sources.push(new source(options));
538
+ }
539
+ bar = new Bar;
540
+ scalers = [];
541
+ return uniScaler = new Scaler;
542
+ })();
543
+
544
+ Pace.stop = function() {
545
+ bar.destroy();
546
+ cancelAnimation = true;
547
+ if (animation != null) {
548
+ if (typeof cancelAnimationFrame === "function") {
549
+ cancelAnimationFrame(animation);
550
+ }
551
+ animation = null;
552
+ }
553
+ return init();
554
+ };
555
+
556
+ Pace.restart = function() {
557
+ Pace.stop();
558
+ return Pace.go();
559
+ };
560
+
561
+ Pace.go = function() {
562
+ bar.render();
563
+ cancelAnimation = false;
564
+ return animation = runAnimation(function(frameTime, enqueueNextFrame) {
565
+ var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, source, start, sum, _i, _j, _len, _len1, _ref;
566
+ remaining = 100 - bar.progress;
567
+ count = sum = 0;
568
+ done = true;
569
+ for (i = _i = 0, _len = sources.length; _i < _len; i = ++_i) {
570
+ source = sources[i];
571
+ scalerList = scalers[i] != null ? scalers[i] : scalers[i] = [];
572
+ elements = (_ref = source.elements) != null ? _ref : [source];
573
+ for (j = _j = 0, _len1 = elements.length; _j < _len1; j = ++_j) {
574
+ element = elements[j];
575
+ scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element);
576
+ done &= scaler.done;
577
+ if (scaler.done) {
578
+ continue;
579
+ }
580
+ count++;
581
+ sum += scaler.tick(frameTime);
582
+ }
583
+ }
584
+ avg = sum / count;
585
+ bar.update(uniScaler.tick(frameTime, avg));
586
+ start = now();
587
+ if (bar.done() || done || cancelAnimation) {
588
+ bar.update(100);
589
+ return setTimeout(function() {
590
+ return bar.finish();
591
+ }, Math.max(options.ghostTime, Math.min(options.minTime, now() - start)));
592
+ } else {
593
+ return enqueueNextFrame();
594
+ }
595
+ });
596
+ };
597
+
598
+ Pace.start = function(_options) {
599
+ extend(options, _options);
600
+ bar.render();
601
+ if (!document.querySelector('.pace')) {
602
+ return setTimeout(Pace.start, 50);
603
+ } else {
604
+ return Pace.go();
605
+ }
606
+ };
607
+
608
+ if (typeof define === 'function' && define.amd) {
609
+ define(function() {
610
+ return Pace;
611
+ });
612
+ } else if (typeof exports === 'object') {
613
+ module.exports = Pace;
614
+ } else {
615
+ Pace.start();
616
+ }
617
+
618
+ }).call(this);
@@ -0,0 +1,66 @@
1
+ .pace {
2
+ -webkit-pointer-events: none;
3
+ pointer-events: none;
4
+ -webkit-user-select: none;
5
+ -moz-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+ .pace-inactive {
10
+ display: none;
11
+ }
12
+
13
+ .pace .pace-progress {
14
+ background-color: #29d;
15
+ position: fixed;
16
+ z-index: 2000;
17
+ top: 0;
18
+ left: 0;
19
+ height: 12px;
20
+ overflow: hidden;
21
+ }
22
+
23
+ .pace .pace-progress-inner {
24
+ position: absolute;
25
+ top: 0;
26
+ left: 0;
27
+ right: -32px;
28
+ bottom: 0;
29
+
30
+ background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.2)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.2)), color-stop(0.75, rgba(255, 255, 255, 0.2)), color-stop(0.75, transparent), to(transparent));
31
+ background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
32
+ background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
33
+ background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
34
+ background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
35
+ -webkit-background-size: 32px 32px;
36
+ -moz-background-size: 32px 32px;
37
+ -o-background-size: 32px 32px;
38
+ background-size: 32px 32px;
39
+
40
+ -webkit-animation: pace-stripe-animation 500ms linear infinite;
41
+ -moz-animation: pace-stripe-animation 500ms linear infinite;
42
+ -ms-animation: pace-stripe-animation 500ms linear infinite;
43
+ -o-animation: pace-stripe-animation 500ms linear infinite;
44
+ animation: pace-stripe-animation 500ms linear infinite;
45
+ }
46
+
47
+ @-webkit-keyframes pace-stripe-animation {
48
+ 0% { -webkit-transform: none; transform: none; }
49
+ 100% { -webkit-transform: translate(-32px, 0); transform: translate(-32px, 0); }
50
+ }
51
+ @-moz-keyframes pace-stripe-animation {
52
+ 0% { -moz-transform: none; transform: none; }
53
+ 100% { -moz-transform: translate(-32px, 0); transform: translate(-32px, 0); }
54
+ }
55
+ @-o-keyframes pace-stripe-animation {
56
+ 0% { -o-transform: none; transform: none; }
57
+ 100% { -o-transform: translate(-32px, 0); transform: translate(-32px, 0); }
58
+ }
59
+ @-ms-keyframes pace-stripe-animation {
60
+ 0% { -ms-transform: none; transform: none; }
61
+ 100% { -ms-transform: translate(-32px, 0); transform: translate(-32px, 0); }
62
+ }
63
+ @keyframes pace-stripe-animation {
64
+ 0% { transform: none; transform: none; }
65
+ 100% { transform: translate(-32px, 0); transform: translate(-32px, 0); }
66
+ }
@@ -0,0 +1,30 @@
1
+ .pace {
2
+ -webkit-pointer-events: none;
3
+ pointer-events: none;
4
+ -webkit-user-select: none;
5
+ -moz-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+ .pace .pace-progress {
10
+ position: fixed;
11
+ z-index: 2000;
12
+ top: 0;
13
+ right: 0;
14
+ height: 5rem;
15
+ width: 5rem;
16
+ }
17
+
18
+ .pace .pace-progress:after {
19
+ display: block;
20
+ position: absolute;
21
+ top: 0;
22
+ right: .5rem;
23
+ content: attr(data-progress);
24
+ font-family: "Helvetica Neue", sans-serif;
25
+ font-weight: 100;
26
+ font-size: 5rem;
27
+ line-height: 1;
28
+ text-align: right;
29
+ color: rgba(0, 0, 0, 0.19999999999999996);
30
+ }
@@ -0,0 +1,230 @@
1
+ .pace {
2
+ width: 140px;
3
+ height: 300px;
4
+ position: fixed;
5
+ top: -90px;
6
+ right: -20px;
7
+ z-index: 2000;
8
+ -webkit-transform: scale(0);
9
+ -moz-transform: scale(0);
10
+ -ms-transform: scale(0);
11
+ -o-transform: scale(0);
12
+ transform: scale(0);
13
+ opacity: 0;
14
+ -webkit-transition: all 2s linear 0s;
15
+ -moz-transition: all 2s linear 0s;
16
+ transition: all 2s linear 0s;
17
+ }
18
+
19
+ .pace.pace-active {
20
+ -webkit-transform: scale(.25);
21
+ -moz-transform: scale(.25);
22
+ -ms-transform: scale(.25);
23
+ -o-transform: scale(.25);
24
+ transform: scale(.25);
25
+ opacity: 1;
26
+ }
27
+
28
+ .pace .pace-activity {
29
+ width: 140px;
30
+ height: 140px;
31
+ border-radius: 70px;
32
+ background: #29d;
33
+ position: absolute;
34
+ top: 0;
35
+ z-index: 1911;
36
+ -webkit-animation: pace-bounce 1s infinite;
37
+ -moz-animation: pace-bounce 1s infinite;
38
+ -o-animation: pace-bounce 1s infinite;
39
+ -ms-animation: pace-bounce 1s infinite;
40
+ animation: pace-bounce 1s infinite;
41
+ }
42
+
43
+ .pace .pace-progress {
44
+ position: absolute;
45
+ display: block;
46
+ left: 50%;
47
+ bottom: 0;
48
+ z-index: 1910;
49
+ margin-left: -30px;
50
+ width: 60px;
51
+ height: 75px;
52
+ background: rgba(20, 20, 20, .1);
53
+ box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1);
54
+ border-radius: 30px / 40px;
55
+ -webkit-transform: scaleY(.3);
56
+ -moz-transform: scaleY(.3);
57
+ -ms-transform: scaleY(.3);
58
+ -o-transform: scaleY(.3);
59
+ transform: scaleY(.3);
60
+ -webkit-animation: pace-compress .5s infinite alternate;
61
+ -moz-animation: pace-compress .5s infinite alternate;
62
+ -o-animation: pace-compress .5s infinite alternate;
63
+ -ms-animation: pace-compress .5s infinite alternate;
64
+ animation: pace-compress .5s infinite alternate;
65
+ }
66
+
67
+ @-webkit-keyframes pace-bounce {
68
+ 0% {
69
+ top: 0;
70
+ -webkit-animation-timing-function: ease-in;
71
+ }
72
+ 40% {}
73
+ 50% {
74
+ top: 140px;
75
+ height: 140px;
76
+ -webkit-animation-timing-function: ease-out;
77
+ }
78
+ 55% {
79
+ top: 160px;
80
+ height: 120px;
81
+ border-radius: 70px / 60px;
82
+ -webkit-animation-timing-function: ease-in;
83
+ }
84
+ 65% {
85
+ top: 120px;
86
+ height: 140px;
87
+ border-radius: 70px;
88
+ -webkit-animation-timing-function: ease-out;
89
+ }
90
+ 95% {
91
+ top: 0;
92
+ -webkit-animation-timing-function: ease-in;
93
+ }
94
+ 100% {
95
+ top: 0;
96
+ -webkit-animation-timing-function: ease-in;
97
+ }
98
+ }
99
+
100
+ @-moz-keyframes pace-bounce {
101
+ 0% {
102
+ top: 0;
103
+ -moz-animation-timing-function: ease-in;
104
+ }
105
+ 40% {}
106
+ 50% {
107
+ top: 140px;
108
+ height: 140px;
109
+ -moz-animation-timing-function: ease-out;
110
+ }
111
+ 55% {
112
+ top: 160px;
113
+ height: 120px;
114
+ border-radius: 70px / 60px;
115
+ -moz-animation-timing-function: ease-in;
116
+ }
117
+ 65% {
118
+ top: 120px;
119
+ height: 140px;
120
+ border-radius: 70px;
121
+ -moz-animation-timing-function: ease-out;}
122
+ 95% {
123
+ top: 0;
124
+ -moz-animation-timing-function: ease-in;
125
+ }
126
+ 100% {top: 0;
127
+ -moz-animation-timing-function: ease-in;
128
+ }
129
+ }
130
+
131
+ @keyframes pace-bounce {
132
+ 0% {
133
+ top: 0;
134
+ animation-timing-function: ease-in;
135
+ }
136
+ 50% {
137
+ top: 140px;
138
+ height: 140px;
139
+ animation-timing-function: ease-out;
140
+ }
141
+ 55% {
142
+ top: 160px;
143
+ height: 120px;
144
+ border-radius: 70px / 60px;
145
+ animation-timing-function: ease-in;
146
+ }
147
+ 65% {
148
+ top: 120px;
149
+ height: 140px;
150
+ border-radius: 70px;
151
+ animation-timing-function: ease-out;
152
+ }
153
+ 95% {
154
+ top: 0;
155
+ animation-timing-function: ease-in;
156
+ }
157
+ 100% {
158
+ top: 0;
159
+ animation-timing-function: ease-in;
160
+ }
161
+ }
162
+
163
+ @-webkit-keyframes pace-compress {
164
+ 0% {
165
+ bottom: 0;
166
+ margin-left: -30px;
167
+ width: 60px;
168
+ height: 75px;
169
+ background: rgba(20, 20, 20, .1);
170
+ box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1);
171
+ border-radius: 30px / 40px;
172
+ -webkit-animation-timing-function: ease-in;
173
+ }
174
+ 100% {
175
+ bottom: 30px;
176
+ margin-left: -10px;
177
+ width: 20px;
178
+ height: 5px;
179
+ background: rgba(20, 20, 20, .3);
180
+ box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3);
181
+ border-radius: 20px / 20px;
182
+ -webkit-animation-timing-function: ease-out;
183
+ }
184
+ }
185
+
186
+ @-moz-keyframes pace-compress {
187
+ 0% {
188
+ bottom: 0;
189
+ margin-left: -30px;
190
+ width: 60px;
191
+ height: 75px;
192
+ background: rgba(20, 20, 20, .1);
193
+ box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1);
194
+ border-radius: 30px / 40px;
195
+ -moz-animation-timing-function: ease-in;
196
+ }
197
+ 100% {
198
+ bottom: 30px;
199
+ margin-left: -10px;
200
+ width: 20px;
201
+ height: 5px;
202
+ background: rgba(20, 20, 20, .3);
203
+ box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3);
204
+ border-radius: 20px / 20px;
205
+ -moz-animation-timing-function: ease-out;
206
+ }
207
+ }
208
+
209
+ @keyframes pace-compress {
210
+ 0% {
211
+ bottom: 0;
212
+ margin-left: -30px;
213
+ width: 60px;
214
+ height: 75px;
215
+ background: rgba(20, 20, 20, .1);
216
+ box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1);
217
+ border-radius: 30px / 40px;
218
+ animation-timing-function: ease-in;
219
+ }
220
+ 100% {
221
+ bottom: 30px;
222
+ margin-left: -10px;
223
+ width: 20px;
224
+ height: 5px;
225
+ background: rgba(20, 20, 20, .3);
226
+ box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3);
227
+ border-radius: 20px / 20px;
228
+ animation-timing-function: ease-out;
229
+ }
230
+ }
@@ -0,0 +1,69 @@
1
+ .pace {
2
+ -webkit-pointer-events: none;
3
+ pointer-events: none;
4
+ -webkit-user-select: none;
5
+ -moz-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+ .pace .pace-activity {
10
+ display: block;
11
+ position: fixed;
12
+ z-index: 2000;
13
+ top: 0;
14
+ right: 0;
15
+ width: 300px;
16
+ height: 300px;
17
+ background: #29d;
18
+ -webkit-transition: -webkit-transform 0.3s;
19
+ transition: transform 0.3s;
20
+ -webkit-transform: translateX(100%) translateY(-100%) rotate(45deg);
21
+ transform: translateX(100%) translateY(-100%) rotate(45deg);
22
+ pointer-events: none;
23
+ }
24
+
25
+ .pace.pace-active .pace-activity {
26
+ -webkit-transform: translateX(50%) translateY(-50%) rotate(45deg);
27
+ transform: translateX(50%) translateY(-50%) rotate(45deg);
28
+ }
29
+
30
+ .pace .pace-activity::before,
31
+ .pace .pace-activity::after {
32
+ position: absolute;
33
+ bottom: 30px;
34
+ left: 50%;
35
+ display: block;
36
+ border: 5px solid #fff;
37
+ border-radius: 50%;
38
+ content: '';
39
+ }
40
+
41
+ .pace .pace-activity::before {
42
+ margin-left: -40px;
43
+ width: 80px;
44
+ height: 80px;
45
+ border-right-color: rgba(0, 0, 0, .2);
46
+ border-left-color: rgba(0, 0, 0, .2);
47
+ -webkit-animation: pace-rotation 3s linear infinite;
48
+ animation: pace-rotation 3s linear infinite;
49
+ }
50
+
51
+ .pace .pace-activity::after {
52
+ bottom: 50px;
53
+ margin-left: -20px;
54
+ width: 40px;
55
+ height: 40px;
56
+ border-top-color: rgba(0, 0, 0, .2);
57
+ border-bottom-color: rgba(0, 0, 0, .2);
58
+ -webkit-animation: pace-rotation 1s linear infinite;
59
+ animation: pace-rotation 1s linear infinite;
60
+ }
61
+
62
+ @-webkit-keyframes pace-rotation {
63
+ 0% { -webkit-transform: rotate(0deg); }
64
+ 100% { -webkit-transform: rotate(359deg); }
65
+ }
66
+ @keyframes pace-rotation {
67
+ 0% { transform: rotate(0deg); }
68
+ 100% { transform: rotate(359deg); }
69
+ }
@@ -0,0 +1,16 @@
1
+ .pace {
2
+ -webkit-pointer-events: none;
3
+ pointer-events: none;
4
+ -webkit-user-select: none;
5
+ -moz-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+ .pace .pace-progress {
10
+ background-color: rgba(0, 0, 0, 0.19999999999999996);
11
+ position: fixed;
12
+ z-index: -1;
13
+ top: 0;
14
+ left: 0;
15
+ bottom: 0;
16
+ }
@@ -0,0 +1,75 @@
1
+ .pace {
2
+ -webkit-pointer-events: none;
3
+ pointer-events: none;
4
+ -webkit-user-select: none;
5
+ -moz-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+ .pace-inactive {
10
+ display: none;
11
+ }
12
+
13
+ .pace .pace-progress {
14
+ background: #29d;
15
+ position: fixed;
16
+ z-index: 2000;
17
+ top: 0;
18
+ left: 0;
19
+ height: 2px;
20
+ }
21
+
22
+ .pace .pace-progress-inner {
23
+ display: block;
24
+ position: absolute;
25
+ right: 0px;
26
+ width: 100px;
27
+ height: 100%;
28
+ box-shadow: 0 0 10px #29d, 0 0 5px #29d;
29
+ opacity: 1.0;
30
+ -webkit-transform: rotate(3deg) translate(0px, -4px);
31
+ -moz-transform: rotate(3deg) translate(0px, -4px);
32
+ -ms-transform: rotate(3deg) translate(0px, -4px);
33
+ -o-transform: rotate(3deg) translate(0px, -4px);
34
+ transform: rotate(3deg) translate(0px, -4px);
35
+ }
36
+
37
+ .pace .pace-activity {
38
+ display: block;
39
+ position: fixed;
40
+ z-index: 2000;
41
+ top: 15px;
42
+ right: 15px;
43
+ width: 14px;
44
+ height: 14px;
45
+ border: solid 2px transparent;
46
+ border-top-color: #29d;
47
+ border-left-color: #29d;
48
+ border-radius: 10px;
49
+ -webkit-animation: pace-spinner 400ms linear infinite;
50
+ -moz-animation: pace-spinner 400ms linear infinite;
51
+ -ms-animation: pace-spinner 400ms linear infinite;
52
+ -o-animation: pace-spinner 400ms linear infinite;
53
+ animation: pace-spinner 400ms linear infinite;
54
+ }
55
+
56
+ @-webkit-keyframes pace-spinner {
57
+ 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
58
+ 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
59
+ }
60
+ @-moz-keyframes pace-spinner {
61
+ 0% { -moz-transform: rotate(0deg); transform: rotate(0deg); }
62
+ 100% { -moz-transform: rotate(360deg); transform: rotate(360deg); }
63
+ }
64
+ @-o-keyframes pace-spinner {
65
+ 0% { -o-transform: rotate(0deg); transform: rotate(0deg); }
66
+ 100% { -o-transform: rotate(360deg); transform: rotate(360deg); }
67
+ }
68
+ @-ms-keyframes pace-spinner {
69
+ 0% { -ms-transform: rotate(0deg); transform: rotate(0deg); }
70
+ 100% { -ms-transform: rotate(360deg); transform: rotate(360deg); }
71
+ }
72
+ @keyframes pace-spinner {
73
+ 0% { transform: rotate(0deg); transform: rotate(0deg); }
74
+ 100% { transform: rotate(360deg); transform: rotate(360deg); }
75
+ }
@@ -0,0 +1,27 @@
1
+ .pace {
2
+ -webkit-pointer-events: none;
3
+ pointer-events: none;
4
+ -webkit-user-select: none;
5
+ -moz-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+ .pace .pace-progress {
10
+ display: block;
11
+ position: fixed;
12
+ z-index: 2000;
13
+ top: 0;
14
+ left: 0;
15
+ height: 12px;
16
+ background: #29d;
17
+ -webkit-transition: -webkit-transform 0.3s;
18
+ transition: transform 0.3s;
19
+ -webkit-transform: translateY(-50px);
20
+ transform: translateY(-50px);
21
+ pointer-events: none;
22
+ }
23
+
24
+ .pace.pace-active .pace-progress {
25
+ -webkit-transform: translateY(0);
26
+ transform: translateY(0);
27
+ }
@@ -0,0 +1,76 @@
1
+ .pace {
2
+ -webkit-pointer-events: none;
3
+ pointer-events: none;
4
+ -webkit-user-select: none;
5
+ -moz-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+ .pace-inactive {
10
+ display: none;
11
+ }
12
+
13
+ .pace .pace-progress {
14
+ background-color: #78c0f0;
15
+
16
+ color: #CBE7F9;
17
+ position: fixed;
18
+ z-index: 2000;
19
+ top: 0;
20
+ left: 0;
21
+ height: 12px;
22
+ overflow: hidden;
23
+ -webkit-border-radius: 0 0 4px 0;
24
+ -moz-border-radius: 0 0 4px 0;
25
+ -o-border-radius: 0 0 4px 0;
26
+ border-radius: 0 0 4px 0;
27
+ -webkit-box-shadow: inset -1px 0 rgba(0, 0, 0, 0.3), inset 0 -1px rgba(0, 0, 0, 0.3), inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, 0.3);
28
+ -moz-box-shadow: inset -1px 0 rgba(0, 0, 0, 0.3), inset 0 -1px rgba(0, 0, 0, 0.3), inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, 0.3);
29
+ -o-box-shadow: inset -1px 0 rgba(0, 0, 0, 0.3), inset 0 -1px rgba(0, 0, 0, 0.3), inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, 0.3);
30
+ box-shadow: inset -1px 0 rgba(0, 0, 0, 0.3), inset 0 -1px rgba(0, 0, 0, 0.3), inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, 0.3);
31
+ }
32
+
33
+ .pace .pace-progress-inner {
34
+ position: absolute;
35
+ top: 0;
36
+ left: 0;
37
+ right: -28px;
38
+ bottom: 0;
39
+
40
+ background-image: -o-radial-gradient(rgba(25, 147, 228, 0.6) 0%, rgba(120, 192, 240, 0) 100%);
41
+ background-image: -moz-radial-gradient(rgba(25, 147, 228, 0.6) 0%, rgba(120, 192, 240, 0) 100%);
42
+ background-image: -webkit-radial-gradient(rgba(25, 147, 228, 0.6) 0%, rgba(120, 192, 240, 0) 100%);
43
+ background-image: radial-gradient(rgba(25, 147, 228, 0.6) 0%, rgba(120, 192, 240, 0) 100%);
44
+
45
+
46
+ -webkit-background-size: 28px 100%;
47
+ -moz-background-size: 28px 100%;
48
+ -o-background-size: 28px 100%;
49
+ background-size: 28px 100%;
50
+ -webkit-animation: pace-stripe-animation 500ms linear infinite;
51
+ -moz-animation: pace-stripe-animation 500ms linear infinite;
52
+ -ms-animation: pace-stripe-animation 500ms linear infinite;
53
+ -o-animation: pace-stripe-animation 500ms linear infinite;
54
+ animation: pace-stripe-animation 500ms linear infinite;
55
+ }
56
+
57
+ @-webkit-keyframes pace-stripe-animation {
58
+ 0% { -webkit-transform: none; transform: none; }
59
+ 100% { -webkit-transform: translate(-28px, 0); transform: translate(-28px, 0); }
60
+ }
61
+ @-moz-keyframes pace-stripe-animation {
62
+ 0% { -moz-transform: none; transform: none; }
63
+ 100% { -moz-transform: translate(-28px, 0); transform: translate(-28px, 0); }
64
+ }
65
+ @-o-keyframes pace-stripe-animation {
66
+ 0% { -o-transform: none; transform: none; }
67
+ 100% { -o-transform: translate(-28px, 0); transform: translate(-28px, 0); }
68
+ }
69
+ @-ms-keyframes pace-stripe-animation {
70
+ 0% { -ms-transform: none; transform: none; }
71
+ 100% { -ms-transform: translate(-28px, 0); transform: translate(-28px, 0); }
72
+ }
73
+ @keyframes pace-stripe-animation {
74
+ 0% { transform: none; transform: none; }
75
+ 100% { transform: translate(-28px, 0); transform: translate(-28px, 0); }
76
+ }
@@ -0,0 +1,12 @@
1
+ .pace .pace-progress {
2
+ background: #29d;
3
+ position: fixed;
4
+ z-index: 2000;
5
+ top: 0;
6
+ left: 0;
7
+ height: 2px;
8
+ }
9
+
10
+ .pace-inactive {
11
+ display: none;
12
+ }
@@ -1,5 +1,5 @@
1
1
  module Pace
2
2
  module Rails
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pace-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Vera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-20 00:00:00.000000000 Z
11
+ date: 2013-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -50,6 +50,16 @@ files:
50
50
  - LICENSE.txt
51
51
  - README.md
52
52
  - Rakefile
53
+ - app/assets/javascripts/pace/pace.js
54
+ - app/assets/stylesheets/pace/barber-shop.css
55
+ - app/assets/stylesheets/pace/big-counter.css
56
+ - app/assets/stylesheets/pace/bounce.css
57
+ - app/assets/stylesheets/pace/corner-indicator.css
58
+ - app/assets/stylesheets/pace/fill-left.css
59
+ - app/assets/stylesheets/pace/flash.css
60
+ - app/assets/stylesheets/pace/flat-top.css
61
+ - app/assets/stylesheets/pace/mac-osx.css
62
+ - app/assets/stylesheets/pace/minimal.css
53
63
  - lib/pace/rails.rb
54
64
  - lib/pace/rails/version.rb
55
65
  - pace-rails.gemspec
@@ -73,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
83
  version: '0'
74
84
  requirements: []
75
85
  rubyforge_project:
76
- rubygems_version: 2.0.6
86
+ rubygems_version: 2.1.4
77
87
  signing_key:
78
88
  specification_version: 4
79
89
  summary: Pace automatic web page progress bar, integrated in Rails assets pipeline.