Greasy Fork is available in English.

השוטר של ניב

FXPהדרך הפשוטה ביותר לבדוק גודל של חתימה ב

// ==UserScript==
// @name         השוטר של ניב
// @namespace    http://fxp.co.il/
// @version      0.5
// @description  FXPהדרך הפשוטה ביותר לבדוק גודל של חתימה ב
// @author       Muffin24
// @match        https://www.fxp.co.il/showthread.php*
// @match        https://www.fxp.co.il/member.php*
// @grant        none
// ==/UserScript==
if (!window.IntersectionObserver) {
    console.info('browser not supported')
}
let imagesLoaded = 0;
console.clear();
function signatureColor(element, height = 295, color = 'red') {
    if (element.clientHeight > height) {
        element.closest('.signature.restore, .signature_holder').style.backgroundColor = color;
    }
}

const observer = new IntersectionObserver(function(entries) {

    entries.forEach(function(entry) {
        if (entry.isIntersecting) {
            imagesLoaded++;
            console.log(entry.target);
            signatureColor(entry.target);
            observer.unobserve(entry.target);
        }
    });

    if (imagesLoaded == images.length) {
        console.log('All images have finished loading');
    }

});

const selector = location.pathname == '/member.php' ? '#view-aboutme .signature_holder' : '.signaturecontainer img';
const images = document.querySelectorAll(selector);

images.forEach(function(image) {
    observer.observe(image);
});