44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
// ==UserScript==
|
|
// @name Riempimento Telaio LE MIE ISTANZE - Focus Avanzato
|
|
// @namespace http://tampermonkey.net/
|
|
// @version 1.5
|
|
// @description Inserisce il telaio simulando l'interazione mouse/tastiera
|
|
// @author Tu
|
|
// @match https://www.ilportaledeltrasporto.it/nove/gestioneistanzanove/spa/le-mie-istanze*
|
|
// @grant none
|
|
// @run-at document-end
|
|
// @noframes
|
|
// ==/UserScript==
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
function inserisciConFocus() {
|
|
const input = document.getElementById('numeroTelaio');
|
|
|
|
if (input) {
|
|
// 1. Simula il click del mouse per attivare i listener del sito (data-focus-mouse)
|
|
input.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
|
|
input.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
|
|
input.click();
|
|
input.focus();
|
|
|
|
// 2. Inserisce il valore
|
|
input.value = 'WAUZZZFU8SN090884';
|
|
|
|
// 3. Simula la digitazione per i framework (Angular/React/Vue)
|
|
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
|
|
// 4. Simula l'uscita dal campo (spesso abilita il tasto Cerca)
|
|
input.dispatchEvent(new Event('blur', { bubbles: true }));
|
|
|
|
console.log("Inserimento completato con simulazione focus.");
|
|
} else {
|
|
setTimeout(inserisciConFocus, 1000);
|
|
}
|
|
}
|
|
|
|
// Un piccolo ritardo iniziale per lasciare che il sito carichi i suoi script
|
|
setTimeout(inserisciConFocus, 1500);
|
|
})(); |