您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Скрипт для автоматического ответа на жалобы на форуме Widerussia
当前为
// ==UserScript== // @name script for chief admins // @namespace http://tampermonkey.net/ // @version 1.0 // @description Скрипт для автоматического ответа на жалобы на форуме Widerussia // @author ecl1pse // @match https://forum-widerussia.hgweb.ru/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Функция для добавления кнопки function addResponseButton() { // Проверяем, находимся ли мы на странице темы if (!window.location.href.includes('threads/')) { return; } // Проверяем, не добавлена ли уже наша кнопка if (document.getElementById('widerussiaAutoResponse')) { return; } // Ищем форму быстрого ответа const replyForm = document.querySelector('form.js-quickReply'); if (!replyForm) { return; } // Ищем контейнер для кнопок (на основе скриншота) let buttonContainer = replyForm.querySelector('.block-row'); // Если нет контейнера, создаем его if (!buttonContainer) { buttonContainer = document.createElement('div'); buttonContainer.className = 'block-row'; buttonContainer.style.margin = '10px 0'; buttonContainer.style.padding = '10px'; buttonContainer.style.backgroundColor = '#f9f9f9'; buttonContainer.style.borderRadius = '4px'; // Вставляем перед полем ввода сообщения const messageField = replyForm.querySelector('textarea'); if (messageField) { messageField.parentNode.insertBefore(buttonContainer, messageField); } else { replyForm.insertBefore(buttonContainer, replyForm.firstChild); } } // Создаем кнопку const button = document.createElement('button'); button.id = 'widerussiaAutoResponse'; button.textContent = 'На рассмотрении'; button.style.cssText = ` background: #ff6b35; color: white; border: none; padding: 10px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-right: 10px; font-size: 14px; `; // Добавляем обработчик события button.addEventListener('click', function() { // Получаем имя автора темы const authorLinks = [ document.querySelector('.username--style1'), document.querySelector('.username'), document.querySelector('.message-name a'), document.querySelector('.message-userDetails a'), document.querySelector('.p-title-value') ].filter(Boolean); let authorName = 'автор'; let authorHref = '#'; if (authorLinks.length > 0) { authorName = authorLinks[0].textContent; authorHref = authorLinks[0].href; } // Формируем текст ответа const responseText = `[CENTER][FONT=georgia][COLOR=rgb(255, 0, 0)]Здравствуйте, уважаемый[/COLOR] [URL="${authorHref}"]${authorName}[/URL] Ваша жалоба взята [COLOR=rgb(251, 160, 38)]на рассмотрение[/COLOR].. [COLOR=rgb(255, 0, 0)]Ожидайте ответа[/COLOR].[/FONT][/CENTER]`; // Ищем текстовое поле для ответа const messageField = replyForm.querySelector('textarea[name="message"]'); if (messageField) { // Устанавливаем значение и активируем события messageField.value = responseText; // Создаем события для активации поля const inputEvent = new Event('input', { bubbles: true }); const changeEvent = new Event('change', { bubbles: true }); messageField.dispatchEvent(inputEvent); messageField.dispatchEvent(changeEvent); // Фокусируемся на поле messageField.focus(); } else { // Пробуем найти редактор с contenteditable const editableDiv = replyForm.querySelector('[contenteditable="true"]'); if (editableDiv) { editableDiv.focus(); document.execCommand('selectAll', false, null); document.execCommand('insertText', false, responseText); } } }); // Добавляем кнопку в контейнер buttonContainer.appendChild(button); } // Функция для проверки и добавления кнопки function init() { // Проверяем, находимся ли мы на нужной странице if (!window.location.href.includes('threads/')) { return; } // Ждем загрузки DOM if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { // Даем время на загрузку всех элементов setTimeout(addResponseButton, 1000); }); } else { setTimeout(addResponseButton, 1000); } } // Запускаем инициализацию init(); // Также добавляем кнопку при изменении контента const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.addedNodes.length > 0) { // Проверяем, была ли добавлена форма ответа const addedForms = Array.from(mutation.addedNodes).filter(node => node.nodeType === 1 && node.querySelector && node.querySelector('form.js-quickReply') ); if (addedForms.length > 0) { setTimeout(addResponseButton, 500); } } }); }); observer.observe(document.body, { childList: true, subtree: true }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址