您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a Paste button to Vultr console
当前为
// ==UserScript== // @name Vultr console paste // @name:zh Vultr 控制台 粘贴功能 // @version 0.1 // @description Add a Paste button to Vultr console // @description:zh 给Vultr的控制台添加一个粘贴按钮 // @author Sam0230 // @match *://my.vultr.com/*/novnc/* // @grant none // @run-at document-start // @namespace https://gf.qytechs.cn/users/305841 // ==/UserScript== (function() { 'use strict'; let sendString = window.sendString = function sendString(str) { let timeout = 0; for (let i = 0; i < str.length; i++) { let KeyCode = str.charCodeAt(i), needShift = ('~!@#$%^&*()_+{}|:"<>?'.indexOf(str[i]) != -1); if (KeyCode == "\n".charCodeAt()) { KeyCode = XK_Return; } if (needShift) { rfb.sendKey(XK_Shift_L, true); } rfb.sendKey(KeyCode); if (needShift) { rfb.sendKey(XK_Shift_L, false); } } } let pasteButton = document.createElement("input"), textarea = document.createElement("textarea"); pasteButton.type = "button"; pasteButton.value = "Paste"; pasteButton.id = "pasteButton"; pasteButton.style.display = "inline"; pasteButton.disabled = true; textarea.placeholder="Paste"; textarea.id = "pasteTextarea"; textarea.style.display = "inline"; textarea.style.position = "relative"; textarea.style.top = "4px"; textarea.style.height = "13px"; textarea.cols = "6"; textarea.style.border = "none"; textarea.style.resize = "none"; textarea.onfocus = function () { rfb._keyboard.ungrab(); rfb._mouse.ungrab(); } textarea.onblur = function () { rfb._keyboard.grab(); rfb._mouse.grab(); } let addButton = function addButton() { if (!document.getElementById("noVNC_buttons")) { setTimeout(addButton, 25); return; } document.getElementById("noVNC_buttons").appendChild(textarea); document.getElementById("noVNC_buttons").appendChild(pasteButton); let enableButton = function enableButton() { if (!document.getElementById("noVNC_canvas") || document.getElementById("noVNC_canvas").height == 20) { setTimeout(enableButton, 25); return; } pasteButton.disabled = false; pasteButton.onclick = function () { let text = textarea.value; textarea.value = ""; sendString(text); } } setTimeout(enableButton, 0); } setTimeout(addButton, 0); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址