Skip to content

Instantly share code, notes, and snippets.

@mardr
Created April 2, 2026 12:45
Show Gist options
  • Select an option

  • Save mardr/1dc7472b49d9d13b04e5a28dde3af3f0 to your computer and use it in GitHub Desktop.

Select an option

Save mardr/1dc7472b49d9d13b04e5a28dde3af3f0 to your computer and use it in GitHub Desktop.
KSeF autofill NIP
// ==UserScript==
// @name KSeF autofill NIP
// @match https://ap.ksef.mf.gov.pl/*
// @run-at document-idle
// ==/UserScript==
const NIP = '1234567890'; // <-- wpisz swój NIP
const tryFill = () => {
const input = document.querySelector('input[formcontrolname="nip"]');
if (!input) return;
// Angular wymaga symulacji zdarzeń, samo .value= nie wystarczy
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
window.HTMLInputElement.prototype, 'value'
).set;
nativeInputValueSetter.call(input, NIP);
input.dispatchEvent(new Event('input', { bubbles: true }));
input.dispatchEvent(new Event('change', { bubbles: true }));
};
// Poczekaj aż Angular wyrenderuje formularz
setTimeout(tryFill, 1500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment