Orion31Dev / JavaScript Console

// ==UserScript==
// @name         JavaScript Console
// @version      0.1
// @description  This code is just eval.
// @author       Orion31
// @include      http://*
// @include      https://*
// @require      http://userscripts-mirror.org/scripts/source/276064.user.js
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==
if (window == window.top) {
    $("body").append ( '                                                          \
<div id="gmPopupContainer"> \
<p id="gmTitle">JavaScript Console</p> \
<form> <!-- For true form use method="POST" --> \
<input type="text" id="code" value="">                           \                                                                              \
<button id="gmAddNumsBtn" type="button">Run Code</button>  \
<button id="gmCloseDlgBtn" type="button">Close</button>         \
</form>                                                                   \
</div>                                                                    \
' );
}

//--- Use jQuery to activate the dialog buttons.
$("#gmAddNumsBtn").click ( function () {
    var code   = $("#code").val ();
    var s = eval(code);
    $("#gmTitle").html(s);
} );

$("#gmCloseDlgBtn").click ( function () {
    $("#gmPopupContainer").hide ();
} );
Mousetrap.bind("shift+space", function () {$("#gmPopupContainer").show();});
$("#gmPopupContainer").hide ();

$("#gmTitle").css("font-family", "sans");
//--- CSS styles make it work...
GM_addStyle ("#gmPopupContainer {                                         \
position:               fixed;                              \
top:                    30%;                                \
left:                   20%;                                \
padding:                2em;                            \
background:             lime;                           \
border:                 3px double black;               \
border-radius:          1ex;                            \
z-index:                777;                            \
}                                                           \
#gmPopupContainer button{                                   \
cursor:                 pointer;                        \
border:                 1px outset buttonface;          \
}                                                           \
#gmCloseDlgBtn {                                       \
background-color: red;        \
}                                                           \
#gmTitle {                                       \
font-size: 25px; \
padding: 0;\
font-family: \"Trebuchet MS\", sans-serif !important;\
}                                                           \
");