function is_blocked()

in js/abuse.js [239:299]


function is_blocked(e) {
    if (e) {
        if (e.key !== 'Enter') {
            console.log("moo")
            return
        } else {
            e.preventDefault();
        }
    }
    const ip = document.getElementById('ip_address').value;
    const cidr = to_cidr(ip);
    if (!cidr) {
        alert("Please input a valid IPv4 or IPv6 address or range.");
        return
    }
    console.log(`Checking block list for occurrences of ${ip}...`);

    document.getElementById('block_results_table').style.visibility = "visible";
    const bdiv = document.getElementById('block_results');
    bdiv.innerText = "";
    let c = 0;
    for (let block_entry of blocks) {
        let bcidr = to_cidr(block_entry.ip);
        if (bcidr.contains(cidr) || cidr.contains(bcidr)) {
            if (++c > 100) break
            const rdiv = document.createElement('tr');

            // block match
            const cidrdiv = document.createElement('th');
            cidrdiv.className = "cidrblock";
            cidrdiv.scope = "row";
            cidrdiv.innerText = block_entry.ip;
            rdiv.appendChild(cidrdiv);

            // timestamp
            const tdiv = document.createElement('td');
            tdiv.className = "timeblock";
            tdiv.innerText = new Date(block_entry.timestamp * 1000.0).toUTCString();
            rdiv.appendChild(tdiv);

            // reason
            const reasondiv = document.createElement('td');
            reasondiv.className = 'reasonblock';
            reasondiv.inject(fixup_urls(block_entry.reason));
            rdiv.appendChild(reasondiv);

            bdiv.appendChild(rdiv);
        }
    }
    if (bdiv.innerText === "") {
        document.getElementById('blockheads').style.visibility = "hidden";
        bdiv.innerText = "We could not find any entries matching your IP address or range. If you are certain you are blocked from our resources, please see the paragraph below about ";
        const dlink = document.createElement('a');
        dlink.innerText = "debugging connectivity issues";
        dlink.href = "#debug";
        bdiv.appendChild(dlink);
    } else {
        document.getElementById('blockheads').style.visibility = "visible";
    }
    return false
}