автор скрипта k1erry Для установки скопируйте код и вставьте в расширение Tampermonkey - https://www.tampermonkey.net/ // ==UserScript== // @name CopyNameButton // @license MIT // @version 1.0 // @description Добавляет кнопку скопировать ник возле каждого сообщения в теме // @icon [IMG][IMG] https://cdn-icons-png.flaticon.com/512/1622/1622069.png[/IMG][/IMG] // @author k1erry // @match https://zelenka.guru/threads/* // @namespace http://example.com // @grant GM_setClipboard // ==/UserScript== (function() { 'use strict'; function copyTextToClipboard(text) { const textArea = document.createElement("textarea"); textArea.value = text; document.body.appendChild(textArea); textArea.select(); document.execCommand("copy"); document.body.removeChild(textArea); } function showNotification(message) { const notification = document.createElement('div'); notification.innerText = message; notification.style.position = 'fixed'; notification.style.top = '10px'; notification.style.right = '10px'; notification.style.backgroundColor = '#333'; notification.style.color = 'white'; notification.style.padding = '10px'; notification.style.borderRadius = '5px'; notification.style.zIndex = '9999'; document.body.appendChild(notification); setTimeout(() => { document.body.removeChild(notification); }, 3000); } function addCopyButtonToUsername(username) { const copyIcon = document.createElement('img'); copyIcon.src = 'https://cdn-icons-png.flaticon.com/512/1622/1622069.png'; copyIcon.style.width = '16px'; copyIcon.style.height = '16px'; const copyButton = copyIcon.cloneNode(true); copyButton.style.marginLeft = '10px'; copyButton.style.cursor = 'pointer'; copyButton.title = 'Скопировать ник'; copyButton.addEventListener('click', () => { const usernameText = username.textContent.trim(); copyTextToClipboard(usernameText); showNotification('Ник "' + usernameText + '" скопирован в буфер обмена.'); copyButton.style.display = 'none'; }); username.parentNode.insertBefore(copyButton, username.nextSibling); } function observeNewContent(mutationsList, observer) { for (const mutation of mutationsList) { if (mutation.type === 'childList' && mutation.addedNodes.length > 0) { mutation.addedNodes.forEach(node => { if (node.nodeType === Node.ELEMENT_NODE) { const newUsername = node.querySelector('a.username'); if (newUsername) { addCopyButtonToUsername(newUsername); } } }); } } } const messageUsernames = document.querySelectorAll('li.message a.username'); messageUsernames.forEach(addCopyButtonToUsername); const commentUsernames = document.querySelectorAll('li.comment a.username'); commentUsernames.forEach(username => { const nextSibling = username.nextSibling; if (nextSibling && nextSibling.title === 'Скопировать ник') { nextSibling.remove(); } }); const observer = new MutationObserver(observeNewContent); observer.observe(document.body, { childList: true, subtree: true }); })(); JS // ==UserScript== // @name CopyNameButton // @license MIT // @version 1.0 // @description Добавляет кнопку скопировать ник возле каждого сообщения в теме // @icon [IMG][IMG] https://cdn-icons-png.flaticon.com/512/1622/1622069.png[/IMG][/IMG] // @author k1erry // @match https://zelenka.guru/threads/* // @namespace http://example.com // @grant GM_setClipboard // ==/UserScript== (function() { 'use strict'; function copyTextToClipboard(text) { const textArea = document.createElement("textarea"); textArea.value = text; document.body.appendChild(textArea); textArea.select(); document.execCommand("copy"); document.body.removeChild(textArea); } function showNotification(message) { const notification = document.createElement('div'); notification.innerText = message; notification.style.position = 'fixed'; notification.style.top = '10px'; notification.style.right = '10px'; notification.style.backgroundColor = '#333'; notification.style.color = 'white'; notification.style.padding = '10px'; notification.style.borderRadius = '5px'; notification.style.zIndex = '9999'; document.body.appendChild(notification); setTimeout(() => { document.body.removeChild(notification); }, 3000); } function addCopyButtonToUsername(username) { const copyIcon = document.createElement('img'); copyIcon.src = 'https://cdn-icons-png.flaticon.com/512/1622/1622069.png'; copyIcon.style.width = '16px'; copyIcon.style.height = '16px'; const copyButton = copyIcon.cloneNode(true); copyButton.style.marginLeft = '10px'; copyButton.style.cursor = 'pointer'; copyButton.title = 'Скопировать ник'; copyButton.addEventListener('click', () => { const usernameText = username.textContent.trim(); copyTextToClipboard(usernameText); showNotification('Ник "' + usernameText + '" скопирован в буфер обмена.'); copyButton.style.display = 'none'; }); username.parentNode.insertBefore(copyButton, username.nextSibling); } function observeNewContent(mutationsList, observer) { for (const mutation of mutationsList) { if (mutation.type === 'childList' && mutation.addedNodes.length > 0) { mutation.addedNodes.forEach(node => { if (node.nodeType === Node.ELEMENT_NODE) { const newUsername = node.querySelector('a.username'); if (newUsername) { addCopyButtonToUsername(newUsername); } } }); } } } const messageUsernames = document.querySelectorAll('li.message a.username'); messageUsernames.forEach(addCopyButtonToUsername); const commentUsernames = document.querySelectorAll('li.comment a.username'); commentUsernames.forEach(username => { const nextSibling = username.nextSibling; if (nextSibling && nextSibling.title === 'Скопировать ник') { nextSibling.remove(); } }); const observer = new MutationObserver(observeNewContent); observer.observe(document.body, { childList: true, subtree: true }); })();