EmsAutoFill

中華郵政EMS進度查詢自動從網址帶入單號

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         EmsAutoFill
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  中華郵政EMS進度查詢自動從網址帶入單號
// @author       AndrewWang
// @include      https://postserv.post.gov.tw/pstmail/main_mail.html*
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(() => {
        const input = document.getElementById('MAILNO');
        if (input) {
            const params = new URLSearchParams(window.location.search);
            let targetTxn = params.get('targetTxn');
            let sn = params.get('sn');

            if (targetTxn == 'EB500200' && sn != undefined) {
                input.focus();
                input.value = sn;
                input.dispatchEvent(new Event('input', { bubbles: true }));

                document.getElementById('captcha').focus();
            }
        }
    }, 700);
})();