用于在环境严重受限(如手机) 或 有较强 Anti-DevTools 的网站使用
目前為
// ==UserScript==
// @name:zh-CN 控制台EZ
// @name EZ Console
// @namespace Violentmonkey Scripts
// @match *://*/*
// @license AGPL-3.0-or-later
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @grant GM_addElement
// @version 0.2.1
// @author -
// @description:zh-cn 用于在环境严重受限(如手机) 或 有较强 Anti-DevTools 的网站使用
// @description:en -
// @description 用于在环境严重受限(如手机) 或 有较强 Anti-DevTools 的网站使用
// ==/UserScript==
let x = GM_registerMenuCommand("控制台EZ", () => {
GM_unregisterMenuCommand(x);
const div = GM_addElement("div", {
style: "left: 0px;position: fixed;top: 0px;z-index: 9999; display:flex; flex-direction: column; width: 50vh;"
});
const ipt = GM_addElement(div, "input", {
style: "border: solid;flex: 0 0 auto;"
});
const ppt = GM_addElement(div, "textarea", {style: "flex: 1 0 auto;"});
const log = (...args) => args.forEach(t => ppt.value += t);
const sand = {console: {log, warn: (...args) => log("[WARN] ", ...args), error: (...args) => log("[ERR] ", ...args)}};
ipt.addEventListener("keypress", e => {
if (e.key === "Enter") {
let t = ipt.value;
with (sand)
try {eval(t);}
catch (e) {console.error(e);}
ipt.value = "";
}
});
});