<commit_before>/*
 * Modified version of http://github.com/desandro/imagesloaded v2.1.1
 * MIT License. by <NAME> et al.
 */

var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';

function loaded(image, callback) {
    "use strict";
    var src;

    if (!image.nodeName) { return callback(new Error('First argument must be an image element')); }
    if (image.nodeName.toLowerCase() !== 'img') { return callback(new Error('Element supplied is not an image')); }
    if (image.src  && image.complete && image.naturalWidth !== undefined) { return callback(null, true); }

    function eventBind(attach, event, cb) {
        if (!image.addEventListener) {
            image[(attach ? 'attachEvent' : 'detachEvent')]('on' + event, cb);
        } else {
            image[(attach ? 'addEventListener' : 'removeEventListener')](event, cb, false);
        }
    }

    function loaded() {
        console.log("loaded", e.srcElement);

        eventBind(false, 'load', loaded);
        eventBind(false, 'onerror', loaded);
        callback(null, false);
    }

    eventBind(true, 'load', loaded);
    eventBind(true, 'onerror', loaded);

    if (image.readyState || image.complete) {
        src = image.src;<commit_msg>Back to working version<commit_after>/*
 * Modified version of http://github.com/desandro/imagesloaded v2.1.1
 * MIT License. by <NAME> et al.
 */

var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='

function loaded(image, callback) {
    "use strict";
    var src, old, onload;

    if (!image.nodeName) {
        return callback(new Error('First argument must be an image element'));
    }

    if (image.nodeName.toLowerCase() !== 'img') {
        return callback(new Error('Element supplied is not an image'));
    }
    if (image.src && image.complete && image.naturalWidth !== undefined) {
        return callback(null, true);
    }

    old = !image.addEventListener;

    function onloaded() {
        if (old) {
            image.detachEvent('onload', onloaded);
            image.detachEvent('onerror', onloaded);
        } else {
            image.removeEventListener('load', onloaded, false);
            image.removeEventListener('error', onloaded, false);
        }
        callback(null, false);
    }

    if (old) {
        image.attachEvent('onload', onloaded);
        image.attachEvent('onerror', onloaded);
    } else {
        image.addEventListener('load', onloaded, false);
        image.addEventListener('error', onloaded, false);
    }

    if (image.readyState || image.complete) {
        src = image.src;
{'fraction_non_alphanumeric': 0.14575363427697016, 'fraction_numerical': 0.0045906656465187455, 'mean_word_length': 2.9146706586826348, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4207985', 'n_tokens_mistral': 798, 'n_tokens_neox': 777, 'n_words': 185}