Lichess Grab Cursor

Changes the cursor to a grab hand when hovering over pieces and to a grabbing hand when dragging pieces.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

Advertisement:

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.

(I already have a user style manager, let me install it!)

Advertisement:

// ==UserScript==
// @name         Lichess Grab Cursor
// @namespace    https://lichess.org/
// @version      1.0
// @description  Changes the cursor to a grab hand when hovering over pieces and to a grabbing hand when dragging pieces.
// @author       ObnubiladO
// @match        https://lichess.org/*
// @icon         https://webref.ru/assets/images/css/cursor/grab.png
// @grant        none
// @run-at       document-start
// @license      GPL-3.0-or-later
// ==/UserScript==

(function() {
    'use strict';

    // Define the custom CSS
    const customCSS = `
    /* Change cursor to grab when hovering over manipulable pieces */
    .manipulable cg-board {
        cursor: grab !important;
    }

    /* Change cursor to grabbing when a piece is being dragged */
    .manipulable cg-board:has(piece.dragging) {
        cursor: grabbing !important;
    }
    `;

    // Function to inject CSS into the page
    function addGlobalStyle(css) {
        const style = document.createElement('style');
        style.type = 'text/css';
        style.appendChild(document.createTextNode(css));
        document.head.appendChild(style);
    }

    // Inject the custom CSS
    addGlobalStyle(customCSS);
})();