document.addEventListener('DOMContentLoaded', function(){
    if (document.querySelectorAll('link[href*="nocodb"]').length == 0)
        return;
    
    function checkurlelement(){
        var eles = document.querySelectorAll('a.z-3.text-sm.underline');
        for (var ele of eles){
            if (ele.replacedByImage)
                continue;
    
            var innerHTML = ele.innerHTML;
            if (innerHTML.match(/^http[s]:\/\//) && (innerHTML.match(/\.png/i) || innerHTML.match(/\.jpg/i) || innerHTML.match(/\.avif/i) ||innerHTML.match(/\.webp/i))){
                ele.replacedByImage = true;
                ele.innerHTML = '<img style="height:80px" src="' + innerHTML + '">';
            }
        }
    }
    window.addEventListener('click', function(){
        console.log('click');
        checkurlelement();
    });
    
    window.addEventListener('mousewheel', function(){
        console.log('mousewheel');
        checkurlelement();
    });
    });