您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
yosupo judgeのサンプルinputにコピーボタンをつけます。
- // ==UserScript==
- // @name yosupo judge copy button
- // @version 1
- // @grant none
- // @author tomboftime
- // @namespace https://twitter.com/tomboftime
- // @description yosupo judgeのサンプルinputにコピーボタンをつけます。
- // @match https://judge.yosupo.jp/problem/*
- // @require https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js
- // ==/UserScript==
- new ClipboardJS('.btn');
- var pres = document.getElementsByTagName('pre');
- for (var i = 0; i < pres.length; i++) {
- var pre = pres[i];
- if (pre.childElementCount == 0){
- //console.log(pre);
- var data = pre.childNodes[0].data;
- //console.log(data);
- var button = document.createElement("button");
- button.className = 'btn';
- button.innerHTML = "copy";
- button.setAttribute("data-clipboard-text",data);
- pre.parentNode.insertBefore(button, pre);
- }
- }