Add MVP
This commit is contained in:
parent
b1a76dcfc6
commit
f8f0efd168
36
content.js
Normal file
36
content.js
Normal file
@ -0,0 +1,36 @@
|
||||
// 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);
|
||||
12
manifest.json
Normal file
12
manifest.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Page Change Detector",
|
||||
"version": "1.0",
|
||||
"permissions": ["activeTab"],
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["https://ais.usvisa-info.com/*"],
|
||||
"js": ["content.js"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user