chess.com, wasd controls

allows user to go back and forth using the keys a and d, w and s are commented out

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

You will need to install an extension such as Tampermonkey to install this script.

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.

You will need to install an extension such as Tampermonkey to install this script.

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!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

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

// ==UserScript==
// @name         chess.com, wasd controls
// @description  allows user to go back and forth using the keys a and d, w and s are commented out
// @version      1.2
// @author       Tobias L
// @include      *.chess.com/*
// @license      GPL-3.0-only
// @namespace    https://github.com/WhiteG00se/User-Scripts
// ==/UserScript==

function simulateKeyPress(key) {
	let keyPress = new KeyboardEvent('keydown', {
		key: key,
		code: key,
		bubbles: true,
		cancelable: true,
		view: window,
	})
	document.dispatchEvent(keyPress)
}

document.body.addEventListener('keydown', function (event) {
	switch (event.key) {
		// case 'w':
		// 	simulateKeyPress('ArrowUp')
		// 	break
		case 'a':
			simulateKeyPress('ArrowLeft')
			break
		// case 's':
		// 	simulateKeyPress('ArrowDown')
		// 	break
		case 'd':
			simulateKeyPress('ArrowRight')
			break
	}
})