drive 0.14.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 +6 -0
- data/app/assets/javascripts/easy/pin_code.js +43 -0
- data/app/views/easy/_pin_code.html.erb +9 -0
- data/lib/drive/version.rb +1 -1
- metadata +3 -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,12 @@ 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
|
+
|
|
9
15
|
## 0.14.0 - 2026-11-06
|
|
10
16
|
|
|
11
17
|
* [FEATURE] `easy/konami.js`, the flyer's easter egg, included beside `easy/flyer`: the Konami code (↑ ↑ ↓ ↓ ← → ← → B
|
|
@@ -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
|
+
})();
|
|
@@ -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
|
|
@@ -39,6 +39,7 @@ files:
|
|
|
39
39
|
- app/assets/images/easy/sprite.svg
|
|
40
40
|
- app/assets/javascripts/easy/flyer.js
|
|
41
41
|
- app/assets/javascripts/easy/konami.js
|
|
42
|
+
- app/assets/javascripts/easy/pin_code.js
|
|
42
43
|
- app/assets/javascripts/easy/rotating_placeholder.js
|
|
43
44
|
- app/assets/stylesheets/easy/base.css
|
|
44
45
|
- app/assets/stylesheets/easy/components.css
|
|
@@ -53,6 +54,7 @@ files:
|
|
|
53
54
|
- app/models/serial.rb
|
|
54
55
|
- app/views/drive/errors/show.html.erb
|
|
55
56
|
- app/views/easy/_flyer.html.erb
|
|
57
|
+
- app/views/easy/_pin_code.html.erb
|
|
56
58
|
- app/views/layouts/drive/errors.html.erb
|
|
57
59
|
- app/views/layouts/easy/site.html.erb
|
|
58
60
|
- lib/drive.rb
|