Uniteller: autocomplete fix

Fix 💳 autofill on Uniteller.ru payments processing provider

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==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');
    });
})();