您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
在 WZOI 中,给样例输入输出添加复制按钮。
当前为
// ==UserScript== // @name New Userscripts // @namespace http://tampermonkey.net/ // @description 在 WZOI 中,给样例输入输出添加复制按钮。 // @version 2024-02-18 // @author chenbs // @match https://wzoi.cc/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 复制字符串函数 function copy(text){ var input = document.createElement('textarea'); input.setAttribute('id', 'input_for_copyText'); input.value = text; document.getElementsByTagName('body')[0].appendChild(input); document.getElementById('input_for_copyText').select(); document.execCommand('copy'); document.getElementById('input_for_copyText').remove(); } // 复制按钮 var fa = document.getElementsByClassName("sample_io"); for(let i=0; i<fa.length; i++){ let cp = document.createElement("button"); cp.innerText = "复制"; cp.onclick = function(){let s=this.parentNode.innerText;copy(s.substr(0,s.length-3));}; fa[i].appendChild(cp); } })();