['work_place', 'employment', 'home_address', 'phone_number', 'email', 'dop_info'].forEach(id => {document.getElementById(id).autocomplete = 'on';});
https://chgk.tvigra.ru/sendquestion/
.// ==UserScript==
// @name Автозаполнение формы на chgk.tvigra.ru
// @namespace http://tampermonkey.net/
// @version 2025-05-05
// @description Автозаполнение формы на chgk.tvigra.ru/sendquestion
// @author dim5x
// @match https://chgk.tvigra.ru/sendquestion/
// @icon https://www.google.com/s2/favicons?sz=64&domain=tvigra.ru
// @connect i.pinimg.com
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
console.log('[DEBUG] Скрипт запущен!');
// ФИО и дата рождения.
const surname = document.querySelector('#surname');
surname.value = 'Иванов';
const name = document.querySelector('#name');
name.value = 'Иван';
const second_name = document.querySelector('#second_name');
second_name.value = 'Иванович';
const birth_date = document.querySelector('#birth_date');
birth_date.value = '01.12.1980';
// Загружаем фото.
setTimeout(async () => {
const fileInput = document.querySelector('input.upl[name="upl"]');
if (!fileInput) return;
// URL файла в интернете (пример - маленькое изображение).
// Поставить в @connect в шапке тот домен, где будет лежать ваше фото. Для примера это i.pinimg.com .
const fileUrl = 'https://i.pinimg.com/736x/57/11/9c/57119ce30030b98dcefab1662598f390.jpg';
const fileName = 'image.jpg';
const fileType = 'image/jpg';
try {
// Загружаем файл
const response = await new Promise((resolve, reject) => {
GM_xmlhttpRequest({
method: 'GET',
url: fileUrl,
responseType: 'blob',
onload: resolve,
onerror: reject
});
});
// Создаем File объект
const file = new File([response.response], fileName, { type: fileType });
// Эмулируем загрузку
const dt = new DataTransfer();
dt.items.add(file);
fileInput.files = dt.files;
// Триггерим событие
fileInput.dispatchEvent(new Event('change', { bubbles: true }));
} catch (e) {
console.error('Ошибка загрузки файла:', e);
}
}, 1000);
// Место работы, должность, номер, мыло...
const work_place = document.querySelector('#work_place');
work_place.value = 'habr';
const employment = document.querySelector('#employment');
employment.value = 'TC';
const home_address = document.querySelector('#home_address');
home_address.value = 'Москва';
const phone_number = document.querySelector('#phone_number');
phone_number.value = '+79992223311';
const email = document.querySelector('#email');
email.value = 'email@email.email';
// Галочка.
const ruleLabel = document.querySelector('label.check_label')
ruleLabel.click();
})();