Better Google

Don't be evil

As of 16/01/2020. See the latest version.

// ==UserScript==
// @name         Better Google
// @namespace    google
// @version      0.1.2
// @description  Don't be evil
// @author       aligo
// @match        https://www.google.com/search*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.querySelectorAll('.g .rc').forEach(function (el, i) {
        var linkEl = el.querySelector('.r > a');
        var amEl = el.querySelector('.action-menu.ab_ctl');

        var urlEl = document.createElement('cite');
        urlEl.innerText = linkEl.href;
        urlEl.style.color = '#006621';

        var betterEl = document.createElement('div');
        betterEl.appendChild(urlEl);
        if (amEl) {
            betterEl.appendChild(amEl);
        }

        linkEl.insertBefore(betterEl, linkEl.querySelector('h3').nextSibling);
        linkEl.insertBefore(document.createElement('br'), betterEl);

        el.querySelectorAll('.TbwUpd').forEach(el => el.remove());
        linkEl.querySelector('h3').previousSibling.remove();
    });
})();