Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save god-is-good-m1n/0908bc0543b8c644dc20234cb0a34d63 to your computer and use it in GitHub Desktop.
Save god-is-good-m1n/0908bc0543b8c644dc20234cb0a34d63 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Fetch BLS Spain Morocco Rendezvous
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Fetch appointment details from BLS Spain Morocco website
// @author Your Name
// @match https://blsspainmorocco.com/*
// @grant GM_xmlhttpRequest
// @connect blsspainmorocco.com
// ==/UserScript==
(function() {
'use strict';
// URL of the appointment page
const appointmentUrl = 'https://blsspainmorocco.com/apply-for-visa.php';
// Function to fetch and display appointment information
function fetchAppointments() {
GM_xmlhttpRequest({
method: 'GET',
url: appointmentUrl,
onload: function(response) {
if (response.status === 200) {
// Parse the response and extract appointment information
const parser = new DOMParser();
const doc = parser.parseFromString(response.responseText, 'text/html');
const appointmentInfo = doc.querySelector('.appointment-info'); // Change this selector based on the actual structure of the webpage
if (appointmentInfo) {
alert('Appointment Info: ' + appointmentInfo.textContent);
} else {
alert('No appointment information found.');
}
} else {
alert('Failed to fetch appointment information.');
}
},
onerror: function() {
alert('Error while fetching appointment information.');
}
});
}
// Add a button to the page to fetch appointment information
const button = document.createElement('button');
button.textContent = 'Fetch Appointment Info';
button.style.position = 'fixed';
button.style.top = '10px';
button.style.right = '10px';
button.style.zIndex = '1000';
button.onclick = fetchAppointments;
document.body.appendChild(button);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment