Mastercom bypasser

Bypass absences block

// ==UserScript==
// @name         Mastercom bypasser
// @namespace    https://github.com/x3ric
// @version      2024-02-27
// @license      MIT 
// @description  Bypass absences block
// @author       X3ric
// @match        https://*.registroelettronico.com/mastercom/index.php
// @icon         https://www.google.com/s2/favicons?sz=64&domain=registroelettronico.com
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    'use strict';
    if (!document.querySelector('.bordi_alti_scheda')) {
        return;
    }
    selezione_abilitata = true;
    const container = document.createElement('div');
    container.style.position = 'absolute';
    container.style.top = '20px';
    container.style.right = '20px';
    container.style.zIndex = '9999';
    container.style.display = 'flex';
    container.style.width = '100%';
    container.style.alignItems = 'center';
    container.style.justifyContent = 'center';
    const idInput = document.createElement('input');
    idInput.type = 'text';
    idInput.placeholder = 'Enter ID of absence';
    idInput.style.marginRight = '10px';
    const removeButton = document.createElement('button');
    removeButton.textContent = 'Rimuovi Assenza';
    removeButton.style.padding = '5px 10px';
    removeButton.style.border = 'none';
    removeButton.style.background = '#007bff';
    removeButton.style.color = '#fff';
    removeButton.style.cursor = 'pointer';
    removeButton.addEventListener('click', function() {
        const idAssenza = idInput.value.trim();
        if (idAssenza !== '') {
            removeAssenza(idAssenza);
        } else {
            alert('Please enter the ID of the absence.');
        }
    });
    const addButton = document.createElement('button');
    addButton.textContent = 'Aggiungi Assenza';
    addButton.style.padding = '5px 10px';
    addButton.style.border = 'none';
    addButton.style.background = '#007bff';
    addButton.style.color = '#fff';
    addButton.style.cursor = 'pointer';
    addButton.addEventListener('click', function() {
        apriInserisciAssenza();
    });
    container.appendChild(idInput);
    container.appendChild(removeButton);
    container.appendChild(addButton);
    document.body.appendChild(container);
    function removeAssenza(idAssenza) {
        document.querySelector('#id_assenza').value = idAssenza;
        document.querySelector('#operazione').value = 'elimina_assenza';
        document.querySelector('#form_container').submit();
        document.querySelector('#jqxGeneralModalLoader').jqxLoader('open');
        chiudiSfondoTrasparente();
    }
})();