Skip to content

Instantly share code, notes, and snippets.

@martonmiklos
Created June 25, 2025 19:30
Show Gist options
  • Save martonmiklos/84c65a3c6fff6e64adc8bd617478cf75 to your computer and use it in GitHub Desktop.
Save martonmiklos/84c65a3c6fff6e64adc8bd617478cf75 to your computer and use it in GitHub Desktop.
Autofill MPL címiratkitöltő sender
// ==UserScript==
// @name MPL címiratkitöltő automatikus kitöltés
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Automatikusan kitölti az adatokat Angular oldalon is
// @match https://net.posta.hu/cik/public/cik-frontend-cik/kuldemeny-egyedi/ke-belfoldi-rogzites/ke-be-felado
// @grant none
// ==/UserScript==
(function () {
'use strict';
const values = {
name: "Lófasz Jóska",
postalCode: "4200",
city: "Hajdúszoboszló",
street: "Gomba",
streetType: "utca",
houseNumber: "27 1. emelet/3 ajtó",
email: "[email protected]",
phone: "+3690-1234567"
};
function fillIfFound(input, value) {
if (input && input.value !== value) {
input.value = value;
input.dispatchEvent(new Event("input", { bubbles: true }));
input.dispatchEvent(new Event("change", { bubbles: true }));
}
}
function tryFillForm() {
const nameInput = document.querySelector('input[id*="uiInput6"]');
const postalCodeInput = document.querySelector('input[id*="cimtarCtIrsz1"]');
const cityInput = document.querySelector('input[id*="cimtarCtTelepules1"]');
const streetInput = document.querySelector('input[id*="cimtarCtKozterNev1"]');
const streetTypeInput = document.querySelector('input[id*="cimtarCtKozterJell1"]');
const houseNumberInput = document.querySelector('input[id*="cimtarCtHazszam1"]');
const emailInput = document.querySelector('input[id*="uiInput4"]');
const phoneInput = document.querySelector('input[id*="uiInput5"]');
fillIfFound(nameInput, values.name);
fillIfFound(postalCodeInput, values.postalCode);
fillIfFound(cityInput, values.city);
fillIfFound(streetInput, values.street);
fillIfFound(streetTypeInput, values.streetType);
fillIfFound(houseNumberInput, values.houseNumber);
fillIfFound(emailInput, values.email);
fillIfFound(phoneInput, values.phone);
}
const observer = new MutationObserver(() => {
tryFillForm();
});
window.addEventListener('load', () => {
const root = document.body;
if (root) {
observer.observe(root, { childList: true, subtree: true });
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment