Skip to content

Instantly share code, notes, and snippets.

@0mg
Created October 16, 2011 11:33
Show Gist options
  • Save 0mg/1290786 to your computer and use it in GitHub Desktop.
Save 0mg/1290786 to your computer and use it in GitHub Desktop.
activeElement memory
// ==UserScript==
// @name activeElement memory
// @include *
// ==/UserScript==
addEventListener("focus", function(event) {
if (event.target instanceof HTMLTextAreaElement ||
event.target instanceof HTMLInputElement) {
document.activeElementLatest = event.target;
}
}, true);
javascript:(function(e){if(e)e.value+=new Date})(document.activeElementLatest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment