Skip to content

Instantly share code, notes, and snippets.

@MagicLegend
Last active March 8, 2022 00:54
Show Gist options
  • Save MagicLegend/a9d064a5c1ad88492fd90d830a768238 to your computer and use it in GitHub Desktop.
Save MagicLegend/a9d064a5c1ad88492fd90d830a768238 to your computer and use it in GitHub Desktop.
Fixed oopsie of using an OR instead of an AND
// ==UserScript==
// @name MicroNotes
// @namespace
// @version 1.2
// @description Adds a small text box for notes and automates the resizing and cleaning up of the working space
// @author MagicLegend
// @match https://microcorruption.com/cpu/debugger
// @grant none
// ==/UserScript==
(function() {
'use strict';
var snippet = '<div class="gold-box"><div class="textentrywrap"><textarea id="micronotes" style="margin: 0px; height: 129px; width: 99%; resize:vertical;"></textarea></div></div>';
$('.column-2 .teal-box:eq(1)').after(snippet); //Inserts the textarea snippet in the page on the bottom of the right column
$('#asmbox').css("height", "490px"); //Forces the left column to become the same height as the right one
$('#hideheaders').click(); //Clicks the 'hide headers' button; this removes the header and footer for a cleaner working space
//Every time a key is pressed it will check if the notes textarea is in focus (the user is making notes); otherwise it will select the textentry box
$(document).keypress(function(event) {
//console.log("Pressed");
if (!$("#micronotes").is(":focus") && !$("io_input_box").is(":focus")) {
$("#textentry").focus();
if (event.which == 13 ) {
//console.log("pressed enter");
//$("#textentry").trigger($.Event("keydown", {keyCode: 13}))
}
} else {
//console.log("Notes or IO box is focussed");
}
});
})();
/*
<div class="gold-box">
<div class="textentrywrap">
<textarea id="micronotes" style="margin: 0px; height: 129px; width: 99%; resize:vertical;"></textarea>
</div>
</div>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment