Execute code on any websites!
目前為
// ==UserScript==
// @name Code Executer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Execute code on any websites!
// @author cool
// @match *://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @license MIT
// ==/UserScript==
(function(w) {
'use strict';
var io = false;
var c = document.createElement("button");
c.setAttribute("style", "width: 80px !important; height: 40px !important; padding: 0px !important; margin: 0px !important; text-size: 14px !important; background-color: dodgerblue !important; color: white !important; border: none !important; border-radius: 5px 0px 5px 0px !important; position: fixed !important; right: 0px !important; bottom: 0px !important; z-index: 99999999 !important; cursor: pointer !important;");
c.innerHTML = "Code Execute";
document.body.appendChild(c);
var i = document.createElement("input");
i.setAttribute("style", "width: calc(100% - 90px) !important; padding: 0px 5px !important; margin: 0px !important; height: 40px !important; text-size: 14px !important; background-color: white !important; color: black !important; outline: none !important; border: 1px solid gray !important; border-radius: 0px !important; position: fixed !important; left: 0px !important; bottom: 0px !important; z-index: 99999999 !important; cursor: text !important;");
i.placeholder = "Press enter to execute";
i.hidden = true;
document.body.appendChild(i);
c.addEventListener("click", function() {
if (io) {
io = false;
i.hidden = true;
c.innerHTML = "Code Execute";
} else {
io = true;
i.hidden = false;
c.innerHTML = "Close";
i.focus();
}
});
i.addEventListener("keydown", function(e) {
if (e.key == "Enter") {
(function(window, _codeExecuteCode) {
eval(_codeExecuteCode);
})(w, i.value);
i.value = "";
}
});
})(window);