Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save krishnachaitanya7/87ab164dafe25a3cd43a5a9e24b9d165 to your computer and use it in GitHub Desktop.
Save krishnachaitanya7/87ab164dafe25a3cd43a5a9e24b9d165 to your computer and use it in GitHub Desktop.
This script can be modded to add some text whenever a key is pressed. DIY whatever satisfies you, you can change keycodes by replacing "13" and 'keyup' can be replaced by 'keypress' & 'keydown' events whichever satisfies your need
// ==UserScript==
// @name Enter "mnemonic" on pressing enter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://quizlet.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
$(document).on("keyup", function (e) {
var code = e.keyCode || e.which;
if(code == 13) { //Enter keycode
//Do something
var focused = document.activeElement;
focused.value = focused.value + 'mnemonic:';
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment