Greasy Fork is available in English.

Not open google video player in search

Prevent opening google video player in search

// ==UserScript==
// @name            Not open google video player in search
// @namespace       https://greasyfork.org/users/821661
// @match           https://www.google.com/search*
// @grant           none
// @version         1.1
// @author          hdyzen
// @description     Prevent opening google video player in search
// @license         MIT
// ==/UserScript==
'use strict';

function thumbHandler() {
    const thumbs = document.querySelectorAll('a[data-vll][role="button"][aria-label]');
    thumbs.forEach(thumb => {
        if (thumb) {
            thumb.removeAttribute('data-ved');
            thumb.href = thumb.closest('[data-surl]').getAttribute('data-surl');
        } else {
            console.log('[LOG]: thumb not found');
        }
    });
}
thumbHandler();