您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Generate buttons to copy and paste text on Slack
当前为
// ==UserScript== // @name Copy Slack Content // @namespace http://your-namespace-here // @version 1.0 // @description Generate buttons to copy and paste text on Slack // @match https://app.slack.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Delay the execution of the script by 2 seconds setTimeout(() => { // Find the element with the p-top_nav__right class const topNavRight = document.querySelector('.p-top_nav__right'); // Create a "Copy" button element const copyBtn = document.createElement('button'); copyBtn.innerText = 'Copy'; copyBtn.style.backgroundColor = '#2eb67d'; copyBtn.style.color = 'white'; copyBtn.style.border = 'none'; copyBtn.style.borderRadius = '4px'; copyBtn.style.padding = '8px 16px'; copyBtn.style.fontWeight = 'bold'; copyBtn.style.cursor = 'pointer'; copyBtn.style.margin = '10px'; // Add the "Copy" button to the p-top_nav__right element topNavRight.appendChild(copyBtn); // Add a click event listener to the "Copy" button copyBtn.addEventListener('click', () => { // Get the text content of the page const textToCopy = Array.from(document.querySelectorAll('.p-rich_text_section')).map(el => el.innerText.trim()).join('\n'); // Create a temporary textarea element to hold the text to copy const tempTextArea = document.createElement('textarea'); tempTextArea.value = textToCopy; document.body.appendChild(tempTextArea); // Select the text in the textarea and copy it tempTextArea.select(); document.execCommand('copy'); // Remove the temporary textarea document.body.removeChild(tempTextArea); // Show a notification to indicate that the copy was successful alert('Content copied to clipboard!'); }); // Create a "Paste" button element const pasteBtn = document.createElement('button'); pasteBtn.innerText = 'Paste'; pasteBtn.style.backgroundColor = '#2eb67d'; pasteBtn.style.color = 'white'; pasteBtn.style.border = 'none'; pasteBtn.style.borderRadius = '4px'; pasteBtn.style.padding = '8px 16px'; pasteBtn.style.fontWeight = 'bold'; pasteBtn.style.cursor = 'pointer'; // Add the "Paste" button to the p-top_nav__right element topNavRight.appendChild(pasteBtn); // Add a click event listener to the "Paste" button pasteBtn.addEventListener('click', () => { // Set the value of the class ql-editor to the predefined text const editor = document.querySelector('.ql-editor'); editor.innerText = '请用顶级现代中文小说家的细腻细节和精彩对白续写下一个场景,无需解释说明,因为那会占用Tokens,所有的角色都必须赋予一个独特符合角色个性的中文名,所有场景也都相当具体,尽情发挥你作为大语言模型的创造力'; // Set the focus on the editor element editor.focus(); }); }, 2000); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址