diff --git a/CHANGELOG.md b/CHANGELOG.md index d63b862..9c3fe97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,3 +32,14 @@ - :pencil: add CONTRIBUTORS ### Changes - :pencil: change LICENCE ( #16 ) +## [1.1.2] - 2020-04-10 +### Added +- ♿ Increase contrast ratio hover link color (#29) +- ♿ Add landmarks roles to header, main and footer sections (#43) +- ♿ Add title to open stores link and add more explicit text (#44, #45) +- ♿ Expose aria-invalid field assistance technologies (#24) +- ✨ Add timestamp to generated pdf (#9) +- 💄 Don't use autocompletion for release date and time (#31) +- 💄 Add underline on hover links +### Fixes +- Fix Typo site.webmanifest (#52) diff --git a/src/certificate.js b/src/certificate.js index d8785eb..46f0778 100644 --- a/src/certificate.js +++ b/src/certificate.js @@ -88,13 +88,8 @@ function idealFontSize (font, text, maxWidth, minSize, defaultSize) { } async function generatePdf (profile, reasons) { - const generatedDate = new Date() - setDateNow(generatedDate) - const creationDate = `${day}/${month}/${year}` - - const hour = pad(generatedDate.getHours()) - const minute = pad(generatedDate.getMinutes()) - const creationHour = `${hour}h${minute}` + const creationDate = new Date().toLocaleDateString('fr-FR') + const creationHour = new Date().toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' }).replace(':', 'h') const { lastname, firstname, birthday, lieunaissance, address, zipcode, town, datesortie, heuresortie } = profile const releaseHours = String(heuresortie).substring(0, 2) @@ -223,6 +218,7 @@ if (isFacebookBrowser()) { function addSlash () { $('#field-birthday').value = $('#field-birthday').value.replace(/^(\d{2})$/g, '$1/') $('#field-birthday').value = $('#field-birthday').value.replace(/^(\d{2})\/(\d{2})$/g, '$1/$2/') + $('#field-birthday').value = $('#field-birthday').value.replace(/\/\//g, '/') } $('#field-birthday').onkeyup = function () { @@ -244,7 +240,9 @@ $('#generate-btn').addEventListener('click', async event => { const reasons = getAndSaveReasons() const pdfBlob = await generatePdf(getProfile(), reasons) localStorage.clear() - downloadBlob(pdfBlob, 'attestation.pdf') + const creationDate = new Date().toLocaleDateString('fr-CA') + const creationHour = new Date().toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' }).replace(':', '-') + downloadBlob(pdfBlob, `attestation-${creationDate}_${creationHour}.pdf`) snackbar.classList.remove('d-none') setTimeout(() => snackbar.classList.add('show'), 100) @@ -268,6 +266,60 @@ $$('input').forEach(input => { } }) +const conditions = { + '#field-firstname': { + condition: 'length', + }, + '#field-lastname': { + condition: 'length', + }, + '#field-birthday': { + condition: 'pattern', + pattern: /^([0][1-9]|[1-2][0-9]|30|31)\/([0][1-9]|10|11|12)\/(19[0-9][0-9]|20[0-1][0-9]|2020)/g + }, + '#field-lieunaissance': { + condition: 'length', + }, + '#field-address': { + condition: 'length', + }, + '#field-town': { + condition: 'length', + }, + '#field-zipcode': { + condition: 'pattern', + pattern: /\d{5}/g + }, + '#field-datesortie': { + condition: 'pattern', + pattern: /\d{4}-\d{2}-\d{2}/g + }, + '#field-heuresortie': { + condition: 'pattern', + pattern: /\d{2}:\d{2}/g + } +} + +Object.keys(conditions).forEach(field => { + $(field).addEventListener('input', () => { + if (conditions[field].condition == 'pattern') { + const pattern = conditions[field].pattern; + if ($(field).value.match(pattern)) { + $(field).setAttribute('aria-invalid', "false"); + } else { + $(field).setAttribute('aria-invalid', "true"); + } + } + if (conditions[field].condition == 'length') { + if ($(field).value.length > 0) { + $(field).setAttribute('aria-invalid', "false"); + } else { + $(field).setAttribute('aria-invalid', "true"); + } + } + }) +}) + function addVersion () { document.getElementById('version').innerHTML = `${new Date().getFullYear()} - ${process.env.VERSION}` } diff --git a/src/favicons/apple-touch-icon-120x120-precomposed.png b/src/favicons/apple-touch-icon-120x120-precomposed.png new file mode 100644 index 0000000..b40c2e2 Binary files /dev/null and b/src/favicons/apple-touch-icon-120x120-precomposed.png differ diff --git a/src/favicons/apple-touch-icon-120x120.png b/src/favicons/apple-touch-icon-120x120.png new file mode 100644 index 0000000..b40c2e2 Binary files /dev/null and b/src/favicons/apple-touch-icon-120x120.png differ diff --git a/src/favicons/apple-touch-icon-precomposed.png b/src/favicons/apple-touch-icon-precomposed.png new file mode 100644 index 0000000..7e93fe3 Binary files /dev/null and b/src/favicons/apple-touch-icon-precomposed.png differ diff --git a/src/favicons/apple-touch-icon.png b/src/favicons/apple-touch-icon.png index 1874633..7e93fe3 100644 Binary files a/src/favicons/apple-touch-icon.png and b/src/favicons/apple-touch-icon.png differ diff --git a/src/favicons/favicon.ico b/src/favicons/favicon.ico new file mode 100644 index 0000000..26cee48 Binary files /dev/null and b/src/favicons/favicon.ico differ diff --git a/src/favicons/site.webmanifest b/src/favicons/site.webmanifest index 3d9f8a7..6b1f870 100644 --- a/src/favicons/site.webmanifest +++ b/src/favicons/site.webmanifest @@ -1,7 +1,7 @@ { "name": "Générateur d'attestation de déplacement dérogatoire", "short_name": "Déplacement covid-19", - "desctiption": "L'application officielle du gouvernement pour la génération d'attestation de déplacement dérogatoire dématérialisée.", + "description": "L'application officielle du gouvernement pour la génération d'attestation de déplacement dérogatoire dématérialisée.", "categories": ["government", "health"], "lang": "fr-FR", "icons": [ @@ -14,6 +14,26 @@ "src": "android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" + }, + { + "src": "apple-touch-icon.png", + "sizes": "180x180", + "type": "image/png" + }, + { + "src": "apple-touch-icon-precomposed.png", + "sizes": "180x180", + "type": "image/png" + }, + { + "src": "apple-touch-icon-120x120.png", + "sizes": "120x120", + "type": "image/png" + }, + { + "src": "apple-touch-icon-120x120-precomposed.png", + "sizes": "120x120", + "type": "image/png" } ], "orientation": "portrait-primary", diff --git a/src/index.html b/src/index.html index 73191a0..64408ed 100644 --- a/src/index.html +++ b/src/index.html @@ -29,7 +29,7 @@