Uniteller: autocomplete fix

Fix 💳 autofill on Uniteller.ru payments processing provider

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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');
    });
})();