drive 0.13.0 → 0.15.0
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/app/assets/javascripts/easy/flyer.js +1 -1
- data/app/assets/javascripts/easy/konami.js +68 -0
- data/app/assets/javascripts/easy/pin_code.js +43 -0
- data/app/assets/stylesheets/easy/components.css +5 -0
- data/app/views/easy/_flyer.html.erb +2 -1
- data/app/views/easy/_pin_code.html.erb +9 -0
- data/lib/drive/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e30f8466f1e9a247348f1139fc5e0d6715328efe23ade1017b278c332c51cb1
|
|
4
|
+
data.tar.gz: 0d56d490a3b5a791b62138e8643865691eba0f0fa527affd6cf593a7f295d133
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 050be52a55e1f0fb4ccd11f1c3d699ad85d1839795d6b49139c49c40e19e6ffd3586f57db85084bac38e8f2184cd5c97482a14aeb12d5a130c3ca944305ae0db
|
|
7
|
+
data.tar.gz: 64cf867baad5eb66436cdeecbae091597b5f8e21e397b1c4579d15a1000fcfa0ad07d301971b46e28fff8de9d9c4c06a3d6a281dd80fe24a9d09ed70742b68a4
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## 0.15.0 - 2026-11-06
|
|
10
|
+
|
|
11
|
+
* [FEATURE] `render "easy/pin_code", name:` (`id:`, `autofocus:`, `label:`) and `easy/pin_code.js`: the 6-digit code as
|
|
12
|
+
one real field drawn over six slots, the next one lit, its form submitted on the sixth digit, `is-invalid` cleared
|
|
13
|
+
by the next. easyfaa.com's sign-in dialog and aircraft gate drew it with a script of their own.
|
|
14
|
+
|
|
15
|
+
## 0.14.0 - 2026-11-06
|
|
16
|
+
|
|
17
|
+
* [FEATURE] `easy/konami.js`, the flyer's easter egg, included beside `easy/flyer`: the Konami code (↑ ↑ ↓ ↓ ← → ← → B
|
|
18
|
+
A, or on a phone swipes up, up, down, down, left, right, left, right and two taps) sets the plane free. It wanders the
|
|
19
|
+
window at random until it flies out, and never comes back in that browser (localStorage, per site).
|
|
20
|
+
|
|
9
21
|
## 0.13.0 - 2026-11-06
|
|
10
22
|
|
|
11
23
|
* [FEATURE] `i-twin-plane`, a twin engine, in the sprite beside `i-plane` and `i-small-plane`, for the flyer of
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
lines[i].setAttribute('points', points.join(' '));
|
|
91
91
|
fades[i].setAttribute('x2', Math.max(tailX, 1).toFixed(1));
|
|
92
92
|
}
|
|
93
|
-
window.requestAnimationFrame(frame);
|
|
93
|
+
if (sky.className.indexOf('is-gone') < 0) { window.requestAnimationFrame(frame); } // freed (easy/konami)
|
|
94
94
|
}
|
|
95
95
|
window.requestAnimationFrame(frame);
|
|
96
96
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// The easter egg of render "easy/flyer": the Konami code sets the plane free, ↑ ↑ ↓ ↓ ← → ← → B A on a keyboard,
|
|
2
|
+
// or on a phone swipes up, up, down, down, left, right, left, right and two taps. It leaves its wave, wanders the
|
|
3
|
+
// window at random until it flies out of it, and never comes back in this browser (localStorage, per site).
|
|
4
|
+
// Included with easy/flyer; where motion is turned off there is no plane, and nothing to free.
|
|
5
|
+
// ES5 alone: every easy app has to work on old iPhones, Androids and Windows browsers.
|
|
6
|
+
(function () {
|
|
7
|
+
if (!document.querySelectorAll || !document.addEventListener || !window.requestAnimationFrame) { return; }
|
|
8
|
+
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) { return; }
|
|
9
|
+
var GONE = 'easy-plane-gone', CODES = ['UUDDLRLRBA', 'UUDDLRLRTT'];
|
|
10
|
+
var KEYS = { 38: 'U', 40: 'D', 37: 'L', 39: 'R', 66: 'B', 65: 'A' };
|
|
11
|
+
var skies = document.querySelectorAll('.js-sky'), typed = '', start = null, freed = false;
|
|
12
|
+
|
|
13
|
+
// A sky gone keeps no plane, and its trail fades; easy/flyer stops drawing it.
|
|
14
|
+
function gone() { for (var i = 0; i < skies.length; i++) { skies[i].className += ' is-gone'; } }
|
|
15
|
+
try { if (window.localStorage.getItem(GONE)) { gone(); return; } } catch (err) { /* no storage: it comes back */ }
|
|
16
|
+
|
|
17
|
+
// The plane, out of its sky and over the window, where it was and heading as it was: at 160px a second, it turns
|
|
18
|
+
// one way then the other, never sharper than a loop in three seconds, until it is past an edge.
|
|
19
|
+
function fly(flyer) {
|
|
20
|
+
var box = flyer.getBoundingClientRect(), plane = flyer.cloneNode(true), size = 34;
|
|
21
|
+
var rotation = /rotate\((-?[\d.]+)deg\)/.exec(flyer.style.transform || '');
|
|
22
|
+
var x = box.left + box.width / 2 - size / 2, y = box.top + box.height / 2 - size / 2;
|
|
23
|
+
var heading = rotation ? rotation[1] * Math.PI / 180 : 0, turn = 0, last = null;
|
|
24
|
+
if (!box.width) { return; }
|
|
25
|
+
function place() {
|
|
26
|
+
var move = 'translate(' + x.toFixed(1) + 'px,' + y.toFixed(1) + 'px) rotate(' + (heading * 180 / Math.PI).toFixed(1) + 'deg)';
|
|
27
|
+
plane.style.webkitTransform = move; plane.style.transform = move;
|
|
28
|
+
}
|
|
29
|
+
plane.className = 'flyer is-free';
|
|
30
|
+
place();
|
|
31
|
+
document.body.appendChild(plane);
|
|
32
|
+
function frame(now) {
|
|
33
|
+
var dt = last === null ? 16 : Math.min(now - last, 50);
|
|
34
|
+
last = now;
|
|
35
|
+
turn = Math.max(-0.002, Math.min(0.002, turn + (Math.random() - 0.5) * 0.00002 * dt));
|
|
36
|
+
heading += turn * dt;
|
|
37
|
+
x += Math.cos(heading) * 0.16 * dt; y += Math.sin(heading) * 0.16 * dt;
|
|
38
|
+
place();
|
|
39
|
+
if (x < -size || y < -size || x > window.innerWidth || y > window.innerHeight) { return document.body.removeChild(plane); }
|
|
40
|
+
window.requestAnimationFrame(frame);
|
|
41
|
+
}
|
|
42
|
+
window.requestAnimationFrame(frame);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function free() {
|
|
46
|
+
try { window.localStorage.setItem(GONE, '1'); } catch (err) { /* no storage: it comes back */ }
|
|
47
|
+
for (var i = 0; i < skies.length; i++) { fly(skies[i].querySelector('.js-flyer')); }
|
|
48
|
+
gone();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function push(symbol) {
|
|
52
|
+
typed = (typed + symbol).slice(-10);
|
|
53
|
+
if (!freed && (typed === CODES[0] || typed === CODES[1])) { freed = true; free(); }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
document.addEventListener('keydown', function (event) { push(KEYS[event.keyCode] || '-'); });
|
|
57
|
+
// A swipe is its longer way, 30px at least; a touch that hardly moved is a tap.
|
|
58
|
+
document.addEventListener('touchstart', function (event) {
|
|
59
|
+
start = event.touches.length === 1 ? { x: event.touches[0].clientX, y: event.touches[0].clientY } : null;
|
|
60
|
+
}, { passive: true });
|
|
61
|
+
document.addEventListener('touchend', function (event) {
|
|
62
|
+
if (!start) { return; }
|
|
63
|
+
var dx = event.changedTouches[0].clientX - start.x, dy = event.changedTouches[0].clientY - start.y;
|
|
64
|
+
var far = Math.max(Math.abs(dx), Math.abs(dy));
|
|
65
|
+
if (far < 10) { push('T'); } else if (far < 30) { push('-'); } else if (Math.abs(dx) > Math.abs(dy)) { push(dx > 0 ? 'R' : 'L'); } else { push(dy > 0 ? 'D' : 'U'); }
|
|
66
|
+
start = null;
|
|
67
|
+
}, { passive: true });
|
|
68
|
+
})();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// The 6-digit code of render "easy/pin_code": its six slots show what its one real field holds, the next one to fill
|
|
2
|
+
// lit, and six digits submit the form without a click, typed, pasted or offered by the phone from the email. A field
|
|
3
|
+
// the page empties redraws on an input event; a code refused is the page's to mark, is-invalid on the .pin-code,
|
|
4
|
+
// which the next digit clears. A .pin-code already drawn is left alone, so including the script twice is harmless.
|
|
5
|
+
// ES5 alone: every easy app has to work on old iPhones, Androids and Windows browsers.
|
|
6
|
+
(function () {
|
|
7
|
+
if (!document.querySelectorAll || !document.addEventListener) { return; }
|
|
8
|
+
|
|
9
|
+
// The form's own submit, so its handlers run first: requestSubmit, or an old browser's submit event.
|
|
10
|
+
function submit(form) {
|
|
11
|
+
if (form.requestSubmit) { form.requestSubmit(); return; }
|
|
12
|
+
var event = document.createEvent('Event');
|
|
13
|
+
event.initEvent('submit', true, true);
|
|
14
|
+
if (form.dispatchEvent(event)) { form.submit(); }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function drawn(pin) {
|
|
18
|
+
var input = pin.querySelector('.pin-code-input'), slots = pin.querySelectorAll('.pin-code-slots span');
|
|
19
|
+
function draw() {
|
|
20
|
+
var value = input.value.replace(/\D/g, '').slice(0, 6), focused = document.activeElement === input;
|
|
21
|
+
if (value !== input.value) { input.value = value; }
|
|
22
|
+
for (var i = 0; i < slots.length; i++) {
|
|
23
|
+
slots[i].textContent = value.charAt(i);
|
|
24
|
+
slots[i].className = focused && i === Math.min(value.length, 5) ? 'is-active' : '';
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
input.addEventListener('input', function () {
|
|
29
|
+
pin.className = pin.className.replace(/\s*\bis-invalid\b/g, '');
|
|
30
|
+
input.removeAttribute('aria-invalid');
|
|
31
|
+
if (draw().length === 6 && input.form) { submit(input.form); }
|
|
32
|
+
});
|
|
33
|
+
input.addEventListener('focus', draw);
|
|
34
|
+
input.addEventListener('blur', draw);
|
|
35
|
+
pin.className += ' is-drawn';
|
|
36
|
+
draw();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var pins = document.querySelectorAll('.pin-code');
|
|
40
|
+
for (var i = 0; i < pins.length; i++) {
|
|
41
|
+
if (!/\bis-drawn\b/.test(pins[i].className)) { drawn(pins[i]); }
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
@@ -363,3 +363,8 @@ a.tooltip-trigger:hover,a.tooltip-trigger:focus{box-shadow:0 0 0 2px currentColo
|
|
|
363
363
|
.flyer{position:absolute;top:0;left:0;color:var(--color-sky);opacity:.8;-webkit-transform-origin:17px 17px;transform-origin:17px 17px}
|
|
364
364
|
.flyer .i{display:block;width:34px;height:34px;-webkit-transform:rotate(90deg);transform:rotate(90deg)}
|
|
365
365
|
@media (prefers-reduced-motion: reduce){.has-js .sky{display:none}}
|
|
366
|
+
/* The plane set free by easy/konami: over the window, the header too, its sky left empty and its trail fading. */
|
|
367
|
+
.flyer.is-free{position:fixed;z-index:30}
|
|
368
|
+
.sky .trail{-webkit-transition:opacity 1.2s;transition:opacity 1.2s}
|
|
369
|
+
.sky.is-gone .trail{opacity:0}
|
|
370
|
+
.sky.is-gone .flyer{visibility:hidden}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<%# locals: (plane:, date: nil) -%>
|
|
2
|
-
<%# A plane crossing the sky behind a hero, its trail behind it, flown by easy/flyer.js, which the page includes once
|
|
2
|
+
<%# A plane crossing the sky behind a hero, its trail behind it, flown by easy/flyer.js, which the page includes once,
|
|
3
|
+
with easy/konami.js, its easter egg.
|
|
3
4
|
plane: its icon in the sprite, "plane" (easyFAA's airliner), "small-plane" (easyAnnual's single engine) or
|
|
4
5
|
"twin-plane" (easyFAA's accidents' twin engine).
|
|
5
6
|
date: "2026-12-25", the day to fly on instead of the visitor's today, to see a holiday's colors. -%>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%# locals: (name:, id: nil, autofocus: false, label: "6-digit code") -%>
|
|
2
|
+
<%# The 6-digit code emailed to sign in or to sign: one real field, so a pasted or autofilled code lands whole, drawn
|
|
3
|
+
over six slots by easy/pin_code.js, which the page includes once; without the script, the field itself shows.
|
|
4
|
+
name: the field's, "sign_in[pin]"; a code refused is the page's to mark, is-invalid on the .pin-code. -%>
|
|
5
|
+
<div class="pin-code">
|
|
6
|
+
<%= tag.input type: "text", name:, id:, class: "pin-code-input", required: true, autofocus:, autocomplete: "one-time-code",
|
|
7
|
+
inputmode: "numeric", pattern: "[0-9]{6}", maxlength: 6, aria: { label: } %>
|
|
8
|
+
<div class="pin-code-slots" aria-hidden="true"><span></span><span></span><span></span><span></span><span></span><span></span></div>
|
|
9
|
+
</div>
|
data/lib/drive/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: drive
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- claudiob
|
|
@@ -38,6 +38,8 @@ files:
|
|
|
38
38
|
- app/assets/fonts/easy/outfit-latin.woff2
|
|
39
39
|
- app/assets/images/easy/sprite.svg
|
|
40
40
|
- app/assets/javascripts/easy/flyer.js
|
|
41
|
+
- app/assets/javascripts/easy/konami.js
|
|
42
|
+
- app/assets/javascripts/easy/pin_code.js
|
|
41
43
|
- app/assets/javascripts/easy/rotating_placeholder.js
|
|
42
44
|
- app/assets/stylesheets/easy/base.css
|
|
43
45
|
- app/assets/stylesheets/easy/components.css
|
|
@@ -52,6 +54,7 @@ files:
|
|
|
52
54
|
- app/models/serial.rb
|
|
53
55
|
- app/views/drive/errors/show.html.erb
|
|
54
56
|
- app/views/easy/_flyer.html.erb
|
|
57
|
+
- app/views/easy/_pin_code.html.erb
|
|
55
58
|
- app/views/layouts/drive/errors.html.erb
|
|
56
59
|
- app/views/layouts/easy/site.html.erb
|
|
57
60
|
- lib/drive.rb
|