diff --git a/_locales/de/messages.json b/_locales/de/messages.json
index a33f342..d109a78 100644
--- a/_locales/de/messages.json
+++ b/_locales/de/messages.json
@@ -35,6 +35,10 @@
"message": "Auffrischimpfung",
"description": "Text der alle Auffrischimpfungen beschreibt."
},
+ "maxDateLabel": {
+ "message": "Termin finden bis zum (DD. MM. YYYY)",
+ "description": "Bis zu diesem Datum wird nach einem Termin gesucht"
+ },
"modernaVaccine": {
"message": "Moderna Impfstoff",
"description": "Beschreibung des Moderna Impfstoffes."
diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json
index ba30b22..c282c6e 100644
--- a/_locales/fr/messages.json
+++ b/_locales/fr/messages.json
@@ -35,6 +35,10 @@
"message": "Troisième dose",
"description": "Text qui décrit une injection de rappel au dela de la deuxième dose."
},
+" maxDateLabel": {
+ "message": "Date maximale de recherche (MM/DD/YYYY)",
+ "description": "Date jusqu'à laquelle un rdv sera cherché"
+ },
"modernaVaccine": {
"message": "Vaccin Moderna",
"description": "Text qui décrit un vaccin Moderna."
diff --git a/browser_action/index.html b/browser_action/index.html
index e1ea499..aa6493e 100644
--- a/browser_action/index.html
+++ b/browser_action/index.html
@@ -98,7 +98,9 @@
diff --git a/browser_action/index.js b/browser_action/index.js
index dec278a..20e7152 100644
--- a/browser_action/index.js
+++ b/browser_action/index.js
@@ -107,7 +107,7 @@
/** @param {Date} dateMaxSearch La date maximale de recherche de rdv */
function displayDateMaxSearch(dateMaxSearch) {
const date = new Date(dateMaxSearch);
- document.getElementById('dateMax').value = date.toISOString().split('T')[0]
+ document.getElementById("dateMax").value = date.toISOString().split("T")[0];
}
// Preparation des données
@@ -157,8 +157,10 @@
appStatus.setInjectionVaccine.bind(appStatus, "modernaInjection");
document.getElementById("pfizerInjection").onclick =
appStatus.setInjectionVaccine.bind(appStatus, "pfizerInjection");
- document.getElementById("dateMax").onblur =
- appStatus.setDateMaxSearch.bind(appStatus, document.getElementById('dateMax'));
+ document.getElementById("dateMax").onblur = appStatus.setDateMaxSearch.bind(
+ appStatus,
+ document.getElementById("dateMax")
+ );
document.getElementById("reset").onclick = () => {
if (
diff --git a/commons/AppStatus.js b/commons/AppStatus.js
index 01b91f5..379e123 100644
--- a/commons/AppStatus.js
+++ b/commons/AppStatus.js
@@ -23,7 +23,11 @@ class AppStatus {
/** @type {'modernaInjection' | 'pfizerInjection'} vaccin d'injection souhaité par le user */
this.injectionVaccine = "pfizerInjection";
/** @type {Date} Date max de recherche de rdv (par défaut aujd + 1 mois) */
- this.dateMaxSearch = new Date((new Date()).getFullYear()+1, (new Date()).getMonth(), (new Date()).getDate());
+ this.dateMaxSearch = new Date(
+ new Date().getFullYear() + 1,
+ new Date().getMonth(),
+ new Date().getDate()
+ );
/** @type {(string) => void} callback quand une {@link VaccineLocation} a été ajouté */
this.onLocationAddedCb = (job) => {};
/** @type {(string) => void} callback quand une {@link VaccineLocation} a été supprimée */
@@ -53,7 +57,11 @@ class AppStatus {
autoBook: false,
injectionType: "fullServiceInjection",
injectionVaccine: "pfizerInjection",
- dateMaxSearch: new Date((new Date()).getFullYear()+1, (new Date()).getMonth(), (new Date()).getDate()),
+ dateMaxSearch: new Date(
+ new Date().getFullYear() + 1,
+ new Date().getMonth(),
+ new Date().getDate()
+ ),
});
Object.keys(result.locations).forEach((url) => {
@@ -187,7 +195,6 @@ class AppStatus {
browser.storage.sync.set({ injectionType: this.injectionType });
}
-
/**
* @param {Date} value The new dateMaxSearch value
*/
@@ -221,7 +228,11 @@ class AppStatus {
this.onInjectionTypeCb(this.injectionType);
this.injectionVaccine = "pfizerInjection";
this.onInjectionTypeCb(this.injectionVaccine);
- this.dateMaxSearch = new Date((new Date()).getFullYear(), (new Date()).getMonth()+1, (new Date()).getDate());
+ this.dateMaxSearch = new Date(
+ new Date().getFullYear() + 1,
+ new Date().getMonth(),
+ new Date().getDate()
+ );
this.onDateMaxSearchCb(this.dateMaxSearch);
}
diff --git a/content_scripts/doctolib/book.js b/content_scripts/doctolib/book.js
index c183c4d..9d36ecc 100644
--- a/content_scripts/doctolib/book.js
+++ b/content_scripts/doctolib/book.js
@@ -27,20 +27,6 @@
if (currentMonth > selectedMonth) return new Date().getFullYear() + 1;
return new Date().getFullYear();
}
- const MONTHS = {
- 'janv.': 1,
- 'févr.': 2,
- 'mars': 3,
- 'avr.': 4,
- 'mai': 5,
- 'juin': 6,
- 'juil.': 7,
- 'aout': 8,
- 'sept.': 9,
- 'oct.': 10,
- 'nov.': 11,
- 'déc.': 12,
- };
async function waitTimeout(timeout) {
await new Promise((r) => setTimeout(r, timeout));
@@ -309,17 +295,30 @@
let running = false;
async function checkAvailability() {
- const { locations, stopped, autoBook, injectionType, injectionVaccine, dateMaxSearch } =
- await browser.storage.sync.get({
- locations: {},
- stopped: false,
- autoBook: false,
- injectionType: "fullServiceInjection",
- injectionVaccine: "pfizerInjection",
- dateMaxSearch: new Date((new Date()).getFullYear()+1, (new Date()).getMonth(), (new Date()).getDate()),
- });
+ const {
+ locations,
+ stopped,
+ autoBook,
+ injectionType,
+ injectionVaccine,
+ dateMaxSearch,
+ } = await browser.storage.sync.get({
+ locations: {},
+ stopped: false,
+ autoBook: false,
+ injectionType: "fullServiceInjection",
+ injectionVaccine: "pfizerInjection",
+ dateMaxSearch: new Date(
+ new Date().getFullYear() + 1,
+ new Date().getMonth(),
+ new Date().getDate()
+ ),
+ });
- const dateMaxSearchDate = typeof(dateMaxSearch) === 'string' ? new Date(dateMaxSearch) : dateMaxSearch;
+ const dateMaxSearchDate =
+ typeof dateMaxSearch === "string"
+ ? new Date(dateMaxSearch)
+ : dateMaxSearch;
if (stopped || !locations[url]) {
running = false;
@@ -438,8 +437,6 @@
const parts = slot.title.match(
/([0-9]+)\.? ([\p{Letter}]+)\.? ([0-9]+:[0-9]+)/u
);
- // /([0-9]+) [\p{Letter}]+\.? ([0-9]+:[0-9]+)/gu
- // )[0].split(' ');
if (!parts) {
throw new Error(
browser.i18n.getMessage("slotDateFormatNotFound", slot.title)
@@ -453,14 +450,15 @@
const selectedTime = parts[3];
const date = new Date(
- `${selectedMonth} ${selectedDay} ${selectedYear} ${selectedTime}`);
+ `${selectedMonth} ${selectedDay} ${selectedYear} ${selectedTime}`
+ );
if (date > dateMaxSearchDate) {
const formatedDate = dateMaxSearchDate.toLocaleDateString();
throw new Error(
`Pas de créneau dispo d'ici demain soir ou avant le ${formatedDate}`
);
- }
+ }
if (!autoBook) {
browser.runtime.sendMessage({