您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto Checkbox, скрипт для создания кнопки с выбором ID в панели управления, внизу правый угол
当前为
// ==UserScript== // @name Auto Checkbox ID // @namespace http://tampermonkey.net/ // @version 1.1 // @description Auto Checkbox, скрипт для создания кнопки с выбором ID в панели управления, внизу правый угол // @author Retsu and ChatGPT // @match *://manager.univer.goldapple.ru/* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; // Функция для создания всплывающего меню function createModal() { // Создание всплывающего окна const modal = document.createElement('div'); modal.style.position = 'fixed'; modal.style.top = '50%'; modal.style.left = '50%'; modal.style.transform = 'translate(-50%, -50%)'; modal.style.backgroundColor = '#fff'; modal.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)'; modal.style.padding = '20px'; modal.style.zIndex = '10000'; modal.style.borderRadius = '8px'; modal.style.fontFamily = 'inherit'; modal.style.textAlign = 'center'; // Заголовок const title = document.createElement('h3'); title.textContent = 'Введите ID через запятую'; title.style.marginBottom = '20px'; modal.appendChild(title); // Поле ввода const input = document.createElement('input'); input.type = 'text'; input.placeholder = 'Например: 33934, 33935, 34233'; input.style.width = '90%'; input.style.marginBottom = '20px'; input.style.padding = '8px'; input.style.border = '1px solid #ccc'; input.style.borderRadius = '4px'; input.style.fontSize = '14px'; modal.appendChild(input); // Кнопка const button = document.createElement('button'); button.textContent = 'Выбрать чекбоксы'; button.style.padding = '10px 20px'; button.style.backgroundColor = '#007bff'; button.style.color = '#fff'; button.style.border = 'none'; button.style.borderRadius = '4px'; button.style.cursor = 'pointer'; button.style.marginRight = '15px'; button.style.fontSize = '14px'; button.style.fontFamily = 'inherit'; button.addEventListener('mouseover', () => button.style.backgroundColor = '#0056b3'); button.addEventListener('mouseout', () => button.style.backgroundColor = '#007bff'); modal.appendChild(button); // Кнопка закрытия const closeButton = document.createElement('button'); closeButton.textContent = 'Закрыть'; closeButton.style.padding = '10px 20px'; closeButton.style.backgroundColor = '#00a8a5'; closeButton.style.color = '#fff'; closeButton.style.border = 'none'; closeButton.style.borderRadius = '4px'; closeButton.style.cursor = 'pointer'; closeButton.style.fontSize = '14px'; closeButton.style.fontFamily = 'inherit'; closeButton.addEventListener('click', () => document.body.removeChild(modal)); closeButton.addEventListener('mouseover', () => closeButton.style.backgroundColor = '#0a918c'); closeButton.addEventListener('mouseout', () => closeButton.style.backgroundColor = '#00a8a5'); modal.appendChild(closeButton); // Добавление окна на страницу document.body.appendChild(modal); // Обработчик кнопки button.addEventListener('click', () => { const ids = input.value.split(',').map(id => parseInt(id.trim(), 10)); const rows = document.querySelectorAll('tr.ek-table-row'); rows.forEach(row => { const idColumn = row.querySelector('td:nth-child(2) .ek-truncate__text'); // Колонка с ID const checkbox = row.querySelector('input[type="checkbox"]'); // Чекбокс в строке if (idColumn && checkbox && ids.includes(parseInt(idColumn.textContent.trim(), 10))) { checkbox.click(); console.log(`Выбран чекбокс для ID: "${idColumn.textContent.trim()}"`); } }); // Закрытие всплывающего окна document.body.removeChild(modal); }); } // Добавление кнопки на страницу const triggerButton = document.createElement('button'); triggerButton.textContent = 'Открыть меню выбора чекбоксов'; triggerButton.style.position = 'fixed'; triggerButton.style.bottom = '20px'; triggerButton.style.right = '150px'; triggerButton.style.padding = '10px 20px'; triggerButton.style.backgroundColor = '#28a745'; triggerButton.style.color = '#fff'; triggerButton.style.border = 'none'; triggerButton.style.borderRadius = '4px'; triggerButton.style.cursor = 'pointer'; triggerButton.style.zIndex = '10000'; triggerButton.style.fontFamily = 'inherit'; triggerButton.addEventListener('mouseover', () => triggerButton.style.backgroundColor = '#218838'); triggerButton.addEventListener('mouseout', () => triggerButton.style.backgroundColor = '#28a745'); triggerButton.addEventListener('click', createModal); document.body.appendChild(triggerButton); })();