<commit_before>$(document).ready(function(){
    $("#button").click(function(){
        scrapeURL();
    });
    
    $("input").keyup(function(){
        if($("input").val().length === 0) {
            $("#databox").slideUp('show');
        }
    })
    
    function scrapeURL() {
    var content = $("input").val();
        var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
        var url = content.match(urlRegex);
        
        if(url.length>0){
            $("#databox").slideDown('show');
            //$("#databox").html("<img src='http://demo.techumber.com/FbUrlParser/loading.gif'>");
            // Getting cross domain data 
            $.get("index.php?url="+url,function(response){
                // Loading <title></title>data
                var title=(/<title>(.*?)<\/title>/m).exec(response)[1];
                var desc = (/<meta name="description" content="(.*?)"/m).exec(response)[1];
                // Loading first .png image src='' data 
                //var og = (/<meta property="og:image" content="(.*?)"\/>/ig).exec(response)[1];
                var parser = new DOMParser()
                var doc = parser.parseFromString(response, "text/html")
                var firstImage = $(doc).find("img")[0]
                $("#image").html("<img src='"+url+$(firstImage).attr("src")+"'/>");<commit_msg>Minor JS syntax, err handling, jQuery<commit_after>$(document).ready(function(){
    $("#button").click(function(){
        scrapeURL();
    });
    
    $("input").keyup(function(){
        if($("input").val().length === 0) {
            $("#databox").slideUp('show');
        }
    })
    
    function scrapeURL() {
        var content = $("input").val();
        var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
        var url = content.match(urlRegex);
        
        if(url){
            $("#databox").slideDown('show');
            //$("#databox").html("<img src='http://demo.techumber.com/FbUrlParser/loading.gif'>");
            // Getting cross domain data 
            $.get("index.php?url="+url[0],function(response){
                // Loading <title></title>data
                var title=(/<title>(.*?)<\/title>/m).exec(response)[1];
                var desc = (/<meta name="description" content="(.*?)"/m).exec(response);
                if (desc && desc.length > 1) {
                    desc = desc[1];
                }
                // Loading first .png image src='' data 
                //var og = (/<meta property="og:image" content="(.*?)"\/>/ig).exec(response)[1];
                var parser = new DOMParser()
                var doc = parser.parseFromString(response, "text/html")
                var firstImage = $(doc).find("img").first()
                if (firstImage.length) {
                    $("#image").html("<img src='"+url+firstImage.attr("src")+"'/>");
                }
{'fraction_non_alphanumeric': 0.23595505617977527, 'fraction_numerical': 0.0068096697310180455, 'mean_word_length': 1.9233830845771145, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1907329', 'n_tokens_mistral': 938, 'n_tokens_neox': 893, 'n_words': 132}