Google Images without text

Remove title and description from below images on Google Images for a cleaner and simpler look, or if you prefer the look of Bing and DuckDuckGo but love Google too much. (Enhanced for chrome extension, Google Images Restored)

目前為 2020-02-09 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Google Images without text
// @namespace    https://github.com/Prid13
// @version      1.2
// @description  Remove title and description from below images on Google Images for a cleaner and simpler look, or if you prefer the look of Bing and DuckDuckGo but love Google too much. (Enhanced for chrome extension, Google Images Restored)
// @author       Prid
// @include        /.+://.*\.?google\..+/.*search.*\?.*tbm=isch.*/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var head = document.getElementsByTagName('head')[0];
    var style = document.createElement('style');
    style.type = 'text/css';

    style.innerHTML  = ".VFACy { display: none!important; } ";
    style.innerHTML += ".gBPM8 .PNCib { margin-bottom: -20px; } ";
    style.innerHTML += ".YcWSDf { height: calc(82% + 16px)!important; } ";
    style.innerHTML += ".fmbrQQxz::before { bottom: 20px!important; } ";

    var boxHeight = 0;

    setTimeout(function(){
        addOverrideHeightCss();
        boxHeight = document.getElementById("oldgisdetails").clientHeight;
        deleteOverrideHeightCss();
        console.log("HEIGHT ACQUIRED: " + boxHeight);

        document.getElementById("oldgisdetails").style.height = (boxHeight + 60) + "px";
    }, 500);

    head.appendChild(style);

    // CLICK EVENT HANDLER
    document.addEventListener("click", function(event) {
        if(event.target.getAttribute("jscontroller") === "SI4J6c") {
            updateTopOffset();
        }
    });

    /*window.addEventListener("keydown", function(event) {
        if (event.keyCode === 37 || event.keyCode === 39) {
            console.log("KEY PRESSED!");
            updateTopOffset();
        }
    });*/

    // FUNCTIONS
    function updateTopOffset(){
        var oldTop = parseInt(document.getElementById("oldgisdetails").style.top, 10);

        setTimeout(function(){
            var newTop = parseInt(document.getElementById("oldgisdetails").style.top, 10);
            if(oldTop != newTop){
                addOverrideTopCss(newTop - 55);
            }
        }, 100);
    }

    function addOverrideHeightCss(){
        var _style = document.createElement('style');
        _style.type = 'text/css';
        _style.id = "override-height-css";

        _style.innerHTML = "#oldgisdetails { display: flex!important; } ";

        head.appendChild(_style);
    }

    function addOverrideTopCss(px){
        deleteOverrideTopCss();

        var _style = document.createElement('style');
        _style.type = 'text/css';
        _style.id = "override-top-css";

        _style.innerHTML = "#oldgisdetails { top: " + px + "px!important; } ";

        head.appendChild(_style);
    }

    function deleteOverrideHeightCss(){
        var _style = document.getElementById('override-height-css');
        _style.parentNode.removeChild(_style);
    }

    function deleteOverrideTopCss(){
        var _style = document.getElementById('override-top-css');
        if(_style)
            _style.parentNode.removeChild(_style);
    }

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址