// ==UserScript==
// @name Автозаполнение Email на digiseller.market
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Запрашивает email и вставляет его в оба поля формы
// @author Ты
// @match https://digiseller.me/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Создаем простое модальное окно
const modalHTML = `
<div id="emailModal" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 99999; display: flex; align-items: center; justify-content: center;">
<div style="background-color: white; padding: 20px; border-radius: 8px; width: 300px; box-shadow: 0 4px 12px rgba(0,0,0,0.2);">
<h3 style="margin-top: 0;">Введите почту</h3>
<input type="email" id="userEmailInput" placeholder="your@email.com" style="width: 100%; padding: 8px; margin-bottom: 10px;" />
<div style="display: flex; justify-content: space-between;">
<button id="saveEmailBtn" style="padding: 6px 12px; background-color: #4CAF50; color: white; border: none; border-radius: 4px;">OK</button>
<button id="cancelEmailBtn" style="padding: 6px 12px; background-color: #ccc; border: none; border-radius: 4px;">Отмена</button>
</div>
</div>
</div>
`;
// Вставляем модальное окно в страницу
const modalContainer = document.createElement('div');
modalContainer.innerHTML = modalHTML;
document.body.appendChild(modalContainer);
// Обработчики событий
document.getElementById('saveEmailBtn').addEventListener('click', function () {
const email = document.getElementById('userEmailInput').value.trim();
if (email) {
const field1 = document.getElementById('Re_Enter_Email');
const field2 = document.getElementById('email');
if (field1) {
field1.value = email;
field1.dispatchEvent(new Event('input'));
field1.dispatchEvent(new Event('change'));
field1.focus();
}
if (field2) {
field2.value = email;
field2.dispatchEvent(new Event('input'));
field2.dispatchEvent(new Event('change'));
field2.focus();
}
if (!field1 && !field2) {
alert("Поля для ввода email не найдены на странице.");
}
}
document.getElementById('emailModal').remove();
});
document.getElementById('cancelEmailBtn').addEventListener('click', function () {
document.getElementById('emailModal').remove();
});
})();