Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c72a20878 | |||
| 4f83907506 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "not-a-rescheduler",
|
"name": "not-a-rescheduler",
|
||||||
"version": "0.0.5",
|
"version": "0.0.7",
|
||||||
"permissions": [ "storage", "tabs", "activeTab", "notifications", "declarativeContent" ],
|
"permissions": [ "storage", "tabs", "activeTab", "notifications", "declarativeContent" ],
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -148,21 +148,19 @@ function smoothTextChange(element, newText) {
|
|||||||
consCfg[c].autoBook = e.target.checked;
|
consCfg[c].autoBook = e.target.checked;
|
||||||
await chrome.storage.local.set({ "cfg_consulates": consCfg });
|
await chrome.storage.local.set({ "cfg_consulates": consCfg });
|
||||||
});
|
});
|
||||||
|
|
||||||
// update current & best dates
|
// update current & best dates
|
||||||
chrome.storage.onChanged.addListener((changes, area) => {
|
chrome.storage.onChanged.addListener((changes, area) => {
|
||||||
if (changes.ctx_consulates) {
|
if (changes.ctx_consulates) {
|
||||||
const newConsulates = changes.ctx_consulates.newValue;
|
let newCurrentDate = changes.ctx_consulates.newValue[c].currentDate || "-";
|
||||||
|
let newBestDate = changes.ctx_consulates.newValue[c].bestDate || "-";
|
||||||
|
|
||||||
if (newConsulates[c].currentDate) {
|
let el = document.getElementById(`currentDate-${cId}`);
|
||||||
let el = document.getElementById(`currentDate-${cId}`);
|
if (el && el.innerText != newCurrentDate)
|
||||||
if (el && el.innerText != newConsulates[c].currentDate)
|
smoothTextChange(el, newCurrentDate);
|
||||||
smoothTextChange(el, newConsulates[c].currentDate);
|
el = document.getElementById(`bestDate-${cId}`);
|
||||||
}
|
if (el && el.innerText != newBestDate)
|
||||||
if (newConsulates[c].bestDate) {
|
smoothTextChange(el, newBestDate);
|
||||||
let el = document.getElementById(`bestDate-${cId}`);
|
|
||||||
if (el && el.innerText != newConsulates[c].bestDate)
|
|
||||||
smoothTextChange(el, newConsulates[c].bestDate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,15 +244,15 @@ async function getConsulates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getAvailableDates(consulateId) {
|
async function getAvailableDates(consulateId) {
|
||||||
let addressUri = window.location.pathname + `/address/${consulateId}`
|
// let addressUri = window.location.pathname + `/address/${consulateId}`
|
||||||
fetch(addressUri, { headers: { "x-requested-with": "XMLHttpRequest" } })
|
// fetch(addressUri, { headers: { "x-requested-with": "XMLHttpRequest" } })
|
||||||
.catch(error => console.error('Error:', error));
|
// .catch(error => console.error('Error:', error));
|
||||||
|
|
||||||
let datesUri = window.location.pathname + `/days/${consulateId}.json?appointments[expedite]=false`
|
let datesUri = window.location.pathname + `/days/${consulateId}.json?appointments[expedite]=false`
|
||||||
let dates = fetch(datesUri, { headers: {
|
let dates = fetch(datesUri, { headers: {
|
||||||
"x-requested-with": "XMLHttpRequest",
|
"x-requested-with": "XMLHttpRequest",
|
||||||
"accept": "application/json, text/javascript, */*; q=0.01",
|
"accept": "application/json, text/javascript, */*; q=0.01",
|
||||||
// "cache-control": "no-cache",
|
"cache-control": "no-cache",
|
||||||
}})
|
}})
|
||||||
.catch(async e => {
|
.catch(async e => {
|
||||||
await handleHttpError(e);
|
await handleHttpError(e);
|
||||||
@@ -625,6 +625,7 @@ async function runner() {
|
|||||||
if (!(currentHourUTC === 23 && currentMinuteUTC < 5)) {
|
if (!(currentHourUTC === 23 && currentMinuteUTC < 5)) {
|
||||||
ctx.consulates[c].nextCheckAt = getFutureDate(SOFT_BAN_TIMEOUT, getJitter(cfg.frequency));
|
ctx.consulates[c].nextCheckAt = getFutureDate(SOFT_BAN_TIMEOUT, getJitter(cfg.frequency));
|
||||||
}
|
}
|
||||||
|
ctx.consulates[c].currentDate = null;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user