Auto Focus Username Field

Attempts to locate the username input box and change focus to it, will briefly change the background color of the field green when it activates.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Auto Focus Username Field
// @namespace   ClintPriest.com
// @description Attempts to locate the username input box and change focus to it, will briefly change the background color of the field green when it activates.
// @include     http://*
// @include     https://*
// @version     1
// @grant       none
// ==/UserScript==

var names = new Set([ 'username','login_name','user','login' ]);

function findFocus(e) {
	console.log('load %o', e);
	for(var x of names.values()) {
		var elem = document.querySelector('INPUT[name*=' + x + ']');
		if(elem) {
			elem.origbackgroundColor= elem.style.backgroundColor;
			elem.style.backgroundColor = '#A0FFA0';
			elem.focus();
			elem.selectionStart = 0;
			elem.selectionEnd = 999;

			setTimeout(function() {
				elem.style.backgroundColor = elem.origbackgroundColor;
				delete elem.origbackgroundColor;
			}, 2000);
			break;
		}
	}
	window.removeEventListener('DOMContentLoaded', findFocus);
};

window.addEventListener('DOMContentLoaded', findFocus);