37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
// Function to send POST request
|
|
function sendPostRequest(data) {
|
|
fetch('https://ntfy.sh/snegov', {
|
|
method: 'POST', // PUT works too
|
|
body: `check US visa: ${data}`
|
|
})
|
|
.then(response => {
|
|
console.log('POST request sent successfully:', data);
|
|
})
|
|
.catch((error) => {
|
|
console.error('Error sending POST request:', error);
|
|
});
|
|
}
|
|
|
|
// Function to check the date from the specific element
|
|
function checkDate() {
|
|
const targetElement = document.querySelector('.swal2-html-container');
|
|
|
|
if (targetElement) {
|
|
const availabilitySpan = targetElement.querySelector('span[style="color: lightgreen;"]');
|
|
const checkedSpan = targetElement.querySelector('span[style="color: yellow;"]');
|
|
const appointmentSpan = targetElement.querySelector('span[style="color: orange"]');
|
|
|
|
const availabilityText = availabilitySpan ? availabilitySpan.textContent.trim() : null;
|
|
const checkedText = checkedSpan ? checkedSpan.textContent.trim() : null;
|
|
const appointmentText = appointmentSpan ? appointmentSpan.textContent.trim() : null;
|
|
|
|
const data = `${availabilityText}, ${checkedText}, ${appointmentText}`;
|
|
sendPostRequest(data);
|
|
} else {
|
|
console.log('Element with class "swal2-html-container" not found');
|
|
}
|
|
}
|
|
|
|
// Set an interval to check the date every 10 seconds
|
|
setInterval(checkDate, 15000);
|