<commit_before>(function () {
    var ImageAlter = {
        fetchImageAltTags: function () {
            var apikey = "e819d57ca4064af4ada5ae1cc4ff0628";
            var url = "https://api.projectoxford.ai/vision/v1.0/describe";
            /*var request = new XMLHttpRequest();
            request.open('POST', url, true);
            request.setRequestHeader('Content-Type', 'application/json');
            request.setRequestHeader('Access-Control-Allow-Origin','*');
            request.send({
                "url": "https://www.whitehouse.gov/sites/whitehouse.gov/files/images/first-family/42_bill_clinton.jpg"
            });

            request.onreadystatechange = function () {
                if (this.readyState === 4) {
                    if (this.status >= 200 && this.status < 400) {
                        console.log("Success");
                        var resp = this.responseText;
                    } else {
                        console.log("Error");
                    }
                }

            }*/
            var obj = {
                "url": "https://www.whitehouse.gov/sites/whitehouse.gov/files/images/first-family/42_bill_clinton.jpg"
            };
            $.ajax({
                url: url,
                type: "POST",
                dataType: "json",
                headers: {
                    "Ocp-Apim-Subscription-Key": "e819d57ca4064af4ada5ae1cc4ff0628",
                    "Content-Type": "application/json"
                },
                data: JSON.stringify(obj),
                success: function (data) {
                    console.log(data);
                },
                error: function (error) {
                    console.log(error);
                },
            });

        }
    }
    window.ImageAlter = ImageAlter;
})();<commit_msg>new logic for fetching all the image urls in a page<commit_after>(function($) {
    var ImageAlter = {
        fetchImageAltTags: function() {
            var apikey = "e819d57ca4064af4ada5ae1cc4ff0628";
            var url = "https://api.projectoxford.ai/vision/v1.0/describe";
            /*var request = new XMLHttpRequest();
            request.open('POST', url, true);
            request.setRequestHeader('Content-Type', 'application/json');
            request.setRequestHeader('Access-Control-Allow-Origin','*');
            request.send({
                "url": "https://www.whitehouse.gov/sites/whitehouse.gov/files/images/first-family/42_bill_clinton.jpg"
            });
            
            request.onreadystatechange = function () {
                if (this.readyState === 4) {
                    if (this.status >= 200 && this.status < 400) {
                        console.log("Success");
                        var resp = this.responseText;
                    } else {
                        console.log("Error");
                    }
                }

            }*/

            var getImageURL = function() {
                var arr = [];
                var imgs = document.getElementsByTagName('img');
                for (var i = 0; i < imgs.length; i++) {
                    arr.push(imgs[i].src);
                }
                return arr;
            };
            var images = $('img');
            var imageurls = getImageURL();
            for (var i = 0; i < imageurls.length; i++) {
                var obj = {
                    "url": imageurls[i]
                }
                $.ajax({
                    url: url,
                    type: "POST",
                    dataType: "json",
                    headers: {
                        "Ocp-Apim-Subscription-Key": apikey,
                        "Content-Type": "application/json"
                    },
                    data: JSON.stringify(obj),
                    success: function(data) {
                        console.log("URL = " + obj.url);
                        console.log(data.description.captions[0].text);
                    },
                    error: function(error) {
                        console.log(error);
                    },
                });

            }
        }
    }
    window.ImageAlter = ImageAlter;
})(jQuery);
{'fraction_non_alphanumeric': 0.12395709177592372, 'fraction_numerical': 0.018593563766388557, 'mean_word_length': 1.155110426296867, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 5, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3029560', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1052, 'n_words': 178}