NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Zenkit hover-and-e-to-edit
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hover over a cell in Zenkit Kanban and hit the E key to immediately be able to type
// @author You
// @match https://zenkit.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let currHref;
const KEYCODE = 69; // E
function isEditing(event) {
return $(document.activeElement).parents().andSelf().filter(
'input, textarea, [contenteditable]').length > 0;
}
$(document).on("mouseenter", "a.zenkit-badge", e => (currHref = $(e.currentTarget).attr('href')));
$(document).on("mouseleave", "a.zenkit-badge", e => (currHref = null));
$('body').keydown(e => {
// console.log(currHref, isEditing(e));
if (currHref && !isEditing(e) && e.keyCode == KEYCODE) {
$('a[href="%s"] .zenkit-badge-element-heading-inline-edit-trigger'.replace('%s', currHref)).click();
e.preventDefault();
}
});
})();