Uniteller: autocomplete fix

Fix 💳 autofill on Uniteller.ru payments processing provider

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name            Uniteller: autocomplete fix
// @namespace       github.com/a2kolbasov
// @version         1.1.0
// @description     Fix 💳 autofill on Uniteller.ru payments processing provider
// @name:ru         Uniteller: фикс автозаполнения
// @description:ru  Исправляет автозаполнение 💳 на странице оплаты Uniteller.ru
// @author          Aleksandr Kolbasov
// @license         MIT
// @icon            https://uniteller.ru/local/templates/index/img/base/logo.svg
// @match           https://fpay.uniteller.ru/*
// @grant           none
// ==/UserScript==

/*
 * Copyright © 2023 Aleksandr Kolbasov
 * Licensed under the MIT license (https://opensource.org/license/mit/)
 */

(() => {
    'use strict';

    /**
     * @param {?HTMLElement} element
     * @param {string} value
     */
    function setAutocomplete(element, value) {
        if (element) element.setAttribute('autocomplete', value);
    }

    setTimeout(() => {
        let cardNumber = document.getElementById('Pan');
        let month = document.getElementById('ExpMonth');
        let year = document.getElementById('ExpYear');
        let name = document.getElementById('CardholderName');
        let secureCode = document.getElementById('Cvc2');
        let email = document.getElementById('Email');
        let tel = document.getElementById('Phone');

        setAutocomplete(cardNumber, 'cc-number');
        setAutocomplete(month, 'cc-exp-month');
        setAutocomplete(year, 'cc-exp-year');
        setAutocomplete(name, 'cc-name');
        setAutocomplete(secureCode, 'cc-csc');
        setAutocomplete(email, 'email');
        setAutocomplete(tel, 'tel');
    });
})();