Skip to content

Instantly share code, notes, and snippets.

@dmitryuk
Last active December 17, 2021 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitryuk/05768cc3386dffecc5d22d9f827f24d8 to your computer and use it in GitHub Desktop.
Save dmitryuk/05768cc3386dffecc5d22d9f827f24d8 to your computer and use it in GitHub Desktop.
Tamper monkey script to add hotkey to add Monospace with Ctrl+m
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://jira.*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let waitForTinyMce = function () {
if (window.tinyMCE) {
window.tinyMCE.on("AddEditor", function (event) {
event.editor.on('keyUp', function (keyEvent) {
if (keyEvent.ctrlKey && keyEvent.key==='m') {
document.querySelector('[data-operation="monospace-inline"]').click();
}
})
});
} else {
setTimeout(waitForTinyMce, 1000)
}
}
waitForTinyMce();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment