VFS Portugal AutoFill

Script para preenchimento automático do formulário de solicitação de visto do VFS Global para Portugal.

当前为 2024-09-14 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        VFS Portugal AutoFill
// @namespace   http://tampermonkey.net/
// @version     0.6
// @description Script para preenchimento automático do formulário de solicitação de visto do VFS Global para Portugal.
// @author      ARMANDO SIMÃO
// @match       https://*.vfsglobal.com/*
// @grant       none
// ==/UserScript==

(function() {
    'use strict';

    // Dados para o preenchimento
    var formData = {
        email: "[email protected]",
        password: "ABC1DEFGH@Ie",
        passportNumber: "N281126",
        firstName: "Finante",
        lastName: "Kiala",
        dateOfBirth: "02/11/1994",
        passportExpiryDate: "08/09/2032",
        nationality: "Angolana",
        gender: "Female",
        visaNumber: "123456789",
        visaPlace: "Lisboa",
        visaDuration: "NATIONAL",
        mobile: "929209256"
    };

    // Função para preencher o formulário
    function fillForm() {
        // Email e senha
        if (document.querySelector("#EmailId")) {
            document.querySelector("#EmailId").value = formData.email;
        }
        if (document.querySelector("#Password")) {
            document.querySelector("#Password").value = formData.password;
        }

        // Passaporte e informações pessoais
        if (document.querySelector("#PassportNumber")) {
            document.querySelector("#PassportNumber").value = formData.passportNumber;
        }
        if (document.querySelector("#FirstName")) {
            document.querySelector("#FirstName").value = formData.firstName;
        }
        if (document.querySelector("#LastName")) {
            document.querySelector("#LastName").value = formData.lastName;
        }
        if (document.querySelector("#DateOfBirth")) {
            document.querySelector("#DateOfBirth").value = formData.dateOfBirth;
        }
        if (document.querySelector("#PassportExpiryDate")) {
            document.querySelector("#PassportExpiryDate").value = formData.passportExpiryDate;
        }

        // Nacionalidade
        if (document.querySelector("#NationalityId")) {
            let nationalityOptions = document.querySelectorAll("#NationalityId option");
            nationalityOptions.forEach(option => {
                if (option.text.includes(formData.nationality)) {
                    option.selected = true;
                }
            });
        }

        // Gênero
        if (document.querySelector("#GenderId")) {
            let genderOptions = document.querySelectorAll("#GenderId option");
            genderOptions.forEach(option => {
                if (option.text.includes(formData.gender)) {
                    option.selected = true;
                }
            });
        }

        // Informações do visto (se aplicável)
        if (document.querySelector("#VisaNumber")) {
            document.querySelector("#VisaNumber").value = formData.visaNumber;
        }
        if (document.querySelector("#PlaceOfIssuance")) {
            document.querySelector("#PlaceOfIssuance").value = formData.visaPlace;
        }
        if (document.querySelector("#Duration")) {
            document.querySelector("#Duration").value = formData.visaDuration;
        }

        // Telefone
        if (document.querySelector("#Mobile")) {
            document.querySelector("#Mobile").value = formData.mobile;
        }

        // Submissão automática (opcional)
        // document.querySelector("#submitbuttonId").click();  // Descomente esta linha para submissão automática
    }

    // Executar a função de preenchimento assim que a página estiver pronta
    window.onload = function() {
        fillForm();
    };

})();