Skip to content

Instantly share code, notes, and snippets.

@ntarocco
Last active November 2, 2020 07:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntarocco/923e1fc547f68687782f12d7cce3ce0c to your computer and use it in GitHub Desktop.
Save ntarocco/923e1fc547f68687782f12d7cce3ce0c to your computer and use it in GitHub Desktop.
Bookmarklet for COVID "Attestation de déplacement dérogatoire", attestation generator in France (https://media.interieur.gouv.fr/deplacement-covid-19/)
Bookmarket (<https://en.wikipedia.org/wiki/Bookmarklet>) to autofill the form for sport. If you need for groceries, replace
document.getElementById('checkbox-sport_animaux').checked = true;
with
document.getElementById('checkbox-achats').checked = true;
Instructions:
1. fill in the values with your personal information
2. remove all spaces and new new lines to obtain one single line
3. create a new bookmark in your browser bookmark for the page https://media.interieur.gouv.fr/deplacement-covid-19/
4. edit the newly created bookmark and replace the URL of the bookmark with the one line JavaScript code below.
* In Firefox, right click on the bookmark, click on "Properties", change the "Location" field
* In Safari, right click on the bookmark, click on "Edit Address"
* In Chrome, right click on the bookmark, click on "Edit", change the "URL" field
javascript: {
/* dates: do not change */
var date = new Date();
var today = String(date.toISOString().slice(0, 10));
var hours = String(date.getHours()).padStart(2, '0');
var minutes = String(date.getMinutes()).padStart(2, '0');
/* //end-dates */
document.getElementById('field-firstname').value = '';
document.getElementById('field-lastname').value = '';
document.getElementById('field-birthday').value = '01/01/1980';
document.getElementById('field-placeofbirth').value = '';
document.getElementById('field-address').value = '';
document.getElementById('field-city').value = '';
document.getElementById('field-zipcode').value = '';
document.getElementById('field-datesortie').value = today;
document.getElementById('field-heuresortie').value = hours + ':' + minutes;
document.getElementById('checkbox-sport_animaux').checked = true;
document.getElementsByClassName('btn btn-primary btn-attestation')[0].click();
void(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment