Is is possible in general to make Chrome not to focus on any of the fields automatically, for example, after the page has been loaded?
Extensions that use keys on keyboard don't work well with autofocus and type instead of executing commands.
Answer
I've just written script for you:
// ==UserScript==
// @name Disable auto-focussing
// @author ComFreek
// @description Disable auto-focussing
// @include *
// @version 1.0
// ==/UserScript==
var maxTime = 3000;
var timeoutInterval = 5;
var usedTime = 0;
var isManualFocus = false;
function check() {
if (!isManualFocus && document.activeElement.tagName.toLowerCase() == "input") {
console.log("BLURRED");
document.activeElement.blur();
}
usedTime += timeoutInterval;
if (usedTime < maxTime) {
window.setTimeout(check, timeoutInterval);
}
}
check();
document.body.addEventListener("click", function (evt) {
if (evt.target.tagName == "INPUT") {
console.log("MANUAL CLICK");
isManualFocus = true;
}
});
document.body.addEventListener("keydown", function (evt) {
isManualFocus = true;
});
Warning The script will interfere with the user if he immediately starts typing while the script is still operating. This is fixed.
Installation (manual method)
Save the script as
XX.user.js
(XX can be any string, but.user.js
is important here!)Open the extensions page in Chrome (the URI is
chrome://extensions/
as of Chrome v31)Drag the script from the file explorer and drop it over the extensions page.
Confirm the installation
Installation (TamperMonkey)
My script should work with TamperMonkey according to OP's comment below. Please consult TamperMonkey's manual for further information on how to install my script.
No comments:
Post a Comment